Exemplo n.º 1
0
        public void ConversionRoundTrip()
        {
            ElectricPotential volt = ElectricPotential.FromVolts(1);

            AssertEx.EqualTolerance(1, ElectricPotential.FromKilovolts(volt.Kilovolts).Volts, KilovoltsTolerance);
            AssertEx.EqualTolerance(1, ElectricPotential.FromMegavolts(volt.Megavolts).Volts, MegavoltsTolerance);
            AssertEx.EqualTolerance(1, ElectricPotential.FromMicrovolts(volt.Microvolts).Volts, MicrovoltsTolerance);
            AssertEx.EqualTolerance(1, ElectricPotential.FromMillivolts(volt.Millivolts).Volts, MillivoltsTolerance);
            AssertEx.EqualTolerance(1, ElectricPotential.FromVolts(volt.Volts).Volts, VoltsTolerance);
        }
Exemplo n.º 2
0
 /// <inheritdoc cref="ElectricPotential.FromMegavolts(double?)"/>
 public static ElectricPotential?Megavolts(this double?value) => ElectricPotential.FromMegavolts(value);
Exemplo n.º 3
0
 /// <inheritdoc cref="ElectricPotential.FromMegavolts(double)"/>
 public static ElectricPotential Megavolts(this long value) => ElectricPotential.FromMegavolts(value);
Exemplo n.º 4
0
 /// <inheritdoc cref="ElectricPotential.FromMegavolts(double?)"/>
 public static ElectricPotential?Megavolts(this decimal?value) => ElectricPotential.FromMegavolts(value == null ? (double?)null : Convert.ToDouble(value.Value));
Exemplo n.º 5
0
 /// <inheritdoc cref="ElectricPotential.FromMegavolts(double)"/>
 public static ElectricPotential Megavolts(this decimal value) => ElectricPotential.FromMegavolts(Convert.ToDouble(value));
Exemplo n.º 6
0
 public void NumberToMegavoltsTest() =>
 Assert.Equal(ElectricPotential.FromMegavolts(2), 2.Megavolts());
Exemplo n.º 7
0
 public static ElectricPotential?Megavolts <T>(this T?value) where T : struct => ElectricPotential.FromMegavolts(value == null ? (double?)null : Convert.ToDouble(value.Value));
Exemplo n.º 8
0
 public static ElectricPotential Megavolts <T>(this T value) =>
 ElectricPotential.FromMegavolts(Convert.ToDecimal(value));