示例#1
0
        public void ConversionRoundTrip()
        {
            Energy joule = Energy.FromJoules(1);

            AssertEx.EqualTolerance(1, Energy.FromBritishThermalUnits(joule.BritishThermalUnits).Joules, BritishThermalUnitsTolerance);
            AssertEx.EqualTolerance(1, Energy.FromCalories(joule.Calories).Joules, CaloriesTolerance);
            AssertEx.EqualTolerance(1, Energy.FromDecathermsEc(joule.DecathermsEc).Joules, DecathermsEcTolerance);
            AssertEx.EqualTolerance(1, Energy.FromDecathermsImperial(joule.DecathermsImperial).Joules, DecathermsImperialTolerance);
            AssertEx.EqualTolerance(1, Energy.FromDecathermsUs(joule.DecathermsUs).Joules, DecathermsUsTolerance);
            AssertEx.EqualTolerance(1, Energy.FromElectronVolts(joule.ElectronVolts).Joules, ElectronVoltsTolerance);
            AssertEx.EqualTolerance(1, Energy.FromErgs(joule.Ergs).Joules, ErgsTolerance);
            AssertEx.EqualTolerance(1, Energy.FromFootPounds(joule.FootPounds).Joules, FootPoundsTolerance);
            AssertEx.EqualTolerance(1, Energy.FromGigabritishThermalUnits(joule.GigabritishThermalUnits).Joules, GigabritishThermalUnitsTolerance);
            AssertEx.EqualTolerance(1, Energy.FromGigawattHours(joule.GigawattHours).Joules, GigawattHoursTolerance);
            AssertEx.EqualTolerance(1, Energy.FromJoules(joule.Joules).Joules, JoulesTolerance);
            AssertEx.EqualTolerance(1, Energy.FromKilobritishThermalUnits(joule.KilobritishThermalUnits).Joules, KilobritishThermalUnitsTolerance);
            AssertEx.EqualTolerance(1, Energy.FromKilocalories(joule.Kilocalories).Joules, KilocaloriesTolerance);
            AssertEx.EqualTolerance(1, Energy.FromKilojoules(joule.Kilojoules).Joules, KilojoulesTolerance);
            AssertEx.EqualTolerance(1, Energy.FromKilowattHours(joule.KilowattHours).Joules, KilowattHoursTolerance);
            AssertEx.EqualTolerance(1, Energy.FromMegabritishThermalUnits(joule.MegabritishThermalUnits).Joules, MegabritishThermalUnitsTolerance);
            AssertEx.EqualTolerance(1, Energy.FromMegajoules(joule.Megajoules).Joules, MegajoulesTolerance);
            AssertEx.EqualTolerance(1, Energy.FromMegawattHours(joule.MegawattHours).Joules, MegawattHoursTolerance);
            AssertEx.EqualTolerance(1, Energy.FromThermsEc(joule.ThermsEc).Joules, ThermsEcTolerance);
            AssertEx.EqualTolerance(1, Energy.FromThermsImperial(joule.ThermsImperial).Joules, ThermsImperialTolerance);
            AssertEx.EqualTolerance(1, Energy.FromThermsUs(joule.ThermsUs).Joules, ThermsUsTolerance);
            AssertEx.EqualTolerance(1, Energy.FromWattHours(joule.WattHours).Joules, WattHoursTolerance);
        }
 /// <inheritdoc cref="Energy.FromDecathermsEc(UnitsNet.QuantityValue)" />
 public static Energy DecathermsEc <T>(this T value) =>
 Energy.FromDecathermsEc(Convert.ToDouble(value));
示例#3
0
 /// <inheritdoc cref="Energy.FromDecathermsEc(double?)"/>
 public static Energy?DecathermsEc(this decimal?value) => Energy.FromDecathermsEc(value == null ? (double?)null : Convert.ToDouble(value.Value));
 public void NumberToDecathermsEcTest() =>
 Assert.Equal(Energy.FromDecathermsEc(2), 2.DecathermsEc());
示例#5
0
 /// <inheritdoc cref="Energy.FromDecathermsEc(double)"/>
 public static Energy DecathermsEc(this decimal value) => Energy.FromDecathermsEc(Convert.ToDouble(value));
示例#6
0
 /// <inheritdoc cref="Energy.FromDecathermsEc(double?)"/>
 public static Energy?DecathermsEc(this float?value) => Energy.FromDecathermsEc(value);
示例#7
0
 /// <inheritdoc cref="Energy.FromDecathermsEc(double?)"/>
 public static Energy?DecathermsEc(this double?value) => Energy.FromDecathermsEc(value);
示例#8
0
 /// <inheritdoc cref="Energy.FromDecathermsEc(double)"/>
 public static Energy DecathermsEc(this long value) => Energy.FromDecathermsEc(value);
 public static Energy?DecathermsEc <T>(this T?value) where T : struct => Energy.FromDecathermsEc(value == null ? (double?)null : Convert.ToDouble(value.Value));