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);
        }
示例#2
0
 public static ElectricResistance?Gigaohms <T>(this T?value) where T : struct => ElectricResistance.FromGigaohms(value == null ? (double?)null : Convert.ToDouble(value.Value));
示例#3
0
 public void NumberToGigaohmsTest() =>
 Assert.Equal(ElectricResistance.FromGigaohms(2), 2.Gigaohms());
示例#4
0
 /// <inheritdoc cref="ElectricResistance.FromGigaohms(UnitsNet.QuantityValue)" />
 public static ElectricResistance Gigaohms <T>(this T value) => ElectricResistance.FromGigaohms(Convert.ToDouble(value));