Exemplo n.º 1
0
        public void TryParseSuccess(string text)
        {
            LengthUnit result;

            Assert.AreEqual(true, LengthUnit.TryParse(text, out result));
            Assert.AreEqual(text.Trim(), result.ToString());
        }
Exemplo n.º 2
0
        public void ParseError(string text)
        {
            Assert.Throws <FormatException>(() => LengthUnit.Parse(text));
            LengthUnit temp;

            Assert.AreEqual(false, LengthUnit.TryParse(text, out temp));
        }
Exemplo n.º 3
0
        public static void ParseMetres(string s)
        {
            var actual   = LengthUnit.Parse(s);
            var expected = LengthUnit.Metres;

            Assert.AreEqual(expected, actual);

            actual = UnitParser <LengthUnit> .Parse(s);

            Assert.AreEqual(expected, actual);

            var success = LengthUnit.TryParse(s, out actual);

            Assert.AreEqual(true, success);
            Assert.AreEqual(expected, actual);

            success = UnitParser <LengthUnit> .TryParse(s, out actual);

            Assert.AreEqual(true, success);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
 public static void TryParseError(string text)
 {
     Assert.AreEqual(false, LengthUnit.TryParse(text, out var _));
 }
Exemplo n.º 5
0
 public static void TryParseSuccess(string text, string expected)
 {
     Assert.AreEqual(true, LengthUnit.TryParse(text, out var result));
     Assert.AreEqual(expected, result.ToString());
 }
Exemplo n.º 6
0
 public void TryParseSuccess(TestCase testCase)
 {
     Assert.AreEqual(true, LengthUnit.TryParse(testCase.Text, out LengthUnit result));
     Assert.AreEqual(testCase.Expected, result.ToString());
 }
Exemplo n.º 7
0
        public void TryParseError(string text)
        {
            LengthUnit temp;

            Assert.AreEqual(false, LengthUnit.TryParse(text, out temp));
        }