summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/Issues/Bz48554.xaml.cs
blob: e5b814b038b5de311895e89c6d63787fdb7f953f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections.Generic;
using System.Windows.Input;
using NUnit.Framework;
using Xamarin.Forms;

namespace Xamarin.Forms.Xaml.UnitTests
{
	public class Bz48554View
	{
		static List<string> all;

		public static List<string> All {
			get {
				if (all == null) {
					all = new List<string>();
					all.Add("6b+");
					all.Add("6c");
					all.Add("6c+");
					all.Add("7a");
					all.Add("7a+");
				}
				return all;
			}
			set {
				all = value;
			}
		}
	}

	public class Bz48554Slider : View
	{
		public static readonly BindableProperty ValuesProperty =
			BindableProperty.Create(nameof(Values), typeof(List<string>), typeof(Bz48554Slider), null);

		public List<string> Values {
			get { return (List<string>)GetValue(ValuesProperty); }
			set { SetValue(ValuesProperty, value); }
		}
	}

	public partial class Bz48554 : ContentPage
	{
		public Bz48554()
		{
			InitializeComponent();
		}

		public Bz48554(bool useCompiledXaml)
		{
			//this stub will be replaced at compile time
		}

		[TestFixture]
		class Tests
		{
			[TestCase(true)]
			[TestCase(false)]
			public void XStaticWithXamlC(bool useCompiledXaml)
			{
				Bz48554 page = null;
				Assert.DoesNotThrow(()=> page = new Bz48554(useCompiledXaml));
				Assert.NotNull(page.SliderGrades);
				Assert.AreEqual(5, page.SliderGrades.Values.Count);
			}
		}
	}
}