summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/OnPlatform.xaml.cs
blob: 2c2c6482fd6f55d4c9073982d5109baab2b32667 (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
using System;
using System.Collections.Generic;

using Xamarin.Forms;

using NUnit.Framework;

namespace Xamarin.Forms.Xaml.UnitTests
{
	public partial class OnPlatform : ContentPage
	{
		public OnPlatform ()
		{
			InitializeComponent ();
		}

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

		[TestFixture]
		public class Tests
		{
			[TestCase (false)]
			[TestCase (true)]
			public void BoolToVisibility (bool useCompiledXaml)
			{
				Device.OS = TargetPlatform.iOS;
				var layout = new OnPlatform (useCompiledXaml);
				Assert.AreEqual (true, layout.label0.IsVisible);

				Device.OS = TargetPlatform.Android;
				layout = new OnPlatform (useCompiledXaml);
				Assert.AreEqual (false, layout.label0.IsVisible);
			}
		}

		public void T ()
		{
			var onplat = new OnPlatform<bool> ();
			var label = new Label ();
			label.IsVisible = onplat;
		}
	}
}