コード例 #1
0
        public void PathToDefaultUnitTest()
        {
            //scenario 1: Mile To Foot

            UnitPathStack expected = new UnitPathStack();

            expected.Push(
                new UnitPathItem
            {
                Unit        = new Mile(),
                Numerator   = 1,
                Denominator = 1
            }
                );

            expected.Push(
                new UnitPathItem
            {
                Unit        = new Yard(),
                Numerator   = 1760,
                Denominator = 1
            }
                );

            expected.Push(
                new UnitPathItem
            {
                Unit        = new Foot(),
                Numerator   = 3,
                Denominator = 1
            }
                );


            Mile mil = new Mile();

            UnitPathStack actual = mil.PathToDefaultUnit();


            Assert.AreEqual(expected, actual);



            Inch          f  = new Inch();
            UnitPathStack up = f.PathToDefaultUnit();

            Assert.AreEqual(1 / 12.0, up.ConversionFactor);
        }