コード例 #1
0
        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));