Esempio n. 1
0
 public void FromValueAndUnit()
 {
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilogramForceCentimeter).KilogramForceCentimeters, KilogramForceCentimetersTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilogramForceMeter).KilogramForceMeters, KilogramForceMetersTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilogramForceMillimeter).KilogramForceMillimeters, KilogramForceMillimetersTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilonewtonCentimeter).KilonewtonCentimeters, KilonewtonCentimetersTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilonewtonMeter).KilonewtonMeters, KilonewtonMetersTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilonewtonMillimeter).KilonewtonMillimeters, KilonewtonMillimetersTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilopoundForceFoot).KilopoundForceFeet, KilopoundForceFeetTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilopoundForceInch).KilopoundForceInches, KilopoundForceInchesTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.NewtonCentimeter).NewtonCentimeters, NewtonCentimetersTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.NewtonMeter).NewtonMeters, NewtonMetersTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.NewtonMillimeter).NewtonMillimeters, NewtonMillimetersTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.PoundForceFoot).PoundForceFeet, PoundForceFeetTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.PoundForceInch).PoundForceInches, PoundForceInchesTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceCentimeter).TonneForceCentimeters, TonneForceCentimetersTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceMeter).TonneForceMeters, TonneForceMetersTolerance);
     AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceMillimeter).TonneForceMillimeters, TonneForceMillimetersTolerance);
 }
        public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit()
        {
            var quantity00 = Torque.From(1, TorqueUnit.KilogramForceCentimeter);

            AssertEx.EqualTolerance(1, quantity00.KilogramForceCentimeters, KilogramForceCentimetersTolerance);
            Assert.Equal(TorqueUnit.KilogramForceCentimeter, quantity00.Unit);

            var quantity01 = Torque.From(1, TorqueUnit.KilogramForceMeter);

            AssertEx.EqualTolerance(1, quantity01.KilogramForceMeters, KilogramForceMetersTolerance);
            Assert.Equal(TorqueUnit.KilogramForceMeter, quantity01.Unit);

            var quantity02 = Torque.From(1, TorqueUnit.KilogramForceMillimeter);

            AssertEx.EqualTolerance(1, quantity02.KilogramForceMillimeters, KilogramForceMillimetersTolerance);
            Assert.Equal(TorqueUnit.KilogramForceMillimeter, quantity02.Unit);

            var quantity03 = Torque.From(1, TorqueUnit.KilonewtonCentimeter);

            AssertEx.EqualTolerance(1, quantity03.KilonewtonCentimeters, KilonewtonCentimetersTolerance);
            Assert.Equal(TorqueUnit.KilonewtonCentimeter, quantity03.Unit);

            var quantity04 = Torque.From(1, TorqueUnit.KilonewtonMeter);

            AssertEx.EqualTolerance(1, quantity04.KilonewtonMeters, KilonewtonMetersTolerance);
            Assert.Equal(TorqueUnit.KilonewtonMeter, quantity04.Unit);

            var quantity05 = Torque.From(1, TorqueUnit.KilonewtonMillimeter);

            AssertEx.EqualTolerance(1, quantity05.KilonewtonMillimeters, KilonewtonMillimetersTolerance);
            Assert.Equal(TorqueUnit.KilonewtonMillimeter, quantity05.Unit);

            var quantity06 = Torque.From(1, TorqueUnit.KilopoundForceFoot);

            AssertEx.EqualTolerance(1, quantity06.KilopoundForceFeet, KilopoundForceFeetTolerance);
            Assert.Equal(TorqueUnit.KilopoundForceFoot, quantity06.Unit);

            var quantity07 = Torque.From(1, TorqueUnit.KilopoundForceInch);

            AssertEx.EqualTolerance(1, quantity07.KilopoundForceInches, KilopoundForceInchesTolerance);
            Assert.Equal(TorqueUnit.KilopoundForceInch, quantity07.Unit);

            var quantity08 = Torque.From(1, TorqueUnit.MeganewtonCentimeter);

            AssertEx.EqualTolerance(1, quantity08.MeganewtonCentimeters, MeganewtonCentimetersTolerance);
            Assert.Equal(TorqueUnit.MeganewtonCentimeter, quantity08.Unit);

            var quantity09 = Torque.From(1, TorqueUnit.MeganewtonMeter);

            AssertEx.EqualTolerance(1, quantity09.MeganewtonMeters, MeganewtonMetersTolerance);
            Assert.Equal(TorqueUnit.MeganewtonMeter, quantity09.Unit);

            var quantity10 = Torque.From(1, TorqueUnit.MeganewtonMillimeter);

            AssertEx.EqualTolerance(1, quantity10.MeganewtonMillimeters, MeganewtonMillimetersTolerance);
            Assert.Equal(TorqueUnit.MeganewtonMillimeter, quantity10.Unit);

            var quantity11 = Torque.From(1, TorqueUnit.MegapoundForceFoot);

            AssertEx.EqualTolerance(1, quantity11.MegapoundForceFeet, MegapoundForceFeetTolerance);
            Assert.Equal(TorqueUnit.MegapoundForceFoot, quantity11.Unit);

            var quantity12 = Torque.From(1, TorqueUnit.MegapoundForceInch);

            AssertEx.EqualTolerance(1, quantity12.MegapoundForceInches, MegapoundForceInchesTolerance);
            Assert.Equal(TorqueUnit.MegapoundForceInch, quantity12.Unit);

            var quantity13 = Torque.From(1, TorqueUnit.NewtonCentimeter);

            AssertEx.EqualTolerance(1, quantity13.NewtonCentimeters, NewtonCentimetersTolerance);
            Assert.Equal(TorqueUnit.NewtonCentimeter, quantity13.Unit);

            var quantity14 = Torque.From(1, TorqueUnit.NewtonMeter);

            AssertEx.EqualTolerance(1, quantity14.NewtonMeters, NewtonMetersTolerance);
            Assert.Equal(TorqueUnit.NewtonMeter, quantity14.Unit);

            var quantity15 = Torque.From(1, TorqueUnit.NewtonMillimeter);

            AssertEx.EqualTolerance(1, quantity15.NewtonMillimeters, NewtonMillimetersTolerance);
            Assert.Equal(TorqueUnit.NewtonMillimeter, quantity15.Unit);

            var quantity16 = Torque.From(1, TorqueUnit.PoundForceFoot);

            AssertEx.EqualTolerance(1, quantity16.PoundForceFeet, PoundForceFeetTolerance);
            Assert.Equal(TorqueUnit.PoundForceFoot, quantity16.Unit);

            var quantity17 = Torque.From(1, TorqueUnit.PoundForceInch);

            AssertEx.EqualTolerance(1, quantity17.PoundForceInches, PoundForceInchesTolerance);
            Assert.Equal(TorqueUnit.PoundForceInch, quantity17.Unit);

            var quantity18 = Torque.From(1, TorqueUnit.TonneForceCentimeter);

            AssertEx.EqualTolerance(1, quantity18.TonneForceCentimeters, TonneForceCentimetersTolerance);
            Assert.Equal(TorqueUnit.TonneForceCentimeter, quantity18.Unit);

            var quantity19 = Torque.From(1, TorqueUnit.TonneForceMeter);

            AssertEx.EqualTolerance(1, quantity19.TonneForceMeters, TonneForceMetersTolerance);
            Assert.Equal(TorqueUnit.TonneForceMeter, quantity19.Unit);

            var quantity20 = Torque.From(1, TorqueUnit.TonneForceMillimeter);

            AssertEx.EqualTolerance(1, quantity20.TonneForceMillimeters, TonneForceMillimetersTolerance);
            Assert.Equal(TorqueUnit.TonneForceMillimeter, quantity20.Unit);
        }
Esempio n. 3
0
 public void FromValueAndUnit()
 {
     Assert.AreEqual(1, Torque.From(1, TorqueUnit.Newtonmeter).Newtonmeters, NewtonmetersTolerance);
 }