예제 #1
0
        public void ParseError(string text)
        {
            Assert.Throws <FormatException>(() => LengthUnit.Parse(text));
            LengthUnit temp;

            Assert.AreEqual(false, LengthUnit.TryParse(text, out temp));
        }
예제 #2
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);
        }
예제 #3
0
        public static void ParseSuccess(string text, string expected)
        {
            var lengthUnit = LengthUnit.Parse(text);

            Assert.AreEqual(expected, lengthUnit.ToString());
        }
예제 #4
0
        public void ParseSuccess(TestCase testCase)
        {
            var lengthUnit = LengthUnit.Parse(testCase.Text);

            Assert.AreEqual(testCase.Expected, lengthUnit.ToString());
        }
예제 #5
0
        public void ParseSuccess(string text)
        {
            var lengthUnit = LengthUnit.Parse(text);

            Assert.AreEqual(text.Trim(), lengthUnit.ToString());
        }