Ejemplo n.º 1
0
        public void TestSpeedConvertToFunction()
        {
            var speedA = new Speed <Feet, Hours, Int32>(120);
            var speedB = speedA.ConvertTo <Inches, Minutes, Int32>();

            Assert.Equal(Convert.ToDecimal(24.0), speedB.SpeedValue);
            Assert.Same(typeof(Inches), speedB.LengthUnitOfMeasure.GetType());
            Assert.Same(typeof(Minutes), speedB.DurationUnitOfMeasure.GetType());
            var speedC = new Speed <Feet, Hours, Int32>(120);
            var speedD = speedC.ConvertTo <decimal>();

            Assert.Equal(120, speedD.SpeedValue);
            Assert.Same(typeof(decimal), speedD.SpeedValue.GetType());
        }