summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/I8.xaml.cs
blob: 4d7d874b4c33e2b22e070568efdefa2cefb3b661 (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
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using NUnit.Framework;
using Xamarin.Forms;
using Xamarin.Forms.Core.UnitTests;

namespace Xamarin.Forms.Xaml.UnitTests
{
	public partial class I8 : ContentPage
	{
		public long l0 { get; set; }
		public long l1 { get; set; }
		public long l2 { get; set; }
		public long l3 { get; set; }
		public long l4 { get; set; }
		public long l5 { get; set; }
		public long l6 { get; set; }
		public long l7 { get; set; }
		public long l8 { get; set; }
		public long l9 { get; set; }
		public ulong ul0 { get; set; }
		public ulong ul1 { get; set; }
		public ulong ul2 { get; set; }
		public ulong ul3 { get; set; }
		public ulong ul4 { get; set; }
		public ulong ul5 { get; set; }

		public I8()
		{
			InitializeComponent();
		}

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

		[TestFixture]
		public class Tests
		{
			[SetUp]
			public void Setup()
			{
				Device.PlatformServices = new MockPlatformServices();
			}

			[TearDown]
			public void TearDown()
			{
				Device.PlatformServices = null;
			}

			[TestCase(false)]
			[TestCase(true)]
			public void I8AreConverted(bool useCompiledXaml)
			{
				var p = new I8(useCompiledXaml);
				Assert.AreEqual(0L, p.l0);
				Assert.AreEqual((long)int.MaxValue, p.l1);
				Assert.AreEqual((long)uint.MaxValue, p.l2);
				Assert.AreEqual(long.MaxValue, p.l3);
				Assert.AreEqual((long)-int.MaxValue, p.l4);
				Assert.AreEqual((long)-uint.MaxValue, p.l5);
				Assert.AreEqual(-long.MaxValue, p.l6);
				Assert.AreEqual((long)256, p.l7);
				Assert.AreEqual((long)-256, p.l8);
				Assert.AreEqual((long)127, p.l9);
				Assert.AreEqual(0L, p.ul0);
				Assert.AreEqual((long)int.MaxValue, p.ul1);
				Assert.AreEqual((long)uint.MaxValue, p.ul2);
				Assert.AreEqual(long.MaxValue, p.ul3);
				Assert.AreEqual(ulong.MaxValue, p.ul4);
				Assert.AreEqual((ulong)256, p.ul5);
			}
		}
	}
}