Esempio n. 1
0
        public void UnitTestAddition()
        {
            var yards = new UnitYard(2) + new UnitFoot(6);

            Assert.AreEqual(4, yards.Value);

            var degree = new UnitDegree(20) + (new UnitRadian(Math.PI * .5d) - new UnitDegree(10));

            Assert.IsTrue(new UnitDegree(100) == degree);
        }
Esempio n. 2
0
        public void UnitTestDynamicConversion()
        {
            var yards = new UnitYard(0) + new UnitMile(1);

            Assert.AreEqual(1760, yards.Value);

            var inches = new UnitInch(0) + new UnitMile(1);

            Assert.AreEqual(63360, inches.Value);

            var centimeters = new UnitCentimeter(0) + new UnitMile(1);

            Assert.AreEqual(160934, Convert.ToInt32(centimeters.Value));

            var nauticalMiles = new UnitInch(10000000).ConvertTo(UnitNauticalMile.Unit);

            Assert.AreEqual(137, Convert.ToInt32(nauticalMiles.Value));
        }