summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.UnitTests/BoxViewUnitTests.cs
blob: 6d26af45c5a5517e261337d058904059e5486e10 (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
using System;
using NUnit.Framework;

using System.Collections.Generic;
using System.Linq;

namespace Xamarin.Forms.Core.UnitTests
{
	[TestFixture]
	public class BoxViewUnitTests : BaseTestFixture
	{
		[Test]
		public void TestConstructor ()
		{
			var box = new BoxView {
				Color = new Color (0.2, 0.3, 0.4), 
				WidthRequest=20, 
				HeightRequest=30,
				IsPlatformEnabled = true,
				Platform = new UnitPlatform ()
			};

			Assert.AreEqual (new Color (0.2, 0.3, 0.4), box.Color);
			var request = box.GetSizeRequest (double.PositiveInfinity, double.PositiveInfinity).Request;
			Assert.AreEqual (20, request.Width);
			Assert.AreEqual (30, request.Height);
		}

		[Test]
		public void DefaultSize ()
		{
			var box = new BoxView {
				IsPlatformEnabled = true,
				Platform = new UnitPlatform ()
			};

			var request = box.GetSizeRequest (double.PositiveInfinity, double.PositiveInfinity).Request;
			Assert.AreEqual (40, request.Width);
			Assert.AreEqual (40, request.Height);
		}
	}	
}