示例#1
0
        public void ConversionRoundTrip()
        {
            ElectricResistance ohm = ElectricResistance.FromOhms(1);

            Assert.AreEqual(1, ElectricResistance.FromKiloohms(ohm.Kiloohms).Ohms, KiloohmsTolerance);
            Assert.AreEqual(1, ElectricResistance.FromMegaohms(ohm.Megaohms).Ohms, MegaohmsTolerance);
            Assert.AreEqual(1, ElectricResistance.FromOhms(ohm.Ohms).Ohms, OhmsTolerance);
        }
        public void ConversionRoundTrip()
        {
            ElectricResistance ohm = ElectricResistance.FromOhms(1);

            AssertEx.EqualTolerance(1, ElectricResistance.FromGigaohms(ohm.Gigaohms).Ohms, GigaohmsTolerance);
            AssertEx.EqualTolerance(1, ElectricResistance.FromKiloohms(ohm.Kiloohms).Ohms, KiloohmsTolerance);
            AssertEx.EqualTolerance(1, ElectricResistance.FromMegaohms(ohm.Megaohms).Ohms, MegaohmsTolerance);
            AssertEx.EqualTolerance(1, ElectricResistance.FromMilliohms(ohm.Milliohms).Ohms, MilliohmsTolerance);
            AssertEx.EqualTolerance(1, ElectricResistance.FromOhms(ohm.Ohms).Ohms, OhmsTolerance);
        }
 /// <inheritdoc cref="ElectricResistance.FromMegaohms(double?)"/>
 public static ElectricResistance?Megaohms(this double?value) => ElectricResistance.FromMegaohms(value);
 /// <inheritdoc cref="ElectricResistance.FromMegaohms(double)"/>
 public static ElectricResistance Megaohms(this long value) => ElectricResistance.FromMegaohms(value);
 /// <inheritdoc cref="ElectricResistance.FromMegaohms(double?)"/>
 public static ElectricResistance?Megaohms(this decimal?value) => ElectricResistance.FromMegaohms(value == null ? (double?)null : Convert.ToDouble(value.Value));
 /// <inheritdoc cref="ElectricResistance.FromMegaohms(double)"/>
 public static ElectricResistance Megaohms(this decimal value) => ElectricResistance.FromMegaohms(Convert.ToDouble(value));
示例#7
0
 public void NumberToMegaohmsTest() =>
 Assert.Equal(ElectricResistance.FromMegaohms(2), 2.Megaohms());
示例#8
0
 public static ElectricResistance?Megaohms <T>(this T?value) where T : struct => ElectricResistance.FromMegaohms(value == null ? (double?)null : Convert.ToDouble(value.Value));
 public static ElectricResistance Megaohms <T>(this T value) =>
 ElectricResistance.FromMegaohms(Convert.ToDecimal(value));