summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.UnitTests/LayoutOptionsUnitTests.cs
blob: 476cf73cd27d7ded72549e27235d0d0d0b0724ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using NUnit.Framework;

namespace Xamarin.Forms.Core.UnitTests
{
	[TestFixture]
	public class LayoutOptionsUnitTests : BaseTestFixture
	{
		[Test]
		public void TestTypeConverter ()
		{
			var converter = new LayoutOptionsConverter ();
			Assert.True (converter.CanConvertFrom (typeof(string)));
			Assert.AreEqual (LayoutOptions.Center, converter.ConvertFromInvariantString ("LayoutOptions.Center"));
			Assert.AreEqual (LayoutOptions.Center, converter.ConvertFromInvariantString ("Center"));
			Assert.AreNotEqual (LayoutOptions.CenterAndExpand, converter.ConvertFromInvariantString ("Center"));
			Assert.Throws<InvalidOperationException> (() => converter.ConvertFromInvariantString ("foo"));
			Assert.Throws<InvalidOperationException> (() => converter.ConvertFromInvariantString ("foo.bar"));
			Assert.Throws<InvalidOperationException> (() => converter.ConvertFromInvariantString ("foo.bar.baz"));
		}
	}
}