summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.UnitTests/GridLengthTypeConverterTests.cs
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-03-22 13:02:25 -0700
committerJason Smith <jason.smith@xamarin.com>2016-03-22 16:13:41 -0700
commit17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch)
treeb5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Core.UnitTests/GridLengthTypeConverterTests.cs
downloadxamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip
Initial import
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests/GridLengthTypeConverterTests.cs')
-rw-r--r--Xamarin.Forms.Core.UnitTests/GridLengthTypeConverterTests.cs53
1 files changed, 53 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/GridLengthTypeConverterTests.cs b/Xamarin.Forms.Core.UnitTests/GridLengthTypeConverterTests.cs
new file mode 100644
index 00000000..4c1f21f7
--- /dev/null
+++ b/Xamarin.Forms.Core.UnitTests/GridLengthTypeConverterTests.cs
@@ -0,0 +1,53 @@
+using System;
+using NUnit.Framework;
+
+namespace Xamarin.Forms.Core.UnitTests
+{
+ [TestFixture]
+ public class GridLengthTypeConverterTests : BaseTestFixture
+ {
+ [Test]
+ public void TestAbsolute ()
+ {
+ var converter = new GridLengthTypeConverter ();
+
+ Assert.AreEqual (new GridLength (42), converter.ConvertFromInvariantString ("42"));
+ Assert.AreEqual (new GridLength (42.2), converter.ConvertFromInvariantString ("42.2"));
+
+ Assert.Throws<FormatException> (() => converter.ConvertFromInvariantString ("foo"));
+ }
+
+ [Test]
+ public void TestAuto ()
+ {
+ var converter = new GridLengthTypeConverter ();
+
+ Assert.AreEqual (GridLength.Auto, converter.ConvertFromInvariantString ("auto"));
+ Assert.AreEqual (GridLength.Auto, converter.ConvertFromInvariantString (" AuTo "));
+ }
+
+ [Test]
+ public void TestStar ()
+ {
+ var converter = new GridLengthTypeConverter ();
+
+ Assert.AreEqual (new GridLength (1, GridUnitType.Star), converter.ConvertFromInvariantString ("*"));
+ Assert.AreEqual (new GridLength (42, GridUnitType.Star), converter.ConvertFromInvariantString ("42*"));
+
+ }
+
+ [Test]
+ public void TestValue ()
+ {
+ var converter = new GridLengthTypeConverter ();
+ Assert.AreEqual (new GridLength(3.3), converter.ConvertFromInvariantString("3.3"));
+ }
+
+ [Test]
+ public void TestValueStar ()
+ {
+ var converter = new GridLengthTypeConverter ();
+ Assert.AreEqual (new GridLength(32.3, GridUnitType.Star), converter.ConvertFromInvariantString("32.3*"));
+ }
+ }
+} \ No newline at end of file