Example #1
0
        public static void ParseSquareMillimetres(string s)
        {
            var actual            = AreaUnit.Parse(s);
            var squareMillimetres = AreaUnit.SquareMillimetres;

            Assert.AreEqual(squareMillimetres, actual);

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

            Assert.AreEqual(squareMillimetres, actual);

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

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

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

            Assert.AreEqual(true, success);
            Assert.AreEqual(squareMillimetres, actual);
        }
Example #2
0
        public void ParseSquareMetres(string s)
        {
            var actual   = AreaUnit.Parse(s);
            var expected = AreaUnit.SquareMetres;

            Assert.AreEqual(expected, actual);

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

            Assert.AreEqual(expected, actual);

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

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

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

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