コード例 #1
0
        public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit()
        {
            var quantity00 = ElectricResistance.From(1, ElectricResistanceUnit.Gigaohm);

            AssertEx.EqualTolerance(1, quantity00.Gigaohms, GigaohmsTolerance);
            Assert.Equal(ElectricResistanceUnit.Gigaohm, quantity00.Unit);

            var quantity01 = ElectricResistance.From(1, ElectricResistanceUnit.Kiloohm);

            AssertEx.EqualTolerance(1, quantity01.Kiloohms, KiloohmsTolerance);
            Assert.Equal(ElectricResistanceUnit.Kiloohm, quantity01.Unit);

            var quantity02 = ElectricResistance.From(1, ElectricResistanceUnit.Megaohm);

            AssertEx.EqualTolerance(1, quantity02.Megaohms, MegaohmsTolerance);
            Assert.Equal(ElectricResistanceUnit.Megaohm, quantity02.Unit);

            var quantity03 = ElectricResistance.From(1, ElectricResistanceUnit.Microohm);

            AssertEx.EqualTolerance(1, quantity03.Microohms, MicroohmsTolerance);
            Assert.Equal(ElectricResistanceUnit.Microohm, quantity03.Unit);

            var quantity04 = ElectricResistance.From(1, ElectricResistanceUnit.Milliohm);

            AssertEx.EqualTolerance(1, quantity04.Milliohms, MilliohmsTolerance);
            Assert.Equal(ElectricResistanceUnit.Milliohm, quantity04.Unit);

            var quantity05 = ElectricResistance.From(1, ElectricResistanceUnit.Ohm);

            AssertEx.EqualTolerance(1, quantity05.Ohms, OhmsTolerance);
            Assert.Equal(ElectricResistanceUnit.Ohm, quantity05.Unit);
        }
コード例 #2
0
 public void FromValueAndUnit()
 {
     AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Kiloohm).Kiloohms, KiloohmsTolerance);
     AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Megaohm).Megaohms, MegaohmsTolerance);
     AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Milliohm).Milliohms, MilliohmsTolerance);
     AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Ohm).Ohms, OhmsTolerance);
 }