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