blob: 4c1f21f7e6bd5c26aeb30a4286022d86ef88da6a (
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
|
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*"));
}
}
}
|