From fbfdb00601fffa9db9ac52ddab9ac4520170564d Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Thu, 14 Sep 2017 14:11:01 +0300 Subject: [PATCH 01/19] Add Therm unit --- UnitsNet/UnitDefinitions/Energy.json | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/UnitsNet/UnitDefinitions/Energy.json b/UnitsNet/UnitDefinitions/Energy.json index 4c6037b81e..844efbff8e 100644 --- a/UnitsNet/UnitDefinitions/Energy.json +++ b/UnitsNet/UnitDefinitions/Energy.json @@ -89,6 +89,57 @@ "Abbreviations": [ "Wh" ] } ] + }, + { + "SingularName": "EuTherm", + "PluralName": "EuTherms", + "FromUnitToBaseFunc": "x*1.05506e+8", + "FromBaseToUnitFunc": "x/1.05506e+8", + "Prefixes": [ "Deca" ], + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "thm (E.U.)" ] + }, + { + "Culture": "ru-RU", + "Abbreviations": [ "Европейский терм" ] + } + ] + }, + { + "SingularName": "UsTherm", + "PluralName": "UsTherms", + "FromUnitToBaseFunc": "x*1.054804e+8", + "FromBaseToUnitFunc": "x/1.054804e+8", + "Prefixes": [ "Deca" ], + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "thm (U.S.)" ] + }, + { + "Culture": "ru-RU", + "Abbreviations": [ "Американский терм" ] + } + ] + }, + { + "SingularName": "ImperialTherm", + "PluralName": "ImperialTherms", + "FromUnitToBaseFunc": "x*1.05505585257348e+14", + "FromBaseToUnitFunc": "x/1,05505585257348e+14", + "Prefixes": [ "Deca" ], + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "thm (imp.)" ] + }, + { + "Culture": "ru-RU", + "Abbreviations": [ "Английский терм" ] + } + ] } ] } From 121f6c076daefe5660e6062902a931a2ed6d4ca7 Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Thu, 14 Sep 2017 14:22:32 +0300 Subject: [PATCH 02/19] Typo fixed --- UnitsNet/UnitDefinitions/Energy.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitsNet/UnitDefinitions/Energy.json b/UnitsNet/UnitDefinitions/Energy.json index 844efbff8e..fde3651c79 100644 --- a/UnitsNet/UnitDefinitions/Energy.json +++ b/UnitsNet/UnitDefinitions/Energy.json @@ -128,7 +128,7 @@ "SingularName": "ImperialTherm", "PluralName": "ImperialTherms", "FromUnitToBaseFunc": "x*1.05505585257348e+14", - "FromBaseToUnitFunc": "x/1,05505585257348e+14", + "FromBaseToUnitFunc": "x/1.05505585257348e+14", "Prefixes": [ "Deca" ], "Localization": [ { From 6064445a4addf50dc982c4a690647bbea27b5cd3 Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Thu, 14 Sep 2017 16:11:55 +0300 Subject: [PATCH 03/19] Generated code and tests --- UnitsNet.Tests/CustomCode/EnergyTests.cs | 7 + .../GeneratedCode/EnergyTestsBase.g.cs | 36 +++ UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs | 6 + .../Number/NumberToEnergyExtensions.g.cs | 204 ++++++++++++++++ .../GeneratedCode/UnitClasses/Energy.g.cs | 222 ++++++++++++++++++ .../GeneratedCode/UnitSystem.Default.g.cs | 36 +++ 6 files changed, 511 insertions(+) diff --git a/UnitsNet.Tests/CustomCode/EnergyTests.cs b/UnitsNet.Tests/CustomCode/EnergyTests.cs index 6667304bdd..99993dc81d 100644 --- a/UnitsNet.Tests/CustomCode/EnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/EnergyTests.cs @@ -24,6 +24,8 @@ namespace UnitsNet.Tests.CustomCode public class EnergyTests : EnergyTestsBase { // TODO Override properties in base class here + protected override double ImperialThermsInOneJoule => 9.478171203551087813109937767482e-15; + protected override double JoulesInOneJoule => 1; protected override double KilojoulesInOneJoule => 1E-3; @@ -33,10 +35,14 @@ public class EnergyTests : EnergyTestsBase protected override double BritishThermalUnitsInOneJoule => 0.00094781712; protected override double CaloriesInOneJoule => 0.239005736; + protected override double DecaeuThermsInOneJoule => 9.4781339449889105832843629746176e-10; + protected override double DecaimperialThermsInOneJoule => 9.478171203551087813109937767482e-15; + protected override double DecausThermsInOneJoule => 9.4804342797334860315281322406817e-10; protected override double ElectronVoltsInOneJoule => 6.241509343260179e18; protected override double ErgsInOneJoule => 10000000; + protected override double EuThermsInOneJoule => 9.4781339449889105832843629746176e-9; protected override double FootPoundsInOneJoule => 0.737562149; @@ -47,6 +53,7 @@ public class EnergyTests : EnergyTestsBase protected override double KilowattHoursInOneJoule => 2.77777778e-7; protected override double MegawattHoursInOneJoule => 2.77777778e-10; + protected override double UsThermsInOneJoule => 9.4804342797334860315281322406817e-9; protected override double WattHoursInOneJoule => 0.000277777778; } diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index ee9f4c0116..ec5c3492b9 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -54,31 +54,43 @@ public abstract partial class EnergyTestsBase { protected abstract double BritishThermalUnitsInOneJoule { get; } protected abstract double CaloriesInOneJoule { get; } + protected abstract double DecaeuThermsInOneJoule { get; } + protected abstract double DecaimperialThermsInOneJoule { get; } + protected abstract double DecausThermsInOneJoule { get; } protected abstract double ElectronVoltsInOneJoule { get; } protected abstract double ErgsInOneJoule { get; } + protected abstract double EuThermsInOneJoule { get; } protected abstract double FootPoundsInOneJoule { get; } protected abstract double GigawattHoursInOneJoule { get; } + protected abstract double ImperialThermsInOneJoule { get; } protected abstract double JoulesInOneJoule { get; } protected abstract double KilocaloriesInOneJoule { get; } protected abstract double KilojoulesInOneJoule { get; } protected abstract double KilowattHoursInOneJoule { get; } protected abstract double MegajoulesInOneJoule { get; } protected abstract double MegawattHoursInOneJoule { get; } + protected abstract double UsThermsInOneJoule { get; } protected abstract double WattHoursInOneJoule { get; } // ReSharper disable VirtualMemberNeverOverriden.Global protected virtual double BritishThermalUnitsTolerance { get { return 1e-5; } } protected virtual double CaloriesTolerance { get { return 1e-5; } } + protected virtual double DecaeuThermsTolerance { get { return 1e-5; } } + protected virtual double DecaimperialThermsTolerance { get { return 1e-5; } } + protected virtual double DecausThermsTolerance { get { return 1e-5; } } protected virtual double ElectronVoltsTolerance { get { return 1e-5; } } protected virtual double ErgsTolerance { get { return 1e-5; } } + protected virtual double EuThermsTolerance { get { return 1e-5; } } protected virtual double FootPoundsTolerance { get { return 1e-5; } } protected virtual double GigawattHoursTolerance { get { return 1e-5; } } + protected virtual double ImperialThermsTolerance { get { return 1e-5; } } protected virtual double JoulesTolerance { get { return 1e-5; } } protected virtual double KilocaloriesTolerance { get { return 1e-5; } } protected virtual double KilojoulesTolerance { get { return 1e-5; } } protected virtual double KilowattHoursTolerance { get { return 1e-5; } } protected virtual double MegajoulesTolerance { get { return 1e-5; } } protected virtual double MegawattHoursTolerance { get { return 1e-5; } } + protected virtual double UsThermsTolerance { get { return 1e-5; } } protected virtual double WattHoursTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global @@ -88,16 +100,22 @@ public void JouleToEnergyUnits() Energy joule = Energy.FromJoules(1); AssertEx.EqualTolerance(BritishThermalUnitsInOneJoule, joule.BritishThermalUnits, BritishThermalUnitsTolerance); AssertEx.EqualTolerance(CaloriesInOneJoule, joule.Calories, CaloriesTolerance); + AssertEx.EqualTolerance(DecaeuThermsInOneJoule, joule.DecaeuTherms, DecaeuThermsTolerance); + AssertEx.EqualTolerance(DecaimperialThermsInOneJoule, joule.DecaimperialTherms, DecaimperialThermsTolerance); + AssertEx.EqualTolerance(DecausThermsInOneJoule, joule.DecausTherms, DecausThermsTolerance); AssertEx.EqualTolerance(ElectronVoltsInOneJoule, joule.ElectronVolts, ElectronVoltsTolerance); AssertEx.EqualTolerance(ErgsInOneJoule, joule.Ergs, ErgsTolerance); + AssertEx.EqualTolerance(EuThermsInOneJoule, joule.EuTherms, EuThermsTolerance); AssertEx.EqualTolerance(FootPoundsInOneJoule, joule.FootPounds, FootPoundsTolerance); AssertEx.EqualTolerance(GigawattHoursInOneJoule, joule.GigawattHours, GigawattHoursTolerance); + AssertEx.EqualTolerance(ImperialThermsInOneJoule, joule.ImperialTherms, ImperialThermsTolerance); AssertEx.EqualTolerance(JoulesInOneJoule, joule.Joules, JoulesTolerance); AssertEx.EqualTolerance(KilocaloriesInOneJoule, joule.Kilocalories, KilocaloriesTolerance); AssertEx.EqualTolerance(KilojoulesInOneJoule, joule.Kilojoules, KilojoulesTolerance); AssertEx.EqualTolerance(KilowattHoursInOneJoule, joule.KilowattHours, KilowattHoursTolerance); AssertEx.EqualTolerance(MegajoulesInOneJoule, joule.Megajoules, MegajoulesTolerance); AssertEx.EqualTolerance(MegawattHoursInOneJoule, joule.MegawattHours, MegawattHoursTolerance); + AssertEx.EqualTolerance(UsThermsInOneJoule, joule.UsTherms, UsThermsTolerance); AssertEx.EqualTolerance(WattHoursInOneJoule, joule.WattHours, WattHoursTolerance); } @@ -106,16 +124,22 @@ public void FromValueAndUnit() { AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.BritishThermalUnit).BritishThermalUnits, BritishThermalUnitsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Calorie).Calories, CaloriesTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecaeuTherm).DecaeuTherms, DecaeuThermsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecaimperialTherm).DecaimperialTherms, DecaimperialThermsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecausTherm).DecausTherms, DecausThermsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ElectronVolt).ElectronVolts, ElectronVoltsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Erg).Ergs, ErgsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.EuTherm).EuTherms, EuThermsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.FootPound).FootPounds, FootPoundsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.GigawattHour).GigawattHours, GigawattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ImperialTherm).ImperialTherms, ImperialThermsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Joule).Joules, JoulesTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Kilocalorie).Kilocalories, KilocaloriesTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Kilojoule).Kilojoules, KilojoulesTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.KilowattHour).KilowattHours, KilowattHoursTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Megajoule).Megajoules, MegajoulesTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.MegawattHour).MegawattHours, MegawattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.UsTherm).UsTherms, UsThermsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.WattHour).WattHours, WattHoursTolerance); } @@ -125,16 +149,22 @@ public void As() var joule = Energy.FromJoules(1); AssertEx.EqualTolerance(BritishThermalUnitsInOneJoule, joule.As(EnergyUnit.BritishThermalUnit), BritishThermalUnitsTolerance); AssertEx.EqualTolerance(CaloriesInOneJoule, joule.As(EnergyUnit.Calorie), CaloriesTolerance); + AssertEx.EqualTolerance(DecaeuThermsInOneJoule, joule.As(EnergyUnit.DecaeuTherm), DecaeuThermsTolerance); + AssertEx.EqualTolerance(DecaimperialThermsInOneJoule, joule.As(EnergyUnit.DecaimperialTherm), DecaimperialThermsTolerance); + AssertEx.EqualTolerance(DecausThermsInOneJoule, joule.As(EnergyUnit.DecausTherm), DecausThermsTolerance); AssertEx.EqualTolerance(ElectronVoltsInOneJoule, joule.As(EnergyUnit.ElectronVolt), ElectronVoltsTolerance); AssertEx.EqualTolerance(ErgsInOneJoule, joule.As(EnergyUnit.Erg), ErgsTolerance); + AssertEx.EqualTolerance(EuThermsInOneJoule, joule.As(EnergyUnit.EuTherm), EuThermsTolerance); AssertEx.EqualTolerance(FootPoundsInOneJoule, joule.As(EnergyUnit.FootPound), FootPoundsTolerance); AssertEx.EqualTolerance(GigawattHoursInOneJoule, joule.As(EnergyUnit.GigawattHour), GigawattHoursTolerance); + AssertEx.EqualTolerance(ImperialThermsInOneJoule, joule.As(EnergyUnit.ImperialTherm), ImperialThermsTolerance); AssertEx.EqualTolerance(JoulesInOneJoule, joule.As(EnergyUnit.Joule), JoulesTolerance); AssertEx.EqualTolerance(KilocaloriesInOneJoule, joule.As(EnergyUnit.Kilocalorie), KilocaloriesTolerance); AssertEx.EqualTolerance(KilojoulesInOneJoule, joule.As(EnergyUnit.Kilojoule), KilojoulesTolerance); AssertEx.EqualTolerance(KilowattHoursInOneJoule, joule.As(EnergyUnit.KilowattHour), KilowattHoursTolerance); AssertEx.EqualTolerance(MegajoulesInOneJoule, joule.As(EnergyUnit.Megajoule), MegajoulesTolerance); AssertEx.EqualTolerance(MegawattHoursInOneJoule, joule.As(EnergyUnit.MegawattHour), MegawattHoursTolerance); + AssertEx.EqualTolerance(UsThermsInOneJoule, joule.As(EnergyUnit.UsTherm), UsThermsTolerance); AssertEx.EqualTolerance(WattHoursInOneJoule, joule.As(EnergyUnit.WattHour), WattHoursTolerance); } @@ -144,16 +174,22 @@ 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.FromDecaeuTherms(joule.DecaeuTherms).Joules, DecaeuThermsTolerance); + AssertEx.EqualTolerance(1, Energy.FromDecaimperialTherms(joule.DecaimperialTherms).Joules, DecaimperialThermsTolerance); + AssertEx.EqualTolerance(1, Energy.FromDecausTherms(joule.DecausTherms).Joules, DecausThermsTolerance); AssertEx.EqualTolerance(1, Energy.FromElectronVolts(joule.ElectronVolts).Joules, ElectronVoltsTolerance); AssertEx.EqualTolerance(1, Energy.FromErgs(joule.Ergs).Joules, ErgsTolerance); + AssertEx.EqualTolerance(1, Energy.FromEuTherms(joule.EuTherms).Joules, EuThermsTolerance); AssertEx.EqualTolerance(1, Energy.FromFootPounds(joule.FootPounds).Joules, FootPoundsTolerance); AssertEx.EqualTolerance(1, Energy.FromGigawattHours(joule.GigawattHours).Joules, GigawattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.FromImperialTherms(joule.ImperialTherms).Joules, ImperialThermsTolerance); AssertEx.EqualTolerance(1, Energy.FromJoules(joule.Joules).Joules, JoulesTolerance); 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.FromMegajoules(joule.Megajoules).Joules, MegajoulesTolerance); AssertEx.EqualTolerance(1, Energy.FromMegawattHours(joule.MegawattHours).Joules, MegawattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.FromUsTherms(joule.UsTherms).Joules, UsThermsTolerance); AssertEx.EqualTolerance(1, Energy.FromWattHours(joule.WattHours).Joules, WattHoursTolerance); } diff --git a/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs b/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs index bf80ea6e45..de9fccc541 100644 --- a/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs @@ -44,16 +44,22 @@ public enum EnergyUnit Undefined = 0, BritishThermalUnit, Calorie, + DecaeuTherm, + DecaimperialTherm, + DecausTherm, ElectronVolt, Erg, + EuTherm, FootPound, GigawattHour, + ImperialTherm, Joule, Kilocalorie, Kilojoule, KilowattHour, Megajoule, MegawattHour, + UsTherm, WattHour, } } diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs index 015e8f1c61..df5661bed9 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs @@ -112,6 +112,108 @@ public static class NumberToEnergyExtensions #endregion + #region DecaeuTherm + + /// + public static Energy DecaeuTherms(this int value) => Energy.FromDecaeuTherms(value); + + /// + public static Energy? DecaeuTherms(this int? value) => Energy.FromDecaeuTherms(value); + + /// + public static Energy DecaeuTherms(this long value) => Energy.FromDecaeuTherms(value); + + /// + public static Energy? DecaeuTherms(this long? value) => Energy.FromDecaeuTherms(value); + + /// + public static Energy DecaeuTherms(this double value) => Energy.FromDecaeuTherms(value); + + /// + public static Energy? DecaeuTherms(this double? value) => Energy.FromDecaeuTherms(value); + + /// + public static Energy DecaeuTherms(this float value) => Energy.FromDecaeuTherms(value); + + /// + public static Energy? DecaeuTherms(this float? value) => Energy.FromDecaeuTherms(value); + + /// + public static Energy DecaeuTherms(this decimal value) => Energy.FromDecaeuTherms(Convert.ToDouble(value)); + + /// + public static Energy? DecaeuTherms(this decimal? value) => Energy.FromDecaeuTherms(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + + #region DecaimperialTherm + + /// + public static Energy DecaimperialTherms(this int value) => Energy.FromDecaimperialTherms(value); + + /// + public static Energy? DecaimperialTherms(this int? value) => Energy.FromDecaimperialTherms(value); + + /// + public static Energy DecaimperialTherms(this long value) => Energy.FromDecaimperialTherms(value); + + /// + public static Energy? DecaimperialTherms(this long? value) => Energy.FromDecaimperialTherms(value); + + /// + public static Energy DecaimperialTherms(this double value) => Energy.FromDecaimperialTherms(value); + + /// + public static Energy? DecaimperialTherms(this double? value) => Energy.FromDecaimperialTherms(value); + + /// + public static Energy DecaimperialTherms(this float value) => Energy.FromDecaimperialTherms(value); + + /// + public static Energy? DecaimperialTherms(this float? value) => Energy.FromDecaimperialTherms(value); + + /// + public static Energy DecaimperialTherms(this decimal value) => Energy.FromDecaimperialTherms(Convert.ToDouble(value)); + + /// + public static Energy? DecaimperialTherms(this decimal? value) => Energy.FromDecaimperialTherms(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + + #region DecausTherm + + /// + public static Energy DecausTherms(this int value) => Energy.FromDecausTherms(value); + + /// + public static Energy? DecausTherms(this int? value) => Energy.FromDecausTherms(value); + + /// + public static Energy DecausTherms(this long value) => Energy.FromDecausTherms(value); + + /// + public static Energy? DecausTherms(this long? value) => Energy.FromDecausTherms(value); + + /// + public static Energy DecausTherms(this double value) => Energy.FromDecausTherms(value); + + /// + public static Energy? DecausTherms(this double? value) => Energy.FromDecausTherms(value); + + /// + public static Energy DecausTherms(this float value) => Energy.FromDecausTherms(value); + + /// + public static Energy? DecausTherms(this float? value) => Energy.FromDecausTherms(value); + + /// + public static Energy DecausTherms(this decimal value) => Energy.FromDecausTherms(Convert.ToDouble(value)); + + /// + public static Energy? DecausTherms(this decimal? value) => Energy.FromDecausTherms(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region ElectronVolt /// @@ -180,6 +282,40 @@ public static class NumberToEnergyExtensions #endregion + #region EuTherm + + /// + public static Energy EuTherms(this int value) => Energy.FromEuTherms(value); + + /// + public static Energy? EuTherms(this int? value) => Energy.FromEuTherms(value); + + /// + public static Energy EuTherms(this long value) => Energy.FromEuTherms(value); + + /// + public static Energy? EuTherms(this long? value) => Energy.FromEuTherms(value); + + /// + public static Energy EuTherms(this double value) => Energy.FromEuTherms(value); + + /// + public static Energy? EuTherms(this double? value) => Energy.FromEuTherms(value); + + /// + public static Energy EuTherms(this float value) => Energy.FromEuTherms(value); + + /// + public static Energy? EuTherms(this float? value) => Energy.FromEuTherms(value); + + /// + public static Energy EuTherms(this decimal value) => Energy.FromEuTherms(Convert.ToDouble(value)); + + /// + public static Energy? EuTherms(this decimal? value) => Energy.FromEuTherms(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region FootPound /// @@ -248,6 +384,40 @@ public static class NumberToEnergyExtensions #endregion + #region ImperialTherm + + /// + public static Energy ImperialTherms(this int value) => Energy.FromImperialTherms(value); + + /// + public static Energy? ImperialTherms(this int? value) => Energy.FromImperialTherms(value); + + /// + public static Energy ImperialTherms(this long value) => Energy.FromImperialTherms(value); + + /// + public static Energy? ImperialTherms(this long? value) => Energy.FromImperialTherms(value); + + /// + public static Energy ImperialTherms(this double value) => Energy.FromImperialTherms(value); + + /// + public static Energy? ImperialTherms(this double? value) => Energy.FromImperialTherms(value); + + /// + public static Energy ImperialTherms(this float value) => Energy.FromImperialTherms(value); + + /// + public static Energy? ImperialTherms(this float? value) => Energy.FromImperialTherms(value); + + /// + public static Energy ImperialTherms(this decimal value) => Energy.FromImperialTherms(Convert.ToDouble(value)); + + /// + public static Energy? ImperialTherms(this decimal? value) => Energy.FromImperialTherms(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region Joule /// @@ -452,6 +622,40 @@ public static class NumberToEnergyExtensions #endregion + #region UsTherm + + /// + public static Energy UsTherms(this int value) => Energy.FromUsTherms(value); + + /// + public static Energy? UsTherms(this int? value) => Energy.FromUsTherms(value); + + /// + public static Energy UsTherms(this long value) => Energy.FromUsTherms(value); + + /// + public static Energy? UsTherms(this long? value) => Energy.FromUsTherms(value); + + /// + public static Energy UsTherms(this double value) => Energy.FromUsTherms(value); + + /// + public static Energy? UsTherms(this double? value) => Energy.FromUsTherms(value); + + /// + public static Energy UsTherms(this float value) => Energy.FromUsTherms(value); + + /// + public static Energy? UsTherms(this float? value) => Energy.FromUsTherms(value); + + /// + public static Energy UsTherms(this decimal value) => Energy.FromUsTherms(Convert.ToDouble(value)); + + /// + public static Energy? UsTherms(this decimal? value) => Energy.FromUsTherms(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region WattHour /// diff --git a/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs index bf33bf9e5e..6c584b9377 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs @@ -145,6 +145,30 @@ public double Calories get { return _joules/4.184; } } + /// + /// Get Energy in DecaeuTherms. + /// + public double DecaeuTherms + { + get { return (_joules/1.05506e+8) / 1e1d; } + } + + /// + /// Get Energy in DecaimperialTherms. + /// + public double DecaimperialTherms + { + get { return (_joules/1.05505585257348e+14) / 1e1d; } + } + + /// + /// Get Energy in DecausTherms. + /// + public double DecausTherms + { + get { return (_joules/1.054804e+8) / 1e1d; } + } + /// /// Get Energy in ElectronVolts. /// @@ -161,6 +185,14 @@ public double Ergs get { return _joules/1e-7; } } + /// + /// Get Energy in EuTherms. + /// + public double EuTherms + { + get { return _joules/1.05506e+8; } + } + /// /// Get Energy in FootPounds. /// @@ -177,6 +209,14 @@ public double GigawattHours get { return (_joules/3600d) / 1e9d; } } + /// + /// Get Energy in ImperialTherms. + /// + public double ImperialTherms + { + get { return _joules/1.05505585257348e+14; } + } + /// /// Get Energy in Joules. /// @@ -225,6 +265,14 @@ public double MegawattHours get { return (_joules/3600d) / 1e6d; } } + /// + /// Get Energy in UsTherms. + /// + public double UsTherms + { + get { return _joules/1.054804e+8; } + } + /// /// Get Energy in WattHours. /// @@ -258,6 +306,30 @@ public static Energy FromCalories(double calories) return new Energy(calories*4.184); } + /// + /// Get Energy from DecaeuTherms. + /// + public static Energy FromDecaeuTherms(double decaeutherms) + { + return new Energy((decaeutherms*1.05506e+8) * 1e1d); + } + + /// + /// Get Energy from DecaimperialTherms. + /// + public static Energy FromDecaimperialTherms(double decaimperialtherms) + { + return new Energy((decaimperialtherms*1.05505585257348e+14) * 1e1d); + } + + /// + /// Get Energy from DecausTherms. + /// + public static Energy FromDecausTherms(double decaustherms) + { + return new Energy((decaustherms*1.054804e+8) * 1e1d); + } + /// /// Get Energy from ElectronVolts. /// @@ -274,6 +346,14 @@ public static Energy FromErgs(double ergs) return new Energy(ergs*1e-7); } + /// + /// Get Energy from EuTherms. + /// + public static Energy FromEuTherms(double eutherms) + { + return new Energy(eutherms*1.05506e+8); + } + /// /// Get Energy from FootPounds. /// @@ -290,6 +370,14 @@ public static Energy FromGigawattHours(double gigawatthours) return new Energy((gigawatthours*3600d) * 1e9d); } + /// + /// Get Energy from ImperialTherms. + /// + public static Energy FromImperialTherms(double imperialtherms) + { + return new Energy(imperialtherms*1.05505585257348e+14); + } + /// /// Get Energy from Joules. /// @@ -338,6 +426,14 @@ public static Energy FromMegawattHours(double megawatthours) return new Energy((megawatthours*3600d) * 1e6d); } + /// + /// Get Energy from UsTherms. + /// + public static Energy FromUsTherms(double ustherms) + { + return new Energy(ustherms*1.054804e+8); + } + /// /// Get Energy from WattHours. /// @@ -378,6 +474,51 @@ public static Energy FromWattHours(double watthours) } } + /// + /// Get nullable Energy from nullable DecaeuTherms. + /// + public static Energy? FromDecaeuTherms(double? decaeutherms) + { + if (decaeutherms.HasValue) + { + return FromDecaeuTherms(decaeutherms.Value); + } + else + { + return null; + } + } + + /// + /// Get nullable Energy from nullable DecaimperialTherms. + /// + public static Energy? FromDecaimperialTherms(double? decaimperialtherms) + { + if (decaimperialtherms.HasValue) + { + return FromDecaimperialTherms(decaimperialtherms.Value); + } + else + { + return null; + } + } + + /// + /// Get nullable Energy from nullable DecausTherms. + /// + public static Energy? FromDecausTherms(double? decaustherms) + { + if (decaustherms.HasValue) + { + return FromDecausTherms(decaustherms.Value); + } + else + { + return null; + } + } + /// /// Get nullable Energy from nullable ElectronVolts. /// @@ -408,6 +549,21 @@ public static Energy FromWattHours(double watthours) } } + /// + /// Get nullable Energy from nullable EuTherms. + /// + public static Energy? FromEuTherms(double? eutherms) + { + if (eutherms.HasValue) + { + return FromEuTherms(eutherms.Value); + } + else + { + return null; + } + } + /// /// Get nullable Energy from nullable FootPounds. /// @@ -438,6 +594,21 @@ public static Energy FromWattHours(double watthours) } } + /// + /// Get nullable Energy from nullable ImperialTherms. + /// + public static Energy? FromImperialTherms(double? imperialtherms) + { + if (imperialtherms.HasValue) + { + return FromImperialTherms(imperialtherms.Value); + } + else + { + return null; + } + } + /// /// Get nullable Energy from nullable Joules. /// @@ -528,6 +699,21 @@ public static Energy FromWattHours(double watthours) } } + /// + /// Get nullable Energy from nullable UsTherms. + /// + public static Energy? FromUsTherms(double? ustherms) + { + if (ustherms.HasValue) + { + return FromUsTherms(ustherms.Value); + } + else + { + return null; + } + } + /// /// Get nullable Energy from nullable WattHours. /// @@ -559,14 +745,24 @@ public static Energy From(double val, EnergyUnit fromUnit) return FromBritishThermalUnits(val); case EnergyUnit.Calorie: return FromCalories(val); + case EnergyUnit.DecaeuTherm: + return FromDecaeuTherms(val); + case EnergyUnit.DecaimperialTherm: + return FromDecaimperialTherms(val); + case EnergyUnit.DecausTherm: + return FromDecausTherms(val); case EnergyUnit.ElectronVolt: return FromElectronVolts(val); case EnergyUnit.Erg: return FromErgs(val); + case EnergyUnit.EuTherm: + return FromEuTherms(val); case EnergyUnit.FootPound: return FromFootPounds(val); case EnergyUnit.GigawattHour: return FromGigawattHours(val); + case EnergyUnit.ImperialTherm: + return FromImperialTherms(val); case EnergyUnit.Joule: return FromJoules(val); case EnergyUnit.Kilocalorie: @@ -579,6 +775,8 @@ public static Energy From(double val, EnergyUnit fromUnit) return FromMegajoules(val); case EnergyUnit.MegawattHour: return FromMegawattHours(val); + case EnergyUnit.UsTherm: + return FromUsTherms(val); case EnergyUnit.WattHour: return FromWattHours(val); @@ -607,14 +805,24 @@ public static Energy From(double val, EnergyUnit fromUnit) return FromBritishThermalUnits(value.Value); case EnergyUnit.Calorie: return FromCalories(value.Value); + case EnergyUnit.DecaeuTherm: + return FromDecaeuTherms(value.Value); + case EnergyUnit.DecaimperialTherm: + return FromDecaimperialTherms(value.Value); + case EnergyUnit.DecausTherm: + return FromDecausTherms(value.Value); case EnergyUnit.ElectronVolt: return FromElectronVolts(value.Value); case EnergyUnit.Erg: return FromErgs(value.Value); + case EnergyUnit.EuTherm: + return FromEuTherms(value.Value); case EnergyUnit.FootPound: return FromFootPounds(value.Value); case EnergyUnit.GigawattHour: return FromGigawattHours(value.Value); + case EnergyUnit.ImperialTherm: + return FromImperialTherms(value.Value); case EnergyUnit.Joule: return FromJoules(value.Value); case EnergyUnit.Kilocalorie: @@ -627,6 +835,8 @@ public static Energy From(double val, EnergyUnit fromUnit) return FromMegajoules(value.Value); case EnergyUnit.MegawattHour: return FromMegawattHours(value.Value); + case EnergyUnit.UsTherm: + return FromUsTherms(value.Value); case EnergyUnit.WattHour: return FromWattHours(value.Value); @@ -790,14 +1000,24 @@ public double As(EnergyUnit unit) return BritishThermalUnits; case EnergyUnit.Calorie: return Calories; + case EnergyUnit.DecaeuTherm: + return DecaeuTherms; + case EnergyUnit.DecaimperialTherm: + return DecaimperialTherms; + case EnergyUnit.DecausTherm: + return DecausTherms; case EnergyUnit.ElectronVolt: return ElectronVolts; case EnergyUnit.Erg: return Ergs; + case EnergyUnit.EuTherm: + return EuTherms; case EnergyUnit.FootPound: return FootPounds; case EnergyUnit.GigawattHour: return GigawattHours; + case EnergyUnit.ImperialTherm: + return ImperialTherms; case EnergyUnit.Joule: return Joules; case EnergyUnit.Kilocalorie: @@ -810,6 +1030,8 @@ public double As(EnergyUnit unit) return Megajoules; case EnergyUnit.MegawattHour: return MegawattHours; + case EnergyUnit.UsTherm: + return UsTherms; case EnergyUnit.WattHour: return WattHours; diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index 00043025e3..e1ea8896ce 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -806,6 +806,24 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "cal"), }), + new CulturesForEnumValue((int) EnergyUnit.DecaeuTherm, + new[] + { + new AbbreviationsForCulture("en-US", "dathm (E.U.)"), + new AbbreviationsForCulture("ru-RU", "daЕвропейский терм"), + }), + new CulturesForEnumValue((int) EnergyUnit.DecaimperialTherm, + new[] + { + new AbbreviationsForCulture("en-US", "dathm (imp.)"), + new AbbreviationsForCulture("ru-RU", "daАнглийский терм"), + }), + new CulturesForEnumValue((int) EnergyUnit.DecausTherm, + new[] + { + new AbbreviationsForCulture("en-US", "dathm (U.S.)"), + new AbbreviationsForCulture("ru-RU", "daАмериканский терм"), + }), new CulturesForEnumValue((int) EnergyUnit.ElectronVolt, new[] { @@ -816,6 +834,12 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "erg"), }), + new CulturesForEnumValue((int) EnergyUnit.EuTherm, + new[] + { + new AbbreviationsForCulture("en-US", "thm (E.U.)"), + new AbbreviationsForCulture("ru-RU", "Европейский терм"), + }), new CulturesForEnumValue((int) EnergyUnit.FootPound, new[] { @@ -826,6 +850,12 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "GWh"), }), + new CulturesForEnumValue((int) EnergyUnit.ImperialTherm, + new[] + { + new AbbreviationsForCulture("en-US", "thm (imp.)"), + new AbbreviationsForCulture("ru-RU", "Английский терм"), + }), new CulturesForEnumValue((int) EnergyUnit.Joule, new[] { @@ -856,6 +886,12 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "MWh"), }), + new CulturesForEnumValue((int) EnergyUnit.UsTherm, + new[] + { + new AbbreviationsForCulture("en-US", "thm (U.S.)"), + new AbbreviationsForCulture("ru-RU", "Американский терм"), + }), new CulturesForEnumValue((int) EnergyUnit.WattHour, new[] { From a09f66b570c96266ab90da7a2e95abbe93b318b9 Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Thu, 14 Sep 2017 16:27:20 +0300 Subject: [PATCH 04/19] Some code. formating --- UnitsNet.Tests/CustomCode/EnergyTests.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UnitsNet.Tests/CustomCode/EnergyTests.cs b/UnitsNet.Tests/CustomCode/EnergyTests.cs index 99993dc81d..bca2b8fd94 100644 --- a/UnitsNet.Tests/CustomCode/EnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/EnergyTests.cs @@ -35,13 +35,17 @@ public class EnergyTests : EnergyTestsBase protected override double BritishThermalUnitsInOneJoule => 0.00094781712; protected override double CaloriesInOneJoule => 0.239005736; + protected override double DecaeuThermsInOneJoule => 9.4781339449889105832843629746176e-10; + protected override double DecaimperialThermsInOneJoule => 9.478171203551087813109937767482e-15; + protected override double DecausThermsInOneJoule => 9.4804342797334860315281322406817e-10; protected override double ElectronVoltsInOneJoule => 6.241509343260179e18; protected override double ErgsInOneJoule => 10000000; + protected override double EuThermsInOneJoule => 9.4781339449889105832843629746176e-9; protected override double FootPoundsInOneJoule => 0.737562149; @@ -53,6 +57,7 @@ public class EnergyTests : EnergyTestsBase protected override double KilowattHoursInOneJoule => 2.77777778e-7; protected override double MegawattHoursInOneJoule => 2.77777778e-10; + protected override double UsThermsInOneJoule => 9.4804342797334860315281322406817e-9; protected override double WattHoursInOneJoule => 0.000277777778; From 38f7f766f6e91062201693ceab4aafd3affb7cb0 Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Thu, 14 Sep 2017 19:09:34 +0300 Subject: [PATCH 05/19] Add nex prefixes and a few addreviations for russian culture. --- UnitsNet/UnitDefinitions/Energy.json | 5 +++++ UnitsNet/UnitDefinitions/Mass.json | 5 +++++ UnitsNet/UnitDefinitions/Volume.json | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/UnitsNet/UnitDefinitions/Energy.json b/UnitsNet/UnitDefinitions/Energy.json index fde3651c79..54a545cc39 100644 --- a/UnitsNet/UnitDefinitions/Energy.json +++ b/UnitsNet/UnitDefinitions/Energy.json @@ -34,6 +34,7 @@ "PluralName": "BritishThermalUnits", "FromUnitToBaseFunc": "x*1055.05585262", "FromBaseToUnitFunc": "x/1055.05585262", + "Prefixes": [ "Kilo", "Mega" ], "Localization": [ { "Culture": "en-US", @@ -87,6 +88,10 @@ { "Culture": "en-US", "Abbreviations": [ "Wh" ] + }, + { + "Culture": "en-US", + "Abbreviations": [ "Вт/ч" ] } ] }, diff --git a/UnitsNet/UnitDefinitions/Mass.json b/UnitsNet/UnitDefinitions/Mass.json index 9daea7a5f7..7658ea80b9 100644 --- a/UnitsNet/UnitDefinitions/Mass.json +++ b/UnitsNet/UnitDefinitions/Mass.json @@ -81,10 +81,15 @@ "FromUnitToBaseFunc": "x*0.45359237", "FromBaseToUnitFunc": "x/0.45359237", "XmlDocSummary": "The pound or pound-mass (abbreviations: lb, lbm) is a unit of mass used in the imperial, United States customary and other systems of measurement. A number of different definitions have been used, the most common today being the international avoirdupois pound which is legally defined as exactly 0.45359237 kilograms, and which is divided into 16 avoirdupois ounces.", + "Prefixes": [ "Kilo", "Mega" ], "Localization": [ { "Culture": "en-US", "Abbreviations": [ "lb" ] + }, + { + "Culture": "ru-RU", + "Abbreviations": [ "фунт" ] } ] }, diff --git a/UnitsNet/UnitDefinitions/Volume.json b/UnitsNet/UnitDefinitions/Volume.json index cefac4f5d2..1947b49f29 100644 --- a/UnitsNet/UnitDefinitions/Volume.json +++ b/UnitsNet/UnitDefinitions/Volume.json @@ -26,6 +26,7 @@ "PluralName": "CubicMeters", "FromUnitToBaseFunc": "x", "FromBaseToUnitFunc": "x", + "Prefixes": [ "Micro", "Milli", "Centi", "Deci", "Hecto", "Kilo" ], "Localization": [ { "Culture": "en-US", @@ -154,6 +155,7 @@ "PluralName": "CubicFeet", "FromUnitToBaseFunc": "x*0.0283168", "FromBaseToUnitFunc": "x/0.0283168", + "Prefixes": [ "Hecto", "Kilo", "Mega" ], "Localization": [ { "Culture": "en-US", @@ -186,6 +188,7 @@ "PluralName": "ImperialGallons", "FromUnitToBaseFunc": "x*0.00454609000000181429905810072407", "FromBaseToUnitFunc": "x/0.00454609000000181429905810072407", + "Prefixes": [ "Kilo", "Mega" ], "Localization": [ { "Culture": "en-US", @@ -218,6 +221,7 @@ "PluralName": "UsGallons", "FromUnitToBaseFunc": "x*0.00378541", "FromBaseToUnitFunc": "x/0.00378541", + "Prefixes": [ "Kilo", "Mega" ], "Localization": [ { "Culture": "en-US", From 5aa94721e3fdd1d8bbd29a522dd50f5e7ff47052 Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Fri, 15 Sep 2017 18:28:45 +0300 Subject: [PATCH 06/19] Add test and some prefixes abbreviations for pound. Misplaced code removed --- UnitsNet.Tests/CustomCode/EnergyTests.cs | 4 + UnitsNet.Tests/CustomCode/MassTests.cs | 4 + UnitsNet.Tests/CustomCode/VolumeTests.cs | 10 + .../GeneratedCode/EnergyTestsBase.g.cs | 12 + .../GeneratedCode/MassTestsBase.g.cs | 12 + .../GeneratedCode/VolumeTestsBase.g.cs | 54 +++ UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs | 2 + UnitsNet/GeneratedCode/Enums/MassUnit.g.cs | 2 + UnitsNet/GeneratedCode/Enums/VolumeUnit.g.cs | 9 + .../Number/NumberToEnergyExtensions.g.cs | 68 ++++ .../Number/NumberToMassExtensions.g.cs | 68 ++++ .../Number/NumberToVolumeExtensions.g.cs | 306 ++++++++++++++++ .../GeneratedCode/UnitClasses/Energy.g.cs | 74 ++++ UnitsNet/GeneratedCode/UnitClasses/Mass.g.cs | 74 ++++ .../GeneratedCode/UnitClasses/Volume.g.cs | 333 ++++++++++++++++++ .../GeneratedCode/UnitSystem.Default.g.cs | 81 +++++ UnitsNet/UnitDefinitions/Mass.json | 3 +- UnitsNet/UnitDefinitions/Volume.json | 2 +- 18 files changed, 1116 insertions(+), 2 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/EnergyTests.cs b/UnitsNet.Tests/CustomCode/EnergyTests.cs index bca2b8fd94..5c7c4b717e 100644 --- a/UnitsNet.Tests/CustomCode/EnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/EnergyTests.cs @@ -28,8 +28,12 @@ public class EnergyTests : EnergyTestsBase protected override double JoulesInOneJoule => 1; + protected override double KilobritishThermalUnitsInOneJoule => 9.4781339449889105832843629746176e-7; + protected override double KilojoulesInOneJoule => 1E-3; + protected override double MegabritishThermalUnitsInOneJoule => 9.4781339449889105832843629746176e-10; + protected override double MegajoulesInOneJoule => 1E-6; protected override double BritishThermalUnitsInOneJoule => 0.00094781712; diff --git a/UnitsNet.Tests/CustomCode/MassTests.cs b/UnitsNet.Tests/CustomCode/MassTests.cs index c022124d3a..e693ed2944 100644 --- a/UnitsNet.Tests/CustomCode/MassTests.cs +++ b/UnitsNet.Tests/CustomCode/MassTests.cs @@ -38,10 +38,14 @@ public class MassTests : MassTestsBase protected override double KilogramsInOneKilogram => 1; + protected override double KilopoundsInOneKilogram => 2.2046226218487757e-3; + protected override double KilotonnesInOneKilogram => 1E-6; protected override double LongTonsInOneKilogram => 0.000984207; + protected override double MegapoundsInOneKilogram => 2.2046226218487757e-6; + protected override double MegatonnesInOneKilogram => 1E-6; protected override double MicrogramsInOneKilogram => 1E9; diff --git a/UnitsNet.Tests/CustomCode/VolumeTests.cs b/UnitsNet.Tests/CustomCode/VolumeTests.cs index 56feb9c4a0..326b26915c 100644 --- a/UnitsNet.Tests/CustomCode/VolumeTests.cs +++ b/UnitsNet.Tests/CustomCode/VolumeTests.cs @@ -48,6 +48,8 @@ public class VolumeTests : VolumeTestsBase protected override double CubicYardsInOneCubicMeter => 1.30795062; protected override double DecilitersInOneCubicMeter => 1E4; + protected override double HectocubicFeetInOneCubicMeter => 3.531472e-1; + protected override double HectocubicMetersInOneCubicMeter => 0.01; protected override double HectolitersInOneCubicMeter => 1E1; @@ -55,7 +57,15 @@ public class VolumeTests : VolumeTestsBase protected override double ImperialOuncesInOneCubicMeter => 35195.07972; + protected override double KilocubicFeetInOneCubicMeter => 3.531472e-2; + protected override double KilocubicMetersInOneCubicMeter => 0.001; + protected override double KiloimperialGallonsInOneCubicMeter => 2.1996924e-1; + protected override double KilousGallonsInOneCubicMeter => 2.6417217e-1; + protected override double LitersInOneCubicMeter => 1E3; + protected override double MegacubicFeetInOneCubicMeter => 3.531472e-5; + protected override double MegaimperialGallonsInOneCubicMeter => 2.1996924e-4; + protected override double MegausGallonsInOneCubicMeter => 2.6417217e-4; protected override double MicrolitersInOneCubicMeter => 1E9; diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index ec5c3492b9..ee811e235f 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -64,9 +64,11 @@ public abstract partial class EnergyTestsBase protected abstract double GigawattHoursInOneJoule { get; } protected abstract double ImperialThermsInOneJoule { get; } protected abstract double JoulesInOneJoule { get; } + protected abstract double KilobritishThermalUnitsInOneJoule { get; } protected abstract double KilocaloriesInOneJoule { get; } protected abstract double KilojoulesInOneJoule { get; } protected abstract double KilowattHoursInOneJoule { get; } + protected abstract double MegabritishThermalUnitsInOneJoule { get; } protected abstract double MegajoulesInOneJoule { get; } protected abstract double MegawattHoursInOneJoule { get; } protected abstract double UsThermsInOneJoule { get; } @@ -85,9 +87,11 @@ public abstract partial class EnergyTestsBase protected virtual double GigawattHoursTolerance { get { return 1e-5; } } protected virtual double ImperialThermsTolerance { get { return 1e-5; } } protected virtual double JoulesTolerance { get { return 1e-5; } } + protected virtual double KilobritishThermalUnitsTolerance { get { return 1e-5; } } protected virtual double KilocaloriesTolerance { get { return 1e-5; } } protected virtual double KilojoulesTolerance { get { return 1e-5; } } protected virtual double KilowattHoursTolerance { get { return 1e-5; } } + protected virtual double MegabritishThermalUnitsTolerance { get { return 1e-5; } } protected virtual double MegajoulesTolerance { get { return 1e-5; } } protected virtual double MegawattHoursTolerance { get { return 1e-5; } } protected virtual double UsThermsTolerance { get { return 1e-5; } } @@ -110,9 +114,11 @@ public void JouleToEnergyUnits() AssertEx.EqualTolerance(GigawattHoursInOneJoule, joule.GigawattHours, GigawattHoursTolerance); AssertEx.EqualTolerance(ImperialThermsInOneJoule, joule.ImperialTherms, ImperialThermsTolerance); AssertEx.EqualTolerance(JoulesInOneJoule, joule.Joules, JoulesTolerance); + AssertEx.EqualTolerance(KilobritishThermalUnitsInOneJoule, joule.KilobritishThermalUnits, KilobritishThermalUnitsTolerance); AssertEx.EqualTolerance(KilocaloriesInOneJoule, joule.Kilocalories, KilocaloriesTolerance); AssertEx.EqualTolerance(KilojoulesInOneJoule, joule.Kilojoules, KilojoulesTolerance); AssertEx.EqualTolerance(KilowattHoursInOneJoule, joule.KilowattHours, KilowattHoursTolerance); + AssertEx.EqualTolerance(MegabritishThermalUnitsInOneJoule, joule.MegabritishThermalUnits, MegabritishThermalUnitsTolerance); AssertEx.EqualTolerance(MegajoulesInOneJoule, joule.Megajoules, MegajoulesTolerance); AssertEx.EqualTolerance(MegawattHoursInOneJoule, joule.MegawattHours, MegawattHoursTolerance); AssertEx.EqualTolerance(UsThermsInOneJoule, joule.UsTherms, UsThermsTolerance); @@ -134,9 +140,11 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.GigawattHour).GigawattHours, GigawattHoursTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ImperialTherm).ImperialTherms, ImperialThermsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Joule).Joules, JoulesTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.KilobritishThermalUnit).KilobritishThermalUnits, KilobritishThermalUnitsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Kilocalorie).Kilocalories, KilocaloriesTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Kilojoule).Kilojoules, KilojoulesTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.KilowattHour).KilowattHours, KilowattHoursTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.MegabritishThermalUnit).MegabritishThermalUnits, MegabritishThermalUnitsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Megajoule).Megajoules, MegajoulesTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.MegawattHour).MegawattHours, MegawattHoursTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.UsTherm).UsTherms, UsThermsTolerance); @@ -159,9 +167,11 @@ public void As() AssertEx.EqualTolerance(GigawattHoursInOneJoule, joule.As(EnergyUnit.GigawattHour), GigawattHoursTolerance); AssertEx.EqualTolerance(ImperialThermsInOneJoule, joule.As(EnergyUnit.ImperialTherm), ImperialThermsTolerance); AssertEx.EqualTolerance(JoulesInOneJoule, joule.As(EnergyUnit.Joule), JoulesTolerance); + AssertEx.EqualTolerance(KilobritishThermalUnitsInOneJoule, joule.As(EnergyUnit.KilobritishThermalUnit), KilobritishThermalUnitsTolerance); AssertEx.EqualTolerance(KilocaloriesInOneJoule, joule.As(EnergyUnit.Kilocalorie), KilocaloriesTolerance); AssertEx.EqualTolerance(KilojoulesInOneJoule, joule.As(EnergyUnit.Kilojoule), KilojoulesTolerance); AssertEx.EqualTolerance(KilowattHoursInOneJoule, joule.As(EnergyUnit.KilowattHour), KilowattHoursTolerance); + AssertEx.EqualTolerance(MegabritishThermalUnitsInOneJoule, joule.As(EnergyUnit.MegabritishThermalUnit), MegabritishThermalUnitsTolerance); AssertEx.EqualTolerance(MegajoulesInOneJoule, joule.As(EnergyUnit.Megajoule), MegajoulesTolerance); AssertEx.EqualTolerance(MegawattHoursInOneJoule, joule.As(EnergyUnit.MegawattHour), MegawattHoursTolerance); AssertEx.EqualTolerance(UsThermsInOneJoule, joule.As(EnergyUnit.UsTherm), UsThermsTolerance); @@ -184,9 +194,11 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Energy.FromGigawattHours(joule.GigawattHours).Joules, GigawattHoursTolerance); AssertEx.EqualTolerance(1, Energy.FromImperialTherms(joule.ImperialTherms).Joules, ImperialThermsTolerance); 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.FromUsTherms(joule.UsTherms).Joules, UsThermsTolerance); diff --git a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs index 6c5c65d8f5..70ad1de3c7 100644 --- a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs @@ -58,9 +58,11 @@ public abstract partial class MassTestsBase protected abstract double GramsInOneKilogram { get; } protected abstract double HectogramsInOneKilogram { get; } protected abstract double KilogramsInOneKilogram { get; } + protected abstract double KilopoundsInOneKilogram { get; } protected abstract double KilotonnesInOneKilogram { get; } protected abstract double LongHundredweightInOneKilogram { get; } protected abstract double LongTonsInOneKilogram { get; } + protected abstract double MegapoundsInOneKilogram { get; } protected abstract double MegatonnesInOneKilogram { get; } protected abstract double MicrogramsInOneKilogram { get; } protected abstract double MilligramsInOneKilogram { get; } @@ -79,9 +81,11 @@ public abstract partial class MassTestsBase protected virtual double GramsTolerance { get { return 1e-5; } } protected virtual double HectogramsTolerance { get { return 1e-5; } } protected virtual double KilogramsTolerance { get { return 1e-5; } } + protected virtual double KilopoundsTolerance { get { return 1e-5; } } protected virtual double KilotonnesTolerance { get { return 1e-5; } } protected virtual double LongHundredweightTolerance { get { return 1e-5; } } protected virtual double LongTonsTolerance { get { return 1e-5; } } + protected virtual double MegapoundsTolerance { get { return 1e-5; } } protected virtual double MegatonnesTolerance { get { return 1e-5; } } protected virtual double MicrogramsTolerance { get { return 1e-5; } } protected virtual double MilligramsTolerance { get { return 1e-5; } } @@ -104,9 +108,11 @@ public void KilogramToMassUnits() AssertEx.EqualTolerance(GramsInOneKilogram, kilogram.Grams, GramsTolerance); AssertEx.EqualTolerance(HectogramsInOneKilogram, kilogram.Hectograms, HectogramsTolerance); AssertEx.EqualTolerance(KilogramsInOneKilogram, kilogram.Kilograms, KilogramsTolerance); + AssertEx.EqualTolerance(KilopoundsInOneKilogram, kilogram.Kilopounds, KilopoundsTolerance); AssertEx.EqualTolerance(KilotonnesInOneKilogram, kilogram.Kilotonnes, KilotonnesTolerance); AssertEx.EqualTolerance(LongHundredweightInOneKilogram, kilogram.LongHundredweight, LongHundredweightTolerance); AssertEx.EqualTolerance(LongTonsInOneKilogram, kilogram.LongTons, LongTonsTolerance); + AssertEx.EqualTolerance(MegapoundsInOneKilogram, kilogram.Megapounds, MegapoundsTolerance); AssertEx.EqualTolerance(MegatonnesInOneKilogram, kilogram.Megatonnes, MegatonnesTolerance); AssertEx.EqualTolerance(MicrogramsInOneKilogram, kilogram.Micrograms, MicrogramsTolerance); AssertEx.EqualTolerance(MilligramsInOneKilogram, kilogram.Milligrams, MilligramsTolerance); @@ -128,9 +134,11 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Gram).Grams, GramsTolerance); AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Hectogram).Hectograms, HectogramsTolerance); AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Kilogram).Kilograms, KilogramsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Kilopound).Kilopounds, KilopoundsTolerance); AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Kilotonne).Kilotonnes, KilotonnesTolerance); AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.LongHundredweight).LongHundredweight, LongHundredweightTolerance); AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.LongTon).LongTons, LongTonsTolerance); + AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Megapound).Megapounds, MegapoundsTolerance); AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Megatonne).Megatonnes, MegatonnesTolerance); AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Microgram).Micrograms, MicrogramsTolerance); AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Milligram).Milligrams, MilligramsTolerance); @@ -153,9 +161,11 @@ public void As() AssertEx.EqualTolerance(GramsInOneKilogram, kilogram.As(MassUnit.Gram), GramsTolerance); AssertEx.EqualTolerance(HectogramsInOneKilogram, kilogram.As(MassUnit.Hectogram), HectogramsTolerance); AssertEx.EqualTolerance(KilogramsInOneKilogram, kilogram.As(MassUnit.Kilogram), KilogramsTolerance); + AssertEx.EqualTolerance(KilopoundsInOneKilogram, kilogram.As(MassUnit.Kilopound), KilopoundsTolerance); AssertEx.EqualTolerance(KilotonnesInOneKilogram, kilogram.As(MassUnit.Kilotonne), KilotonnesTolerance); AssertEx.EqualTolerance(LongHundredweightInOneKilogram, kilogram.As(MassUnit.LongHundredweight), LongHundredweightTolerance); AssertEx.EqualTolerance(LongTonsInOneKilogram, kilogram.As(MassUnit.LongTon), LongTonsTolerance); + AssertEx.EqualTolerance(MegapoundsInOneKilogram, kilogram.As(MassUnit.Megapound), MegapoundsTolerance); AssertEx.EqualTolerance(MegatonnesInOneKilogram, kilogram.As(MassUnit.Megatonne), MegatonnesTolerance); AssertEx.EqualTolerance(MicrogramsInOneKilogram, kilogram.As(MassUnit.Microgram), MicrogramsTolerance); AssertEx.EqualTolerance(MilligramsInOneKilogram, kilogram.As(MassUnit.Milligram), MilligramsTolerance); @@ -178,9 +188,11 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Mass.FromGrams(kilogram.Grams).Kilograms, GramsTolerance); AssertEx.EqualTolerance(1, Mass.FromHectograms(kilogram.Hectograms).Kilograms, HectogramsTolerance); AssertEx.EqualTolerance(1, Mass.FromKilograms(kilogram.Kilograms).Kilograms, KilogramsTolerance); + AssertEx.EqualTolerance(1, Mass.FromKilopounds(kilogram.Kilopounds).Kilograms, KilopoundsTolerance); AssertEx.EqualTolerance(1, Mass.FromKilotonnes(kilogram.Kilotonnes).Kilograms, KilotonnesTolerance); AssertEx.EqualTolerance(1, Mass.FromLongHundredweight(kilogram.LongHundredweight).Kilograms, LongHundredweightTolerance); AssertEx.EqualTolerance(1, Mass.FromLongTons(kilogram.LongTons).Kilograms, LongTonsTolerance); + AssertEx.EqualTolerance(1, Mass.FromMegapounds(kilogram.Megapounds).Kilograms, MegapoundsTolerance); AssertEx.EqualTolerance(1, Mass.FromMegatonnes(kilogram.Megatonnes).Kilograms, MegatonnesTolerance); AssertEx.EqualTolerance(1, Mass.FromMicrograms(kilogram.Micrograms).Kilograms, MicrogramsTolerance); AssertEx.EqualTolerance(1, Mass.FromMilligrams(kilogram.Milligrams).Kilograms, MilligramsTolerance); diff --git a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs index 6717c21abe..e8faf7f47b 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs @@ -65,10 +65,19 @@ public abstract partial class VolumeTestsBase protected abstract double CubicMillimetersInOneCubicMeter { get; } protected abstract double CubicYardsInOneCubicMeter { get; } protected abstract double DecilitersInOneCubicMeter { get; } + protected abstract double HectocubicFeetInOneCubicMeter { get; } + protected abstract double HectocubicMetersInOneCubicMeter { get; } protected abstract double HectolitersInOneCubicMeter { get; } protected abstract double ImperialGallonsInOneCubicMeter { get; } protected abstract double ImperialOuncesInOneCubicMeter { get; } + protected abstract double KilocubicFeetInOneCubicMeter { get; } + protected abstract double KilocubicMetersInOneCubicMeter { get; } + protected abstract double KiloimperialGallonsInOneCubicMeter { get; } + protected abstract double KilousGallonsInOneCubicMeter { get; } protected abstract double LitersInOneCubicMeter { get; } + protected abstract double MegacubicFeetInOneCubicMeter { get; } + protected abstract double MegaimperialGallonsInOneCubicMeter { get; } + protected abstract double MegausGallonsInOneCubicMeter { get; } protected abstract double MetricCupsInOneCubicMeter { get; } protected abstract double MetricTeaspoonsInOneCubicMeter { get; } protected abstract double MicrolitersInOneCubicMeter { get; } @@ -98,10 +107,19 @@ public abstract partial class VolumeTestsBase protected virtual double CubicMillimetersTolerance { get { return 1e-5; } } protected virtual double CubicYardsTolerance { get { return 1e-5; } } protected virtual double DecilitersTolerance { get { return 1e-5; } } + protected virtual double HectocubicFeetTolerance { get { return 1e-5; } } + protected virtual double HectocubicMetersTolerance { get { return 1e-5; } } protected virtual double HectolitersTolerance { get { return 1e-5; } } protected virtual double ImperialGallonsTolerance { get { return 1e-5; } } protected virtual double ImperialOuncesTolerance { get { return 1e-5; } } + protected virtual double KilocubicFeetTolerance { get { return 1e-5; } } + protected virtual double KilocubicMetersTolerance { get { return 1e-5; } } + protected virtual double KiloimperialGallonsTolerance { get { return 1e-5; } } + protected virtual double KilousGallonsTolerance { get { return 1e-5; } } protected virtual double LitersTolerance { get { return 1e-5; } } + protected virtual double MegacubicFeetTolerance { get { return 1e-5; } } + protected virtual double MegaimperialGallonsTolerance { get { return 1e-5; } } + protected virtual double MegausGallonsTolerance { get { return 1e-5; } } protected virtual double MetricCupsTolerance { get { return 1e-5; } } protected virtual double MetricTeaspoonsTolerance { get { return 1e-5; } } protected virtual double MicrolitersTolerance { get { return 1e-5; } } @@ -135,10 +153,19 @@ public void CubicMeterToVolumeUnits() AssertEx.EqualTolerance(CubicMillimetersInOneCubicMeter, cubicmeter.CubicMillimeters, CubicMillimetersTolerance); AssertEx.EqualTolerance(CubicYardsInOneCubicMeter, cubicmeter.CubicYards, CubicYardsTolerance); AssertEx.EqualTolerance(DecilitersInOneCubicMeter, cubicmeter.Deciliters, DecilitersTolerance); + AssertEx.EqualTolerance(HectocubicFeetInOneCubicMeter, cubicmeter.HectocubicFeet, HectocubicFeetTolerance); + AssertEx.EqualTolerance(HectocubicMetersInOneCubicMeter, cubicmeter.HectocubicMeters, HectocubicMetersTolerance); AssertEx.EqualTolerance(HectolitersInOneCubicMeter, cubicmeter.Hectoliters, HectolitersTolerance); AssertEx.EqualTolerance(ImperialGallonsInOneCubicMeter, cubicmeter.ImperialGallons, ImperialGallonsTolerance); AssertEx.EqualTolerance(ImperialOuncesInOneCubicMeter, cubicmeter.ImperialOunces, ImperialOuncesTolerance); + AssertEx.EqualTolerance(KilocubicFeetInOneCubicMeter, cubicmeter.KilocubicFeet, KilocubicFeetTolerance); + AssertEx.EqualTolerance(KilocubicMetersInOneCubicMeter, cubicmeter.KilocubicMeters, KilocubicMetersTolerance); + AssertEx.EqualTolerance(KiloimperialGallonsInOneCubicMeter, cubicmeter.KiloimperialGallons, KiloimperialGallonsTolerance); + AssertEx.EqualTolerance(KilousGallonsInOneCubicMeter, cubicmeter.KilousGallons, KilousGallonsTolerance); AssertEx.EqualTolerance(LitersInOneCubicMeter, cubicmeter.Liters, LitersTolerance); + AssertEx.EqualTolerance(MegacubicFeetInOneCubicMeter, cubicmeter.MegacubicFeet, MegacubicFeetTolerance); + AssertEx.EqualTolerance(MegaimperialGallonsInOneCubicMeter, cubicmeter.MegaimperialGallons, MegaimperialGallonsTolerance); + AssertEx.EqualTolerance(MegausGallonsInOneCubicMeter, cubicmeter.MegausGallons, MegausGallonsTolerance); AssertEx.EqualTolerance(MetricCupsInOneCubicMeter, cubicmeter.MetricCups, MetricCupsTolerance); AssertEx.EqualTolerance(MetricTeaspoonsInOneCubicMeter, cubicmeter.MetricTeaspoons, MetricTeaspoonsTolerance); AssertEx.EqualTolerance(MicrolitersInOneCubicMeter, cubicmeter.Microliters, MicrolitersTolerance); @@ -171,10 +198,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMillimeter).CubicMillimeters, CubicMillimetersTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicYard).CubicYards, CubicYardsTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Deciliter).Deciliters, DecilitersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.HectocubicFoot).HectocubicFeet, HectocubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.HectocubicMeter).HectocubicMeters, HectocubicMetersTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Hectoliter).Hectoliters, HectolitersTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialGallon).ImperialGallons, ImperialGallonsTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialOunce).ImperialOunces, ImperialOuncesTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KilocubicFoot).KilocubicFeet, KilocubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KilocubicMeter).KilocubicMeters, KilocubicMetersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KiloimperialGallon).KiloimperialGallons, KiloimperialGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KilousGallon).KilousGallons, KilousGallonsTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Liter).Liters, LitersTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MegacubicFoot).MegacubicFeet, MegacubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MegaimperialGallon).MegaimperialGallons, MegaimperialGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MegausGallon).MegausGallons, MegausGallonsTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MetricCup).MetricCups, MetricCupsTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MetricTeaspoon).MetricTeaspoons, MetricTeaspoonsTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Microliter).Microliters, MicrolitersTolerance); @@ -208,10 +244,19 @@ public void As() AssertEx.EqualTolerance(CubicMillimetersInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicMillimeter), CubicMillimetersTolerance); AssertEx.EqualTolerance(CubicYardsInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicYard), CubicYardsTolerance); AssertEx.EqualTolerance(DecilitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Deciliter), DecilitersTolerance); + AssertEx.EqualTolerance(HectocubicFeetInOneCubicMeter, cubicmeter.As(VolumeUnit.HectocubicFoot), HectocubicFeetTolerance); + AssertEx.EqualTolerance(HectocubicMetersInOneCubicMeter, cubicmeter.As(VolumeUnit.HectocubicMeter), HectocubicMetersTolerance); AssertEx.EqualTolerance(HectolitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Hectoliter), HectolitersTolerance); AssertEx.EqualTolerance(ImperialGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.ImperialGallon), ImperialGallonsTolerance); AssertEx.EqualTolerance(ImperialOuncesInOneCubicMeter, cubicmeter.As(VolumeUnit.ImperialOunce), ImperialOuncesTolerance); + AssertEx.EqualTolerance(KilocubicFeetInOneCubicMeter, cubicmeter.As(VolumeUnit.KilocubicFoot), KilocubicFeetTolerance); + AssertEx.EqualTolerance(KilocubicMetersInOneCubicMeter, cubicmeter.As(VolumeUnit.KilocubicMeter), KilocubicMetersTolerance); + AssertEx.EqualTolerance(KiloimperialGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.KiloimperialGallon), KiloimperialGallonsTolerance); + AssertEx.EqualTolerance(KilousGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.KilousGallon), KilousGallonsTolerance); AssertEx.EqualTolerance(LitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Liter), LitersTolerance); + AssertEx.EqualTolerance(MegacubicFeetInOneCubicMeter, cubicmeter.As(VolumeUnit.MegacubicFoot), MegacubicFeetTolerance); + AssertEx.EqualTolerance(MegaimperialGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.MegaimperialGallon), MegaimperialGallonsTolerance); + AssertEx.EqualTolerance(MegausGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.MegausGallon), MegausGallonsTolerance); AssertEx.EqualTolerance(MetricCupsInOneCubicMeter, cubicmeter.As(VolumeUnit.MetricCup), MetricCupsTolerance); AssertEx.EqualTolerance(MetricTeaspoonsInOneCubicMeter, cubicmeter.As(VolumeUnit.MetricTeaspoon), MetricTeaspoonsTolerance); AssertEx.EqualTolerance(MicrolitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Microliter), MicrolitersTolerance); @@ -245,10 +290,19 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Volume.FromCubicMillimeters(cubicmeter.CubicMillimeters).CubicMeters, CubicMillimetersTolerance); AssertEx.EqualTolerance(1, Volume.FromCubicYards(cubicmeter.CubicYards).CubicMeters, CubicYardsTolerance); AssertEx.EqualTolerance(1, Volume.FromDeciliters(cubicmeter.Deciliters).CubicMeters, DecilitersTolerance); + AssertEx.EqualTolerance(1, Volume.FromHectocubicFeet(cubicmeter.HectocubicFeet).CubicMeters, HectocubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.FromHectocubicMeters(cubicmeter.HectocubicMeters).CubicMeters, HectocubicMetersTolerance); AssertEx.EqualTolerance(1, Volume.FromHectoliters(cubicmeter.Hectoliters).CubicMeters, HectolitersTolerance); AssertEx.EqualTolerance(1, Volume.FromImperialGallons(cubicmeter.ImperialGallons).CubicMeters, ImperialGallonsTolerance); AssertEx.EqualTolerance(1, Volume.FromImperialOunces(cubicmeter.ImperialOunces).CubicMeters, ImperialOuncesTolerance); + AssertEx.EqualTolerance(1, Volume.FromKilocubicFeet(cubicmeter.KilocubicFeet).CubicMeters, KilocubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.FromKilocubicMeters(cubicmeter.KilocubicMeters).CubicMeters, KilocubicMetersTolerance); + AssertEx.EqualTolerance(1, Volume.FromKiloimperialGallons(cubicmeter.KiloimperialGallons).CubicMeters, KiloimperialGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.FromKilousGallons(cubicmeter.KilousGallons).CubicMeters, KilousGallonsTolerance); AssertEx.EqualTolerance(1, Volume.FromLiters(cubicmeter.Liters).CubicMeters, LitersTolerance); + AssertEx.EqualTolerance(1, Volume.FromMegacubicFeet(cubicmeter.MegacubicFeet).CubicMeters, MegacubicFeetTolerance); + AssertEx.EqualTolerance(1, Volume.FromMegaimperialGallons(cubicmeter.MegaimperialGallons).CubicMeters, MegaimperialGallonsTolerance); + AssertEx.EqualTolerance(1, Volume.FromMegausGallons(cubicmeter.MegausGallons).CubicMeters, MegausGallonsTolerance); AssertEx.EqualTolerance(1, Volume.FromMetricCups(cubicmeter.MetricCups).CubicMeters, MetricCupsTolerance); AssertEx.EqualTolerance(1, Volume.FromMetricTeaspoons(cubicmeter.MetricTeaspoons).CubicMeters, MetricTeaspoonsTolerance); AssertEx.EqualTolerance(1, Volume.FromMicroliters(cubicmeter.Microliters).CubicMeters, MicrolitersTolerance); diff --git a/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs b/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs index de9fccc541..2d7258472c 100644 --- a/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs @@ -54,9 +54,11 @@ public enum EnergyUnit GigawattHour, ImperialTherm, Joule, + KilobritishThermalUnit, Kilocalorie, Kilojoule, KilowattHour, + MegabritishThermalUnit, Megajoule, MegawattHour, UsTherm, diff --git a/UnitsNet/GeneratedCode/Enums/MassUnit.g.cs b/UnitsNet/GeneratedCode/Enums/MassUnit.g.cs index abe1230f68..fa97d7fa26 100644 --- a/UnitsNet/GeneratedCode/Enums/MassUnit.g.cs +++ b/UnitsNet/GeneratedCode/Enums/MassUnit.g.cs @@ -48,6 +48,7 @@ public enum MassUnit Gram, Hectogram, Kilogram, + Kilopound, Kilotonne, /// @@ -61,6 +62,7 @@ public enum MassUnit /// /// http://en.wikipedia.org/wiki/Long_ton LongTon, + Megapound, Megatonne, Microgram, Milligram, diff --git a/UnitsNet/GeneratedCode/Enums/VolumeUnit.g.cs b/UnitsNet/GeneratedCode/Enums/VolumeUnit.g.cs index 1e639c4159..ad52dc8482 100644 --- a/UnitsNet/GeneratedCode/Enums/VolumeUnit.g.cs +++ b/UnitsNet/GeneratedCode/Enums/VolumeUnit.g.cs @@ -55,10 +55,19 @@ public enum VolumeUnit CubicMillimeter, CubicYard, Deciliter, + HectocubicFoot, + HectocubicMeter, Hectoliter, ImperialGallon, ImperialOunce, + KilocubicFoot, + KilocubicMeter, + KiloimperialGallon, + KilousGallon, Liter, + MegacubicFoot, + MegaimperialGallon, + MegausGallon, MetricCup, MetricTeaspoon, Microliter, diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs index df5661bed9..c28dc46965 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs @@ -452,6 +452,40 @@ public static class NumberToEnergyExtensions #endregion + #region KilobritishThermalUnit + + /// + public static Energy KilobritishThermalUnits(this int value) => Energy.FromKilobritishThermalUnits(value); + + /// + public static Energy? KilobritishThermalUnits(this int? value) => Energy.FromKilobritishThermalUnits(value); + + /// + public static Energy KilobritishThermalUnits(this long value) => Energy.FromKilobritishThermalUnits(value); + + /// + public static Energy? KilobritishThermalUnits(this long? value) => Energy.FromKilobritishThermalUnits(value); + + /// + public static Energy KilobritishThermalUnits(this double value) => Energy.FromKilobritishThermalUnits(value); + + /// + public static Energy? KilobritishThermalUnits(this double? value) => Energy.FromKilobritishThermalUnits(value); + + /// + public static Energy KilobritishThermalUnits(this float value) => Energy.FromKilobritishThermalUnits(value); + + /// + public static Energy? KilobritishThermalUnits(this float? value) => Energy.FromKilobritishThermalUnits(value); + + /// + public static Energy KilobritishThermalUnits(this decimal value) => Energy.FromKilobritishThermalUnits(Convert.ToDouble(value)); + + /// + public static Energy? KilobritishThermalUnits(this decimal? value) => Energy.FromKilobritishThermalUnits(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region Kilocalorie /// @@ -554,6 +588,40 @@ public static class NumberToEnergyExtensions #endregion + #region MegabritishThermalUnit + + /// + public static Energy MegabritishThermalUnits(this int value) => Energy.FromMegabritishThermalUnits(value); + + /// + public static Energy? MegabritishThermalUnits(this int? value) => Energy.FromMegabritishThermalUnits(value); + + /// + public static Energy MegabritishThermalUnits(this long value) => Energy.FromMegabritishThermalUnits(value); + + /// + public static Energy? MegabritishThermalUnits(this long? value) => Energy.FromMegabritishThermalUnits(value); + + /// + public static Energy MegabritishThermalUnits(this double value) => Energy.FromMegabritishThermalUnits(value); + + /// + public static Energy? MegabritishThermalUnits(this double? value) => Energy.FromMegabritishThermalUnits(value); + + /// + public static Energy MegabritishThermalUnits(this float value) => Energy.FromMegabritishThermalUnits(value); + + /// + public static Energy? MegabritishThermalUnits(this float? value) => Energy.FromMegabritishThermalUnits(value); + + /// + public static Energy MegabritishThermalUnits(this decimal value) => Energy.FromMegabritishThermalUnits(Convert.ToDouble(value)); + + /// + public static Energy? MegabritishThermalUnits(this decimal? value) => Energy.FromMegabritishThermalUnits(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region Megajoule /// diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs index 1a79d4387f..46b78c1792 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs @@ -248,6 +248,40 @@ public static class NumberToMassExtensions #endregion + #region Kilopound + + /// + public static Mass Kilopounds(this int value) => Mass.FromKilopounds(value); + + /// + public static Mass? Kilopounds(this int? value) => Mass.FromKilopounds(value); + + /// + public static Mass Kilopounds(this long value) => Mass.FromKilopounds(value); + + /// + public static Mass? Kilopounds(this long? value) => Mass.FromKilopounds(value); + + /// + public static Mass Kilopounds(this double value) => Mass.FromKilopounds(value); + + /// + public static Mass? Kilopounds(this double? value) => Mass.FromKilopounds(value); + + /// + public static Mass Kilopounds(this float value) => Mass.FromKilopounds(value); + + /// + public static Mass? Kilopounds(this float? value) => Mass.FromKilopounds(value); + + /// + public static Mass Kilopounds(this decimal value) => Mass.FromKilopounds(Convert.ToDouble(value)); + + /// + public static Mass? Kilopounds(this decimal? value) => Mass.FromKilopounds(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region Kilotonne /// @@ -350,6 +384,40 @@ public static class NumberToMassExtensions #endregion + #region Megapound + + /// + public static Mass Megapounds(this int value) => Mass.FromMegapounds(value); + + /// + public static Mass? Megapounds(this int? value) => Mass.FromMegapounds(value); + + /// + public static Mass Megapounds(this long value) => Mass.FromMegapounds(value); + + /// + public static Mass? Megapounds(this long? value) => Mass.FromMegapounds(value); + + /// + public static Mass Megapounds(this double value) => Mass.FromMegapounds(value); + + /// + public static Mass? Megapounds(this double? value) => Mass.FromMegapounds(value); + + /// + public static Mass Megapounds(this float value) => Mass.FromMegapounds(value); + + /// + public static Mass? Megapounds(this float? value) => Mass.FromMegapounds(value); + + /// + public static Mass Megapounds(this decimal value) => Mass.FromMegapounds(Convert.ToDouble(value)); + + /// + public static Mass? Megapounds(this decimal? value) => Mass.FromMegapounds(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region Megatonne /// diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs index 840bc48117..f138007457 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs @@ -486,6 +486,74 @@ public static class NumberToVolumeExtensions #endregion + #region HectocubicFoot + + /// + public static Volume HectocubicFeet(this int value) => Volume.FromHectocubicFeet(value); + + /// + public static Volume? HectocubicFeet(this int? value) => Volume.FromHectocubicFeet(value); + + /// + public static Volume HectocubicFeet(this long value) => Volume.FromHectocubicFeet(value); + + /// + public static Volume? HectocubicFeet(this long? value) => Volume.FromHectocubicFeet(value); + + /// + public static Volume HectocubicFeet(this double value) => Volume.FromHectocubicFeet(value); + + /// + public static Volume? HectocubicFeet(this double? value) => Volume.FromHectocubicFeet(value); + + /// + public static Volume HectocubicFeet(this float value) => Volume.FromHectocubicFeet(value); + + /// + public static Volume? HectocubicFeet(this float? value) => Volume.FromHectocubicFeet(value); + + /// + public static Volume HectocubicFeet(this decimal value) => Volume.FromHectocubicFeet(Convert.ToDouble(value)); + + /// + public static Volume? HectocubicFeet(this decimal? value) => Volume.FromHectocubicFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + + #region HectocubicMeter + + /// + public static Volume HectocubicMeters(this int value) => Volume.FromHectocubicMeters(value); + + /// + public static Volume? HectocubicMeters(this int? value) => Volume.FromHectocubicMeters(value); + + /// + public static Volume HectocubicMeters(this long value) => Volume.FromHectocubicMeters(value); + + /// + public static Volume? HectocubicMeters(this long? value) => Volume.FromHectocubicMeters(value); + + /// + public static Volume HectocubicMeters(this double value) => Volume.FromHectocubicMeters(value); + + /// + public static Volume? HectocubicMeters(this double? value) => Volume.FromHectocubicMeters(value); + + /// + public static Volume HectocubicMeters(this float value) => Volume.FromHectocubicMeters(value); + + /// + public static Volume? HectocubicMeters(this float? value) => Volume.FromHectocubicMeters(value); + + /// + public static Volume HectocubicMeters(this decimal value) => Volume.FromHectocubicMeters(Convert.ToDouble(value)); + + /// + public static Volume? HectocubicMeters(this decimal? value) => Volume.FromHectocubicMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region Hectoliter /// @@ -588,6 +656,142 @@ public static class NumberToVolumeExtensions #endregion + #region KilocubicFoot + + /// + public static Volume KilocubicFeet(this int value) => Volume.FromKilocubicFeet(value); + + /// + public static Volume? KilocubicFeet(this int? value) => Volume.FromKilocubicFeet(value); + + /// + public static Volume KilocubicFeet(this long value) => Volume.FromKilocubicFeet(value); + + /// + public static Volume? KilocubicFeet(this long? value) => Volume.FromKilocubicFeet(value); + + /// + public static Volume KilocubicFeet(this double value) => Volume.FromKilocubicFeet(value); + + /// + public static Volume? KilocubicFeet(this double? value) => Volume.FromKilocubicFeet(value); + + /// + public static Volume KilocubicFeet(this float value) => Volume.FromKilocubicFeet(value); + + /// + public static Volume? KilocubicFeet(this float? value) => Volume.FromKilocubicFeet(value); + + /// + public static Volume KilocubicFeet(this decimal value) => Volume.FromKilocubicFeet(Convert.ToDouble(value)); + + /// + public static Volume? KilocubicFeet(this decimal? value) => Volume.FromKilocubicFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + + #region KilocubicMeter + + /// + public static Volume KilocubicMeters(this int value) => Volume.FromKilocubicMeters(value); + + /// + public static Volume? KilocubicMeters(this int? value) => Volume.FromKilocubicMeters(value); + + /// + public static Volume KilocubicMeters(this long value) => Volume.FromKilocubicMeters(value); + + /// + public static Volume? KilocubicMeters(this long? value) => Volume.FromKilocubicMeters(value); + + /// + public static Volume KilocubicMeters(this double value) => Volume.FromKilocubicMeters(value); + + /// + public static Volume? KilocubicMeters(this double? value) => Volume.FromKilocubicMeters(value); + + /// + public static Volume KilocubicMeters(this float value) => Volume.FromKilocubicMeters(value); + + /// + public static Volume? KilocubicMeters(this float? value) => Volume.FromKilocubicMeters(value); + + /// + public static Volume KilocubicMeters(this decimal value) => Volume.FromKilocubicMeters(Convert.ToDouble(value)); + + /// + public static Volume? KilocubicMeters(this decimal? value) => Volume.FromKilocubicMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + + #region KiloimperialGallon + + /// + public static Volume KiloimperialGallons(this int value) => Volume.FromKiloimperialGallons(value); + + /// + public static Volume? KiloimperialGallons(this int? value) => Volume.FromKiloimperialGallons(value); + + /// + public static Volume KiloimperialGallons(this long value) => Volume.FromKiloimperialGallons(value); + + /// + public static Volume? KiloimperialGallons(this long? value) => Volume.FromKiloimperialGallons(value); + + /// + public static Volume KiloimperialGallons(this double value) => Volume.FromKiloimperialGallons(value); + + /// + public static Volume? KiloimperialGallons(this double? value) => Volume.FromKiloimperialGallons(value); + + /// + public static Volume KiloimperialGallons(this float value) => Volume.FromKiloimperialGallons(value); + + /// + public static Volume? KiloimperialGallons(this float? value) => Volume.FromKiloimperialGallons(value); + + /// + public static Volume KiloimperialGallons(this decimal value) => Volume.FromKiloimperialGallons(Convert.ToDouble(value)); + + /// + public static Volume? KiloimperialGallons(this decimal? value) => Volume.FromKiloimperialGallons(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + + #region KilousGallon + + /// + public static Volume KilousGallons(this int value) => Volume.FromKilousGallons(value); + + /// + public static Volume? KilousGallons(this int? value) => Volume.FromKilousGallons(value); + + /// + public static Volume KilousGallons(this long value) => Volume.FromKilousGallons(value); + + /// + public static Volume? KilousGallons(this long? value) => Volume.FromKilousGallons(value); + + /// + public static Volume KilousGallons(this double value) => Volume.FromKilousGallons(value); + + /// + public static Volume? KilousGallons(this double? value) => Volume.FromKilousGallons(value); + + /// + public static Volume KilousGallons(this float value) => Volume.FromKilousGallons(value); + + /// + public static Volume? KilousGallons(this float? value) => Volume.FromKilousGallons(value); + + /// + public static Volume KilousGallons(this decimal value) => Volume.FromKilousGallons(Convert.ToDouble(value)); + + /// + public static Volume? KilousGallons(this decimal? value) => Volume.FromKilousGallons(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region Liter /// @@ -622,6 +826,108 @@ public static class NumberToVolumeExtensions #endregion + #region MegacubicFoot + + /// + public static Volume MegacubicFeet(this int value) => Volume.FromMegacubicFeet(value); + + /// + public static Volume? MegacubicFeet(this int? value) => Volume.FromMegacubicFeet(value); + + /// + public static Volume MegacubicFeet(this long value) => Volume.FromMegacubicFeet(value); + + /// + public static Volume? MegacubicFeet(this long? value) => Volume.FromMegacubicFeet(value); + + /// + public static Volume MegacubicFeet(this double value) => Volume.FromMegacubicFeet(value); + + /// + public static Volume? MegacubicFeet(this double? value) => Volume.FromMegacubicFeet(value); + + /// + public static Volume MegacubicFeet(this float value) => Volume.FromMegacubicFeet(value); + + /// + public static Volume? MegacubicFeet(this float? value) => Volume.FromMegacubicFeet(value); + + /// + public static Volume MegacubicFeet(this decimal value) => Volume.FromMegacubicFeet(Convert.ToDouble(value)); + + /// + public static Volume? MegacubicFeet(this decimal? value) => Volume.FromMegacubicFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + + #region MegaimperialGallon + + /// + public static Volume MegaimperialGallons(this int value) => Volume.FromMegaimperialGallons(value); + + /// + public static Volume? MegaimperialGallons(this int? value) => Volume.FromMegaimperialGallons(value); + + /// + public static Volume MegaimperialGallons(this long value) => Volume.FromMegaimperialGallons(value); + + /// + public static Volume? MegaimperialGallons(this long? value) => Volume.FromMegaimperialGallons(value); + + /// + public static Volume MegaimperialGallons(this double value) => Volume.FromMegaimperialGallons(value); + + /// + public static Volume? MegaimperialGallons(this double? value) => Volume.FromMegaimperialGallons(value); + + /// + public static Volume MegaimperialGallons(this float value) => Volume.FromMegaimperialGallons(value); + + /// + public static Volume? MegaimperialGallons(this float? value) => Volume.FromMegaimperialGallons(value); + + /// + public static Volume MegaimperialGallons(this decimal value) => Volume.FromMegaimperialGallons(Convert.ToDouble(value)); + + /// + public static Volume? MegaimperialGallons(this decimal? value) => Volume.FromMegaimperialGallons(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + + #region MegausGallon + + /// + public static Volume MegausGallons(this int value) => Volume.FromMegausGallons(value); + + /// + public static Volume? MegausGallons(this int? value) => Volume.FromMegausGallons(value); + + /// + public static Volume MegausGallons(this long value) => Volume.FromMegausGallons(value); + + /// + public static Volume? MegausGallons(this long? value) => Volume.FromMegausGallons(value); + + /// + public static Volume MegausGallons(this double value) => Volume.FromMegausGallons(value); + + /// + public static Volume? MegausGallons(this double? value) => Volume.FromMegausGallons(value); + + /// + public static Volume MegausGallons(this float value) => Volume.FromMegausGallons(value); + + /// + public static Volume? MegausGallons(this float? value) => Volume.FromMegausGallons(value); + + /// + public static Volume MegausGallons(this decimal value) => Volume.FromMegausGallons(Convert.ToDouble(value)); + + /// + public static Volume? MegausGallons(this decimal? value) => Volume.FromMegausGallons(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region MetricCup /// diff --git a/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs index 6c584b9377..878ad97188 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs @@ -225,6 +225,14 @@ public double Joules get { return _joules; } } + /// + /// Get Energy in KilobritishThermalUnits. + /// + public double KilobritishThermalUnits + { + get { return (_joules/1055.05585262) / 1e3d; } + } + /// /// Get Energy in Kilocalories. /// @@ -249,6 +257,14 @@ public double KilowattHours get { return (_joules/3600d) / 1e3d; } } + /// + /// Get Energy in MegabritishThermalUnits. + /// + public double MegabritishThermalUnits + { + get { return (_joules/1055.05585262) / 1e6d; } + } + /// /// Get Energy in Megajoules. /// @@ -386,6 +402,14 @@ public static Energy FromJoules(double joules) return new Energy(joules); } + /// + /// Get Energy from KilobritishThermalUnits. + /// + public static Energy FromKilobritishThermalUnits(double kilobritishthermalunits) + { + return new Energy((kilobritishthermalunits*1055.05585262) * 1e3d); + } + /// /// Get Energy from Kilocalories. /// @@ -410,6 +434,14 @@ public static Energy FromKilowattHours(double kilowatthours) return new Energy((kilowatthours*3600d) * 1e3d); } + /// + /// Get Energy from MegabritishThermalUnits. + /// + public static Energy FromMegabritishThermalUnits(double megabritishthermalunits) + { + return new Energy((megabritishthermalunits*1055.05585262) * 1e6d); + } + /// /// Get Energy from Megajoules. /// @@ -624,6 +656,21 @@ public static Energy FromWattHours(double watthours) } } + /// + /// Get nullable Energy from nullable KilobritishThermalUnits. + /// + public static Energy? FromKilobritishThermalUnits(double? kilobritishthermalunits) + { + if (kilobritishthermalunits.HasValue) + { + return FromKilobritishThermalUnits(kilobritishthermalunits.Value); + } + else + { + return null; + } + } + /// /// Get nullable Energy from nullable Kilocalories. /// @@ -669,6 +716,21 @@ public static Energy FromWattHours(double watthours) } } + /// + /// Get nullable Energy from nullable MegabritishThermalUnits. + /// + public static Energy? FromMegabritishThermalUnits(double? megabritishthermalunits) + { + if (megabritishthermalunits.HasValue) + { + return FromMegabritishThermalUnits(megabritishthermalunits.Value); + } + else + { + return null; + } + } + /// /// Get nullable Energy from nullable Megajoules. /// @@ -765,12 +827,16 @@ public static Energy From(double val, EnergyUnit fromUnit) return FromImperialTherms(val); case EnergyUnit.Joule: return FromJoules(val); + case EnergyUnit.KilobritishThermalUnit: + return FromKilobritishThermalUnits(val); case EnergyUnit.Kilocalorie: return FromKilocalories(val); case EnergyUnit.Kilojoule: return FromKilojoules(val); case EnergyUnit.KilowattHour: return FromKilowattHours(val); + case EnergyUnit.MegabritishThermalUnit: + return FromMegabritishThermalUnits(val); case EnergyUnit.Megajoule: return FromMegajoules(val); case EnergyUnit.MegawattHour: @@ -825,12 +891,16 @@ public static Energy From(double val, EnergyUnit fromUnit) return FromImperialTherms(value.Value); case EnergyUnit.Joule: return FromJoules(value.Value); + case EnergyUnit.KilobritishThermalUnit: + return FromKilobritishThermalUnits(value.Value); case EnergyUnit.Kilocalorie: return FromKilocalories(value.Value); case EnergyUnit.Kilojoule: return FromKilojoules(value.Value); case EnergyUnit.KilowattHour: return FromKilowattHours(value.Value); + case EnergyUnit.MegabritishThermalUnit: + return FromMegabritishThermalUnits(value.Value); case EnergyUnit.Megajoule: return FromMegajoules(value.Value); case EnergyUnit.MegawattHour: @@ -1020,12 +1090,16 @@ public double As(EnergyUnit unit) return ImperialTherms; case EnergyUnit.Joule: return Joules; + case EnergyUnit.KilobritishThermalUnit: + return KilobritishThermalUnits; case EnergyUnit.Kilocalorie: return Kilocalories; case EnergyUnit.Kilojoule: return Kilojoules; case EnergyUnit.KilowattHour: return KilowattHours; + case EnergyUnit.MegabritishThermalUnit: + return MegabritishThermalUnits; case EnergyUnit.Megajoule: return Megajoules; case EnergyUnit.MegawattHour: diff --git a/UnitsNet/GeneratedCode/UnitClasses/Mass.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Mass.g.cs index bffab1cf60..c4b85d901b 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Mass.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Mass.g.cs @@ -177,6 +177,14 @@ public double Kilograms get { return (_kilograms*1e3) / 1e3d; } } + /// + /// Get Mass in Kilopounds. + /// + public double Kilopounds + { + get { return (_kilograms/0.45359237) / 1e3d; } + } + /// /// Get Mass in Kilotonnes. /// @@ -201,6 +209,14 @@ public double LongTons get { return _kilograms/1016.0469088; } } + /// + /// Get Mass in Megapounds. + /// + public double Megapounds + { + get { return (_kilograms/0.45359237) / 1e6d; } + } + /// /// Get Mass in Megatonnes. /// @@ -338,6 +354,14 @@ public static Mass FromKilograms(double kilograms) return new Mass((kilograms/1e3) * 1e3d); } + /// + /// Get Mass from Kilopounds. + /// + public static Mass FromKilopounds(double kilopounds) + { + return new Mass((kilopounds*0.45359237) * 1e3d); + } + /// /// Get Mass from Kilotonnes. /// @@ -362,6 +386,14 @@ public static Mass FromLongTons(double longtons) return new Mass(longtons*1016.0469088); } + /// + /// Get Mass from Megapounds. + /// + public static Mass FromMegapounds(double megapounds) + { + return new Mass((megapounds*0.45359237) * 1e6d); + } + /// /// Get Mass from Megatonnes. /// @@ -534,6 +566,21 @@ public static Mass FromTonnes(double tonnes) } } + /// + /// Get nullable Mass from nullable Kilopounds. + /// + public static Mass? FromKilopounds(double? kilopounds) + { + if (kilopounds.HasValue) + { + return FromKilopounds(kilopounds.Value); + } + else + { + return null; + } + } + /// /// Get nullable Mass from nullable Kilotonnes. /// @@ -579,6 +626,21 @@ public static Mass FromTonnes(double tonnes) } } + /// + /// Get nullable Mass from nullable Megapounds. + /// + public static Mass? FromMegapounds(double? megapounds) + { + if (megapounds.HasValue) + { + return FromMegapounds(megapounds.Value); + } + else + { + return null; + } + } + /// /// Get nullable Mass from nullable Megatonnes. /// @@ -753,12 +815,16 @@ public static Mass From(double val, MassUnit fromUnit) return FromHectograms(val); case MassUnit.Kilogram: return FromKilograms(val); + case MassUnit.Kilopound: + return FromKilopounds(val); case MassUnit.Kilotonne: return FromKilotonnes(val); case MassUnit.LongHundredweight: return FromLongHundredweight(val); case MassUnit.LongTon: return FromLongTons(val); + case MassUnit.Megapound: + return FromMegapounds(val); case MassUnit.Megatonne: return FromMegatonnes(val); case MassUnit.Microgram: @@ -813,12 +879,16 @@ public static Mass From(double val, MassUnit fromUnit) return FromHectograms(value.Value); case MassUnit.Kilogram: return FromKilograms(value.Value); + case MassUnit.Kilopound: + return FromKilopounds(value.Value); case MassUnit.Kilotonne: return FromKilotonnes(value.Value); case MassUnit.LongHundredweight: return FromLongHundredweight(value.Value); case MassUnit.LongTon: return FromLongTons(value.Value); + case MassUnit.Megapound: + return FromMegapounds(value.Value); case MassUnit.Megatonne: return FromMegatonnes(value.Value); case MassUnit.Microgram: @@ -1008,12 +1078,16 @@ public double As(MassUnit unit) return Hectograms; case MassUnit.Kilogram: return Kilograms; + case MassUnit.Kilopound: + return Kilopounds; case MassUnit.Kilotonne: return Kilotonnes; case MassUnit.LongHundredweight: return LongHundredweight; case MassUnit.LongTon: return LongTons; + case MassUnit.Megapound: + return Megapounds; case MassUnit.Megatonne: return Megatonnes; case MassUnit.Microgram: diff --git a/UnitsNet/GeneratedCode/UnitClasses/Volume.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Volume.g.cs index 8173e9e95f..13e6f3039a 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Volume.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Volume.g.cs @@ -233,6 +233,22 @@ public double Deciliters get { return (_cubicMeters*1e3) / 1e-1d; } } + /// + /// Get Volume in HectocubicFeet. + /// + public double HectocubicFeet + { + get { return (_cubicMeters/0.0283168) / 1e2d; } + } + + /// + /// Get Volume in HectocubicMeters. + /// + public double HectocubicMeters + { + get { return (_cubicMeters) / 1e2d; } + } + /// /// Get Volume in Hectoliters. /// @@ -257,6 +273,38 @@ public double ImperialOunces get { return _cubicMeters/2.8413062499962901241875439064617e-5; } } + /// + /// Get Volume in KilocubicFeet. + /// + public double KilocubicFeet + { + get { return (_cubicMeters/0.0283168) / 1e3d; } + } + + /// + /// Get Volume in KilocubicMeters. + /// + public double KilocubicMeters + { + get { return (_cubicMeters) / 1e3d; } + } + + /// + /// Get Volume in KiloimperialGallons. + /// + public double KiloimperialGallons + { + get { return (_cubicMeters/0.00454609000000181429905810072407) / 1e3d; } + } + + /// + /// Get Volume in KilousGallons. + /// + public double KilousGallons + { + get { return (_cubicMeters/0.00378541) / 1e3d; } + } + /// /// Get Volume in Liters. /// @@ -265,6 +313,30 @@ public double Liters get { return _cubicMeters*1e3; } } + /// + /// Get Volume in MegacubicFeet. + /// + public double MegacubicFeet + { + get { return (_cubicMeters/0.0283168) / 1e6d; } + } + + /// + /// Get Volume in MegaimperialGallons. + /// + public double MegaimperialGallons + { + get { return (_cubicMeters/0.00454609000000181429905810072407) / 1e6d; } + } + + /// + /// Get Volume in MegausGallons. + /// + public double MegausGallons + { + get { return (_cubicMeters/0.00378541) / 1e6d; } + } + /// /// Get Volume in MetricCups. /// @@ -492,6 +564,22 @@ public static Volume FromDeciliters(double deciliters) return new Volume((deciliters/1e3) * 1e-1d); } + /// + /// Get Volume from HectocubicFeet. + /// + public static Volume FromHectocubicFeet(double hectocubicfeet) + { + return new Volume((hectocubicfeet*0.0283168) * 1e2d); + } + + /// + /// Get Volume from HectocubicMeters. + /// + public static Volume FromHectocubicMeters(double hectocubicmeters) + { + return new Volume((hectocubicmeters) * 1e2d); + } + /// /// Get Volume from Hectoliters. /// @@ -516,6 +604,38 @@ public static Volume FromImperialOunces(double imperialounces) return new Volume(imperialounces*2.8413062499962901241875439064617e-5); } + /// + /// Get Volume from KilocubicFeet. + /// + public static Volume FromKilocubicFeet(double kilocubicfeet) + { + return new Volume((kilocubicfeet*0.0283168) * 1e3d); + } + + /// + /// Get Volume from KilocubicMeters. + /// + public static Volume FromKilocubicMeters(double kilocubicmeters) + { + return new Volume((kilocubicmeters) * 1e3d); + } + + /// + /// Get Volume from KiloimperialGallons. + /// + public static Volume FromKiloimperialGallons(double kiloimperialgallons) + { + return new Volume((kiloimperialgallons*0.00454609000000181429905810072407) * 1e3d); + } + + /// + /// Get Volume from KilousGallons. + /// + public static Volume FromKilousGallons(double kilousgallons) + { + return new Volume((kilousgallons*0.00378541) * 1e3d); + } + /// /// Get Volume from Liters. /// @@ -524,6 +644,30 @@ public static Volume FromLiters(double liters) return new Volume(liters/1e3); } + /// + /// Get Volume from MegacubicFeet. + /// + public static Volume FromMegacubicFeet(double megacubicfeet) + { + return new Volume((megacubicfeet*0.0283168) * 1e6d); + } + + /// + /// Get Volume from MegaimperialGallons. + /// + public static Volume FromMegaimperialGallons(double megaimperialgallons) + { + return new Volume((megaimperialgallons*0.00454609000000181429905810072407) * 1e6d); + } + + /// + /// Get Volume from MegausGallons. + /// + public static Volume FromMegausGallons(double megausgallons) + { + return new Volume((megausgallons*0.00378541) * 1e6d); + } + /// /// Get Volume from MetricCups. /// @@ -833,6 +977,36 @@ public static Volume FromUsTeaspoons(double usteaspoons) } } + /// + /// Get nullable Volume from nullable HectocubicFeet. + /// + public static Volume? FromHectocubicFeet(double? hectocubicfeet) + { + if (hectocubicfeet.HasValue) + { + return FromHectocubicFeet(hectocubicfeet.Value); + } + else + { + return null; + } + } + + /// + /// Get nullable Volume from nullable HectocubicMeters. + /// + public static Volume? FromHectocubicMeters(double? hectocubicmeters) + { + if (hectocubicmeters.HasValue) + { + return FromHectocubicMeters(hectocubicmeters.Value); + } + else + { + return null; + } + } + /// /// Get nullable Volume from nullable Hectoliters. /// @@ -878,6 +1052,66 @@ public static Volume FromUsTeaspoons(double usteaspoons) } } + /// + /// Get nullable Volume from nullable KilocubicFeet. + /// + public static Volume? FromKilocubicFeet(double? kilocubicfeet) + { + if (kilocubicfeet.HasValue) + { + return FromKilocubicFeet(kilocubicfeet.Value); + } + else + { + return null; + } + } + + /// + /// Get nullable Volume from nullable KilocubicMeters. + /// + public static Volume? FromKilocubicMeters(double? kilocubicmeters) + { + if (kilocubicmeters.HasValue) + { + return FromKilocubicMeters(kilocubicmeters.Value); + } + else + { + return null; + } + } + + /// + /// Get nullable Volume from nullable KiloimperialGallons. + /// + public static Volume? FromKiloimperialGallons(double? kiloimperialgallons) + { + if (kiloimperialgallons.HasValue) + { + return FromKiloimperialGallons(kiloimperialgallons.Value); + } + else + { + return null; + } + } + + /// + /// Get nullable Volume from nullable KilousGallons. + /// + public static Volume? FromKilousGallons(double? kilousgallons) + { + if (kilousgallons.HasValue) + { + return FromKilousGallons(kilousgallons.Value); + } + else + { + return null; + } + } + /// /// Get nullable Volume from nullable Liters. /// @@ -893,6 +1127,51 @@ public static Volume FromUsTeaspoons(double usteaspoons) } } + /// + /// Get nullable Volume from nullable MegacubicFeet. + /// + public static Volume? FromMegacubicFeet(double? megacubicfeet) + { + if (megacubicfeet.HasValue) + { + return FromMegacubicFeet(megacubicfeet.Value); + } + else + { + return null; + } + } + + /// + /// Get nullable Volume from nullable MegaimperialGallons. + /// + public static Volume? FromMegaimperialGallons(double? megaimperialgallons) + { + if (megaimperialgallons.HasValue) + { + return FromMegaimperialGallons(megaimperialgallons.Value); + } + else + { + return null; + } + } + + /// + /// Get nullable Volume from nullable MegausGallons. + /// + public static Volume? FromMegausGallons(double? megausgallons) + { + if (megausgallons.HasValue) + { + return FromMegausGallons(megausgallons.Value); + } + else + { + return null; + } + } + /// /// Get nullable Volume from nullable MetricCups. /// @@ -1141,14 +1420,32 @@ public static Volume From(double val, VolumeUnit fromUnit) return FromCubicYards(val); case VolumeUnit.Deciliter: return FromDeciliters(val); + case VolumeUnit.HectocubicFoot: + return FromHectocubicFeet(val); + case VolumeUnit.HectocubicMeter: + return FromHectocubicMeters(val); case VolumeUnit.Hectoliter: return FromHectoliters(val); case VolumeUnit.ImperialGallon: return FromImperialGallons(val); case VolumeUnit.ImperialOunce: return FromImperialOunces(val); + case VolumeUnit.KilocubicFoot: + return FromKilocubicFeet(val); + case VolumeUnit.KilocubicMeter: + return FromKilocubicMeters(val); + case VolumeUnit.KiloimperialGallon: + return FromKiloimperialGallons(val); + case VolumeUnit.KilousGallon: + return FromKilousGallons(val); case VolumeUnit.Liter: return FromLiters(val); + case VolumeUnit.MegacubicFoot: + return FromMegacubicFeet(val); + case VolumeUnit.MegaimperialGallon: + return FromMegaimperialGallons(val); + case VolumeUnit.MegausGallon: + return FromMegausGallons(val); case VolumeUnit.MetricCup: return FromMetricCups(val); case VolumeUnit.MetricTeaspoon: @@ -1225,14 +1522,32 @@ public static Volume From(double val, VolumeUnit fromUnit) return FromCubicYards(value.Value); case VolumeUnit.Deciliter: return FromDeciliters(value.Value); + case VolumeUnit.HectocubicFoot: + return FromHectocubicFeet(value.Value); + case VolumeUnit.HectocubicMeter: + return FromHectocubicMeters(value.Value); case VolumeUnit.Hectoliter: return FromHectoliters(value.Value); case VolumeUnit.ImperialGallon: return FromImperialGallons(value.Value); case VolumeUnit.ImperialOunce: return FromImperialOunces(value.Value); + case VolumeUnit.KilocubicFoot: + return FromKilocubicFeet(value.Value); + case VolumeUnit.KilocubicMeter: + return FromKilocubicMeters(value.Value); + case VolumeUnit.KiloimperialGallon: + return FromKiloimperialGallons(value.Value); + case VolumeUnit.KilousGallon: + return FromKilousGallons(value.Value); case VolumeUnit.Liter: return FromLiters(value.Value); + case VolumeUnit.MegacubicFoot: + return FromMegacubicFeet(value.Value); + case VolumeUnit.MegaimperialGallon: + return FromMegaimperialGallons(value.Value); + case VolumeUnit.MegausGallon: + return FromMegausGallons(value.Value); case VolumeUnit.MetricCup: return FromMetricCups(value.Value); case VolumeUnit.MetricTeaspoon: @@ -1444,14 +1759,32 @@ public double As(VolumeUnit unit) return CubicYards; case VolumeUnit.Deciliter: return Deciliters; + case VolumeUnit.HectocubicFoot: + return HectocubicFeet; + case VolumeUnit.HectocubicMeter: + return HectocubicMeters; case VolumeUnit.Hectoliter: return Hectoliters; case VolumeUnit.ImperialGallon: return ImperialGallons; case VolumeUnit.ImperialOunce: return ImperialOunces; + case VolumeUnit.KilocubicFoot: + return KilocubicFeet; + case VolumeUnit.KilocubicMeter: + return KilocubicMeters; + case VolumeUnit.KiloimperialGallon: + return KiloimperialGallons; + case VolumeUnit.KilousGallon: + return KilousGallons; case VolumeUnit.Liter: return Liters; + case VolumeUnit.MegacubicFoot: + return MegacubicFeet; + case VolumeUnit.MegaimperialGallon: + return MegaimperialGallons; + case VolumeUnit.MegausGallon: + return MegausGallons; case VolumeUnit.MetricCup: return MetricCups; case VolumeUnit.MetricTeaspoon: diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index e1ea8896ce..0e09f7e1e0 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -849,6 +849,7 @@ private static readonly ReadOnlyCollection DefaultLocalization new[] { new AbbreviationsForCulture("en-US", "GWh"), + new AbbreviationsForCulture("en-US", "GВт/ч"), }), new CulturesForEnumValue((int) EnergyUnit.ImperialTherm, new[] @@ -861,6 +862,11 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "J"), }), + new CulturesForEnumValue((int) EnergyUnit.KilobritishThermalUnit, + new[] + { + new AbbreviationsForCulture("en-US", "kBTU"), + }), new CulturesForEnumValue((int) EnergyUnit.Kilocalorie, new[] { @@ -875,6 +881,12 @@ private static readonly ReadOnlyCollection DefaultLocalization new[] { new AbbreviationsForCulture("en-US", "kWh"), + new AbbreviationsForCulture("en-US", "kВт/ч"), + }), + new CulturesForEnumValue((int) EnergyUnit.MegabritishThermalUnit, + new[] + { + new AbbreviationsForCulture("en-US", "MBTU"), }), new CulturesForEnumValue((int) EnergyUnit.Megajoule, new[] @@ -885,6 +897,7 @@ private static readonly ReadOnlyCollection DefaultLocalization new[] { new AbbreviationsForCulture("en-US", "MWh"), + new AbbreviationsForCulture("en-US", "MВт/ч"), }), new CulturesForEnumValue((int) EnergyUnit.UsTherm, new[] @@ -896,6 +909,7 @@ private static readonly ReadOnlyCollection DefaultLocalization new[] { new AbbreviationsForCulture("en-US", "Wh"), + new AbbreviationsForCulture("en-US", "Вт/ч"), }), }), new UnitLocalization(typeof (FlowUnit), @@ -1534,6 +1548,12 @@ private static readonly ReadOnlyCollection DefaultLocalization new AbbreviationsForCulture("en-US", "kg"), new AbbreviationsForCulture("ru-RU", "кг"), }), + new CulturesForEnumValue((int) MassUnit.Kilopound, + new[] + { + new AbbreviationsForCulture("en-US", "klb"), + new AbbreviationsForCulture("ru-RU", "kфунт"), + }), new CulturesForEnumValue((int) MassUnit.Kilotonne, new[] { @@ -1551,6 +1571,12 @@ private static readonly ReadOnlyCollection DefaultLocalization new AbbreviationsForCulture("en-US", "long tn"), new AbbreviationsForCulture("ru-RU", "тонна большая"), }), + new CulturesForEnumValue((int) MassUnit.Megapound, + new[] + { + new AbbreviationsForCulture("en-US", "Mlb"), + new AbbreviationsForCulture("ru-RU", "Mфунт"), + }), new CulturesForEnumValue((int) MassUnit.Megatonne, new[] { @@ -1584,6 +1610,7 @@ private static readonly ReadOnlyCollection DefaultLocalization new[] { new AbbreviationsForCulture("en-US", "lb"), + new AbbreviationsForCulture("ru-RU", "фунт"), }), new CulturesForEnumValue((int) MassUnit.ShortHundredweight, new[] @@ -2865,6 +2892,18 @@ private static readonly ReadOnlyCollection DefaultLocalization new AbbreviationsForCulture("en-US", "dl"), new AbbreviationsForCulture("ru-RU", "дл"), }), + new CulturesForEnumValue((int) VolumeUnit.HectocubicFoot, + new[] + { + new AbbreviationsForCulture("en-US", "hft³"), + new AbbreviationsForCulture("ru-RU", "hфут³"), + }), + new CulturesForEnumValue((int) VolumeUnit.HectocubicMeter, + new[] + { + new AbbreviationsForCulture("en-US", "hm³"), + new AbbreviationsForCulture("ru-RU", "hм³"), + }), new CulturesForEnumValue((int) VolumeUnit.Hectoliter, new[] { @@ -2883,12 +2922,54 @@ private static readonly ReadOnlyCollection DefaultLocalization new AbbreviationsForCulture("en-US", "oz (imp.)"), new AbbreviationsForCulture("ru-RU", "Английская унция"), }), + new CulturesForEnumValue((int) VolumeUnit.KilocubicFoot, + new[] + { + new AbbreviationsForCulture("en-US", "kft³"), + new AbbreviationsForCulture("ru-RU", "kфут³"), + }), + new CulturesForEnumValue((int) VolumeUnit.KilocubicMeter, + new[] + { + new AbbreviationsForCulture("en-US", "km³"), + new AbbreviationsForCulture("ru-RU", "kм³"), + }), + new CulturesForEnumValue((int) VolumeUnit.KiloimperialGallon, + new[] + { + new AbbreviationsForCulture("en-US", "kgal (imp.)"), + new AbbreviationsForCulture("ru-RU", "kАнглийский галлон"), + }), + new CulturesForEnumValue((int) VolumeUnit.KilousGallon, + new[] + { + new AbbreviationsForCulture("en-US", "kgal (U.S.)"), + new AbbreviationsForCulture("ru-RU", "kАмериканский галлон"), + }), new CulturesForEnumValue((int) VolumeUnit.Liter, new[] { new AbbreviationsForCulture("en-US", "l"), new AbbreviationsForCulture("ru-RU", "л"), }), + new CulturesForEnumValue((int) VolumeUnit.MegacubicFoot, + new[] + { + new AbbreviationsForCulture("en-US", "Mft³"), + new AbbreviationsForCulture("ru-RU", "Mфут³"), + }), + new CulturesForEnumValue((int) VolumeUnit.MegaimperialGallon, + new[] + { + new AbbreviationsForCulture("en-US", "Mgal (imp.)"), + new AbbreviationsForCulture("ru-RU", "MАнглийский галлон"), + }), + new CulturesForEnumValue((int) VolumeUnit.MegausGallon, + new[] + { + new AbbreviationsForCulture("en-US", "Mgal (U.S.)"), + new AbbreviationsForCulture("ru-RU", "MАмериканский галлон"), + }), new CulturesForEnumValue((int) VolumeUnit.MetricCup, new[] { diff --git a/UnitsNet/UnitDefinitions/Mass.json b/UnitsNet/UnitDefinitions/Mass.json index 7658ea80b9..9fe5212d10 100644 --- a/UnitsNet/UnitDefinitions/Mass.json +++ b/UnitsNet/UnitDefinitions/Mass.json @@ -85,7 +85,8 @@ "Localization": [ { "Culture": "en-US", - "Abbreviations": [ "lb" ] + "Abbreviations": [ "lb" ], + "AbbreviationsWithPrefixes": [ "KLbs", "MLbs" ] }, { "Culture": "ru-RU", diff --git a/UnitsNet/UnitDefinitions/Volume.json b/UnitsNet/UnitDefinitions/Volume.json index 1947b49f29..1864c9d176 100644 --- a/UnitsNet/UnitDefinitions/Volume.json +++ b/UnitsNet/UnitDefinitions/Volume.json @@ -26,7 +26,7 @@ "PluralName": "CubicMeters", "FromUnitToBaseFunc": "x", "FromBaseToUnitFunc": "x", - "Prefixes": [ "Micro", "Milli", "Centi", "Deci", "Hecto", "Kilo" ], + "Prefixes": [ "Hecto", "Kilo" ], "Localization": [ { "Culture": "en-US", From 1c4614eaafe82f6a7e827cc4c4e1446562b461de Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Mon, 25 Sep 2017 14:25:36 +0300 Subject: [PATCH 07/19] Add improved name scheme --- UnitsNet.Tests/CustomCode/EnergyTests.cs | 12 +- .../GeneratedCode/EnergyTestsBase.g.cs | 72 ++--- UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs | 12 +- .../Number/NumberToEnergyExtensions.g.cs | 304 +++++++++--------- .../GeneratedCode/UnitClasses/Energy.g.cs | 268 +++++++-------- .../GeneratedCode/UnitSystem.Default.g.cs | 46 +-- UnitsNet/UnitDefinitions/Energy.json | 30 +- 7 files changed, 375 insertions(+), 369 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/EnergyTests.cs b/UnitsNet.Tests/CustomCode/EnergyTests.cs index bca2b8fd94..e7bf4e7312 100644 --- a/UnitsNet.Tests/CustomCode/EnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/EnergyTests.cs @@ -24,7 +24,7 @@ namespace UnitsNet.Tests.CustomCode public class EnergyTests : EnergyTestsBase { // TODO Override properties in base class here - protected override double ImperialThermsInOneJoule => 9.478171203551087813109937767482e-15; + protected override double ThermsImperialInOneJoule => 9.478171203551087813109937767482e-15; protected override double JoulesInOneJoule => 1; @@ -36,17 +36,17 @@ public class EnergyTests : EnergyTestsBase protected override double CaloriesInOneJoule => 0.239005736; - protected override double DecaeuThermsInOneJoule => 9.4781339449889105832843629746176e-10; + protected override double DecathermsEcInOneJoule => 9.47816988e-10; - protected override double DecaimperialThermsInOneJoule => 9.478171203551087813109937767482e-15; + protected override double DecathermsImperialInOneJoule => 9.478171203551087813109937767482e-15; - protected override double DecausThermsInOneJoule => 9.4804342797334860315281322406817e-10; + protected override double DecathermsUsInOneJoule => 9.4804342797334860315281322406817e-10; protected override double ElectronVoltsInOneJoule => 6.241509343260179e18; protected override double ErgsInOneJoule => 10000000; - protected override double EuThermsInOneJoule => 9.4781339449889105832843629746176e-9; + protected override double ThermsEcInOneJoule => 9.47816988e-9; protected override double FootPoundsInOneJoule => 0.737562149; @@ -58,7 +58,7 @@ public class EnergyTests : EnergyTestsBase protected override double MegawattHoursInOneJoule => 2.77777778e-10; - protected override double UsThermsInOneJoule => 9.4804342797334860315281322406817e-9; + protected override double ThermsUsInOneJoule => 9.4804342797334860315281322406817e-9; protected override double WattHoursInOneJoule => 0.000277777778; } diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index ec5c3492b9..aa215b7dda 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -54,43 +54,43 @@ public abstract partial class EnergyTestsBase { protected abstract double BritishThermalUnitsInOneJoule { get; } protected abstract double CaloriesInOneJoule { get; } - protected abstract double DecaeuThermsInOneJoule { get; } - protected abstract double DecaimperialThermsInOneJoule { get; } - protected abstract double DecausThermsInOneJoule { get; } + protected abstract double DecathermsEcInOneJoule { get; } + protected abstract double DecathermsImperialInOneJoule { get; } + protected abstract double DecathermsUsInOneJoule { get; } protected abstract double ElectronVoltsInOneJoule { get; } protected abstract double ErgsInOneJoule { get; } - protected abstract double EuThermsInOneJoule { get; } protected abstract double FootPoundsInOneJoule { get; } protected abstract double GigawattHoursInOneJoule { get; } - protected abstract double ImperialThermsInOneJoule { get; } protected abstract double JoulesInOneJoule { get; } protected abstract double KilocaloriesInOneJoule { get; } protected abstract double KilojoulesInOneJoule { get; } protected abstract double KilowattHoursInOneJoule { get; } protected abstract double MegajoulesInOneJoule { get; } protected abstract double MegawattHoursInOneJoule { get; } - protected abstract double UsThermsInOneJoule { get; } + protected abstract double ThermsEcInOneJoule { get; } + protected abstract double ThermsImperialInOneJoule { get; } + protected abstract double ThermsUsInOneJoule { get; } protected abstract double WattHoursInOneJoule { get; } // ReSharper disable VirtualMemberNeverOverriden.Global protected virtual double BritishThermalUnitsTolerance { get { return 1e-5; } } protected virtual double CaloriesTolerance { get { return 1e-5; } } - protected virtual double DecaeuThermsTolerance { get { return 1e-5; } } - protected virtual double DecaimperialThermsTolerance { get { return 1e-5; } } - protected virtual double DecausThermsTolerance { get { return 1e-5; } } + protected virtual double DecathermsEcTolerance { get { return 1e-5; } } + protected virtual double DecathermsImperialTolerance { get { return 1e-5; } } + protected virtual double DecathermsUsTolerance { get { return 1e-5; } } protected virtual double ElectronVoltsTolerance { get { return 1e-5; } } protected virtual double ErgsTolerance { get { return 1e-5; } } - protected virtual double EuThermsTolerance { get { return 1e-5; } } protected virtual double FootPoundsTolerance { get { return 1e-5; } } protected virtual double GigawattHoursTolerance { get { return 1e-5; } } - protected virtual double ImperialThermsTolerance { get { return 1e-5; } } protected virtual double JoulesTolerance { get { return 1e-5; } } protected virtual double KilocaloriesTolerance { get { return 1e-5; } } protected virtual double KilojoulesTolerance { get { return 1e-5; } } protected virtual double KilowattHoursTolerance { get { return 1e-5; } } protected virtual double MegajoulesTolerance { get { return 1e-5; } } protected virtual double MegawattHoursTolerance { get { return 1e-5; } } - protected virtual double UsThermsTolerance { get { return 1e-5; } } + protected virtual double ThermsEcTolerance { get { return 1e-5; } } + protected virtual double ThermsImperialTolerance { get { return 1e-5; } } + protected virtual double ThermsUsTolerance { get { return 1e-5; } } protected virtual double WattHoursTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global @@ -100,22 +100,22 @@ public void JouleToEnergyUnits() Energy joule = Energy.FromJoules(1); AssertEx.EqualTolerance(BritishThermalUnitsInOneJoule, joule.BritishThermalUnits, BritishThermalUnitsTolerance); AssertEx.EqualTolerance(CaloriesInOneJoule, joule.Calories, CaloriesTolerance); - AssertEx.EqualTolerance(DecaeuThermsInOneJoule, joule.DecaeuTherms, DecaeuThermsTolerance); - AssertEx.EqualTolerance(DecaimperialThermsInOneJoule, joule.DecaimperialTherms, DecaimperialThermsTolerance); - AssertEx.EqualTolerance(DecausThermsInOneJoule, joule.DecausTherms, DecausThermsTolerance); + AssertEx.EqualTolerance(DecathermsEcInOneJoule, joule.DecathermsEc, DecathermsEcTolerance); + AssertEx.EqualTolerance(DecathermsImperialInOneJoule, joule.DecathermsImperial, DecathermsImperialTolerance); + AssertEx.EqualTolerance(DecathermsUsInOneJoule, joule.DecathermsUs, DecathermsUsTolerance); AssertEx.EqualTolerance(ElectronVoltsInOneJoule, joule.ElectronVolts, ElectronVoltsTolerance); AssertEx.EqualTolerance(ErgsInOneJoule, joule.Ergs, ErgsTolerance); - AssertEx.EqualTolerance(EuThermsInOneJoule, joule.EuTherms, EuThermsTolerance); AssertEx.EqualTolerance(FootPoundsInOneJoule, joule.FootPounds, FootPoundsTolerance); AssertEx.EqualTolerance(GigawattHoursInOneJoule, joule.GigawattHours, GigawattHoursTolerance); - AssertEx.EqualTolerance(ImperialThermsInOneJoule, joule.ImperialTherms, ImperialThermsTolerance); AssertEx.EqualTolerance(JoulesInOneJoule, joule.Joules, JoulesTolerance); AssertEx.EqualTolerance(KilocaloriesInOneJoule, joule.Kilocalories, KilocaloriesTolerance); AssertEx.EqualTolerance(KilojoulesInOneJoule, joule.Kilojoules, KilojoulesTolerance); AssertEx.EqualTolerance(KilowattHoursInOneJoule, joule.KilowattHours, KilowattHoursTolerance); AssertEx.EqualTolerance(MegajoulesInOneJoule, joule.Megajoules, MegajoulesTolerance); AssertEx.EqualTolerance(MegawattHoursInOneJoule, joule.MegawattHours, MegawattHoursTolerance); - AssertEx.EqualTolerance(UsThermsInOneJoule, joule.UsTherms, UsThermsTolerance); + AssertEx.EqualTolerance(ThermsEcInOneJoule, joule.ThermsEc, ThermsEcTolerance); + AssertEx.EqualTolerance(ThermsImperialInOneJoule, joule.ThermsImperial, ThermsImperialTolerance); + AssertEx.EqualTolerance(ThermsUsInOneJoule, joule.ThermsUs, ThermsUsTolerance); AssertEx.EqualTolerance(WattHoursInOneJoule, joule.WattHours, WattHoursTolerance); } @@ -124,22 +124,22 @@ public void FromValueAndUnit() { AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.BritishThermalUnit).BritishThermalUnits, BritishThermalUnitsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Calorie).Calories, CaloriesTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecaeuTherm).DecaeuTherms, DecaeuThermsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecaimperialTherm).DecaimperialTherms, DecaimperialThermsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecausTherm).DecausTherms, DecausThermsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecathermEc).DecathermsEc, DecathermsEcTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecathermImperial).DecathermsImperial, DecathermsImperialTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecathermUs).DecathermsUs, DecathermsUsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ElectronVolt).ElectronVolts, ElectronVoltsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Erg).Ergs, ErgsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.EuTherm).EuTherms, EuThermsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.FootPound).FootPounds, FootPoundsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.GigawattHour).GigawattHours, GigawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ImperialTherm).ImperialTherms, ImperialThermsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Joule).Joules, JoulesTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Kilocalorie).Kilocalories, KilocaloriesTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Kilojoule).Kilojoules, KilojoulesTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.KilowattHour).KilowattHours, KilowattHoursTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Megajoule).Megajoules, MegajoulesTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.MegawattHour).MegawattHours, MegawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.UsTherm).UsTherms, UsThermsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ThermEc).ThermsEc, ThermsEcTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ThermImperial).ThermsImperial, ThermsImperialTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ThermUs).ThermsUs, ThermsUsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.WattHour).WattHours, WattHoursTolerance); } @@ -149,22 +149,22 @@ public void As() var joule = Energy.FromJoules(1); AssertEx.EqualTolerance(BritishThermalUnitsInOneJoule, joule.As(EnergyUnit.BritishThermalUnit), BritishThermalUnitsTolerance); AssertEx.EqualTolerance(CaloriesInOneJoule, joule.As(EnergyUnit.Calorie), CaloriesTolerance); - AssertEx.EqualTolerance(DecaeuThermsInOneJoule, joule.As(EnergyUnit.DecaeuTherm), DecaeuThermsTolerance); - AssertEx.EqualTolerance(DecaimperialThermsInOneJoule, joule.As(EnergyUnit.DecaimperialTherm), DecaimperialThermsTolerance); - AssertEx.EqualTolerance(DecausThermsInOneJoule, joule.As(EnergyUnit.DecausTherm), DecausThermsTolerance); + AssertEx.EqualTolerance(DecathermsEcInOneJoule, joule.As(EnergyUnit.DecathermEc), DecathermsEcTolerance); + AssertEx.EqualTolerance(DecathermsImperialInOneJoule, joule.As(EnergyUnit.DecathermImperial), DecathermsImperialTolerance); + AssertEx.EqualTolerance(DecathermsUsInOneJoule, joule.As(EnergyUnit.DecathermUs), DecathermsUsTolerance); AssertEx.EqualTolerance(ElectronVoltsInOneJoule, joule.As(EnergyUnit.ElectronVolt), ElectronVoltsTolerance); AssertEx.EqualTolerance(ErgsInOneJoule, joule.As(EnergyUnit.Erg), ErgsTolerance); - AssertEx.EqualTolerance(EuThermsInOneJoule, joule.As(EnergyUnit.EuTherm), EuThermsTolerance); AssertEx.EqualTolerance(FootPoundsInOneJoule, joule.As(EnergyUnit.FootPound), FootPoundsTolerance); AssertEx.EqualTolerance(GigawattHoursInOneJoule, joule.As(EnergyUnit.GigawattHour), GigawattHoursTolerance); - AssertEx.EqualTolerance(ImperialThermsInOneJoule, joule.As(EnergyUnit.ImperialTherm), ImperialThermsTolerance); AssertEx.EqualTolerance(JoulesInOneJoule, joule.As(EnergyUnit.Joule), JoulesTolerance); AssertEx.EqualTolerance(KilocaloriesInOneJoule, joule.As(EnergyUnit.Kilocalorie), KilocaloriesTolerance); AssertEx.EqualTolerance(KilojoulesInOneJoule, joule.As(EnergyUnit.Kilojoule), KilojoulesTolerance); AssertEx.EqualTolerance(KilowattHoursInOneJoule, joule.As(EnergyUnit.KilowattHour), KilowattHoursTolerance); AssertEx.EqualTolerance(MegajoulesInOneJoule, joule.As(EnergyUnit.Megajoule), MegajoulesTolerance); AssertEx.EqualTolerance(MegawattHoursInOneJoule, joule.As(EnergyUnit.MegawattHour), MegawattHoursTolerance); - AssertEx.EqualTolerance(UsThermsInOneJoule, joule.As(EnergyUnit.UsTherm), UsThermsTolerance); + AssertEx.EqualTolerance(ThermsEcInOneJoule, joule.As(EnergyUnit.ThermEc), ThermsEcTolerance); + AssertEx.EqualTolerance(ThermsImperialInOneJoule, joule.As(EnergyUnit.ThermImperial), ThermsImperialTolerance); + AssertEx.EqualTolerance(ThermsUsInOneJoule, joule.As(EnergyUnit.ThermUs), ThermsUsTolerance); AssertEx.EqualTolerance(WattHoursInOneJoule, joule.As(EnergyUnit.WattHour), WattHoursTolerance); } @@ -174,22 +174,22 @@ 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.FromDecaeuTherms(joule.DecaeuTherms).Joules, DecaeuThermsTolerance); - AssertEx.EqualTolerance(1, Energy.FromDecaimperialTherms(joule.DecaimperialTherms).Joules, DecaimperialThermsTolerance); - AssertEx.EqualTolerance(1, Energy.FromDecausTherms(joule.DecausTherms).Joules, DecausThermsTolerance); + 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.FromEuTherms(joule.EuTherms).Joules, EuThermsTolerance); AssertEx.EqualTolerance(1, Energy.FromFootPounds(joule.FootPounds).Joules, FootPoundsTolerance); AssertEx.EqualTolerance(1, Energy.FromGigawattHours(joule.GigawattHours).Joules, GigawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.FromImperialTherms(joule.ImperialTherms).Joules, ImperialThermsTolerance); AssertEx.EqualTolerance(1, Energy.FromJoules(joule.Joules).Joules, JoulesTolerance); 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.FromMegajoules(joule.Megajoules).Joules, MegajoulesTolerance); AssertEx.EqualTolerance(1, Energy.FromMegawattHours(joule.MegawattHours).Joules, MegawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.FromUsTherms(joule.UsTherms).Joules, UsThermsTolerance); + 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); } diff --git a/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs b/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs index de9fccc541..a92575d9b6 100644 --- a/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs @@ -44,22 +44,22 @@ public enum EnergyUnit Undefined = 0, BritishThermalUnit, Calorie, - DecaeuTherm, - DecaimperialTherm, - DecausTherm, + DecathermEc, + DecathermImperial, + DecathermUs, ElectronVolt, Erg, - EuTherm, FootPound, GigawattHour, - ImperialTherm, Joule, Kilocalorie, Kilojoule, KilowattHour, Megajoule, MegawattHour, - UsTherm, + ThermEc, + ThermImperial, + ThermUs, WattHour, } } diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs index df5661bed9..e4b8134c15 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs @@ -112,105 +112,105 @@ public static class NumberToEnergyExtensions #endregion - #region DecaeuTherm + #region DecathermEc - /// - public static Energy DecaeuTherms(this int value) => Energy.FromDecaeuTherms(value); + /// + public static Energy DecathermsEc(this int value) => Energy.FromDecathermsEc(value); - /// - public static Energy? DecaeuTherms(this int? value) => Energy.FromDecaeuTherms(value); + /// + public static Energy? DecathermsEc(this int? value) => Energy.FromDecathermsEc(value); - /// - public static Energy DecaeuTherms(this long value) => Energy.FromDecaeuTherms(value); + /// + public static Energy DecathermsEc(this long value) => Energy.FromDecathermsEc(value); - /// - public static Energy? DecaeuTherms(this long? value) => Energy.FromDecaeuTherms(value); + /// + public static Energy? DecathermsEc(this long? value) => Energy.FromDecathermsEc(value); - /// - public static Energy DecaeuTherms(this double value) => Energy.FromDecaeuTherms(value); + /// + public static Energy DecathermsEc(this double value) => Energy.FromDecathermsEc(value); - /// - public static Energy? DecaeuTherms(this double? value) => Energy.FromDecaeuTherms(value); + /// + public static Energy? DecathermsEc(this double? value) => Energy.FromDecathermsEc(value); - /// - public static Energy DecaeuTherms(this float value) => Energy.FromDecaeuTherms(value); + /// + public static Energy DecathermsEc(this float value) => Energy.FromDecathermsEc(value); - /// - public static Energy? DecaeuTherms(this float? value) => Energy.FromDecaeuTherms(value); + /// + public static Energy? DecathermsEc(this float? value) => Energy.FromDecathermsEc(value); - /// - public static Energy DecaeuTherms(this decimal value) => Energy.FromDecaeuTherms(Convert.ToDouble(value)); + /// + public static Energy DecathermsEc(this decimal value) => Energy.FromDecathermsEc(Convert.ToDouble(value)); - /// - public static Energy? DecaeuTherms(this decimal? value) => Energy.FromDecaeuTherms(value == null ? (double?)null : Convert.ToDouble(value.Value)); + /// + public static Energy? DecathermsEc(this decimal? value) => Energy.FromDecathermsEc(value == null ? (double?)null : Convert.ToDouble(value.Value)); #endregion - #region DecaimperialTherm + #region DecathermImperial - /// - public static Energy DecaimperialTherms(this int value) => Energy.FromDecaimperialTherms(value); + /// + public static Energy DecathermsImperial(this int value) => Energy.FromDecathermsImperial(value); - /// - public static Energy? DecaimperialTherms(this int? value) => Energy.FromDecaimperialTherms(value); + /// + public static Energy? DecathermsImperial(this int? value) => Energy.FromDecathermsImperial(value); - /// - public static Energy DecaimperialTherms(this long value) => Energy.FromDecaimperialTherms(value); + /// + public static Energy DecathermsImperial(this long value) => Energy.FromDecathermsImperial(value); - /// - public static Energy? DecaimperialTherms(this long? value) => Energy.FromDecaimperialTherms(value); + /// + public static Energy? DecathermsImperial(this long? value) => Energy.FromDecathermsImperial(value); - /// - public static Energy DecaimperialTherms(this double value) => Energy.FromDecaimperialTherms(value); + /// + public static Energy DecathermsImperial(this double value) => Energy.FromDecathermsImperial(value); - /// - public static Energy? DecaimperialTherms(this double? value) => Energy.FromDecaimperialTherms(value); + /// + public static Energy? DecathermsImperial(this double? value) => Energy.FromDecathermsImperial(value); - /// - public static Energy DecaimperialTherms(this float value) => Energy.FromDecaimperialTherms(value); + /// + public static Energy DecathermsImperial(this float value) => Energy.FromDecathermsImperial(value); - /// - public static Energy? DecaimperialTherms(this float? value) => Energy.FromDecaimperialTherms(value); + /// + public static Energy? DecathermsImperial(this float? value) => Energy.FromDecathermsImperial(value); - /// - public static Energy DecaimperialTherms(this decimal value) => Energy.FromDecaimperialTherms(Convert.ToDouble(value)); + /// + public static Energy DecathermsImperial(this decimal value) => Energy.FromDecathermsImperial(Convert.ToDouble(value)); - /// - public static Energy? DecaimperialTherms(this decimal? value) => Energy.FromDecaimperialTherms(value == null ? (double?)null : Convert.ToDouble(value.Value)); + /// + public static Energy? DecathermsImperial(this decimal? value) => Energy.FromDecathermsImperial(value == null ? (double?)null : Convert.ToDouble(value.Value)); #endregion - #region DecausTherm + #region DecathermUs - /// - public static Energy DecausTherms(this int value) => Energy.FromDecausTherms(value); + /// + public static Energy DecathermsUs(this int value) => Energy.FromDecathermsUs(value); - /// - public static Energy? DecausTherms(this int? value) => Energy.FromDecausTherms(value); + /// + public static Energy? DecathermsUs(this int? value) => Energy.FromDecathermsUs(value); - /// - public static Energy DecausTherms(this long value) => Energy.FromDecausTherms(value); + /// + public static Energy DecathermsUs(this long value) => Energy.FromDecathermsUs(value); - /// - public static Energy? DecausTherms(this long? value) => Energy.FromDecausTherms(value); + /// + public static Energy? DecathermsUs(this long? value) => Energy.FromDecathermsUs(value); - /// - public static Energy DecausTherms(this double value) => Energy.FromDecausTherms(value); + /// + public static Energy DecathermsUs(this double value) => Energy.FromDecathermsUs(value); - /// - public static Energy? DecausTherms(this double? value) => Energy.FromDecausTherms(value); + /// + public static Energy? DecathermsUs(this double? value) => Energy.FromDecathermsUs(value); - /// - public static Energy DecausTherms(this float value) => Energy.FromDecausTherms(value); + /// + public static Energy DecathermsUs(this float value) => Energy.FromDecathermsUs(value); - /// - public static Energy? DecausTherms(this float? value) => Energy.FromDecausTherms(value); + /// + public static Energy? DecathermsUs(this float? value) => Energy.FromDecathermsUs(value); - /// - public static Energy DecausTherms(this decimal value) => Energy.FromDecausTherms(Convert.ToDouble(value)); + /// + public static Energy DecathermsUs(this decimal value) => Energy.FromDecathermsUs(Convert.ToDouble(value)); - /// - public static Energy? DecausTherms(this decimal? value) => Energy.FromDecausTherms(value == null ? (double?)null : Convert.ToDouble(value.Value)); + /// + public static Energy? DecathermsUs(this decimal? value) => Energy.FromDecathermsUs(value == null ? (double?)null : Convert.ToDouble(value.Value)); #endregion @@ -282,40 +282,6 @@ public static class NumberToEnergyExtensions #endregion - #region EuTherm - - /// - public static Energy EuTherms(this int value) => Energy.FromEuTherms(value); - - /// - public static Energy? EuTherms(this int? value) => Energy.FromEuTherms(value); - - /// - public static Energy EuTherms(this long value) => Energy.FromEuTherms(value); - - /// - public static Energy? EuTherms(this long? value) => Energy.FromEuTherms(value); - - /// - public static Energy EuTherms(this double value) => Energy.FromEuTherms(value); - - /// - public static Energy? EuTherms(this double? value) => Energy.FromEuTherms(value); - - /// - public static Energy EuTherms(this float value) => Energy.FromEuTherms(value); - - /// - public static Energy? EuTherms(this float? value) => Energy.FromEuTherms(value); - - /// - public static Energy EuTherms(this decimal value) => Energy.FromEuTherms(Convert.ToDouble(value)); - - /// - public static Energy? EuTherms(this decimal? value) => Energy.FromEuTherms(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region FootPound /// @@ -384,40 +350,6 @@ public static class NumberToEnergyExtensions #endregion - #region ImperialTherm - - /// - public static Energy ImperialTherms(this int value) => Energy.FromImperialTherms(value); - - /// - public static Energy? ImperialTherms(this int? value) => Energy.FromImperialTherms(value); - - /// - public static Energy ImperialTherms(this long value) => Energy.FromImperialTherms(value); - - /// - public static Energy? ImperialTherms(this long? value) => Energy.FromImperialTherms(value); - - /// - public static Energy ImperialTherms(this double value) => Energy.FromImperialTherms(value); - - /// - public static Energy? ImperialTherms(this double? value) => Energy.FromImperialTherms(value); - - /// - public static Energy ImperialTherms(this float value) => Energy.FromImperialTherms(value); - - /// - public static Energy? ImperialTherms(this float? value) => Energy.FromImperialTherms(value); - - /// - public static Energy ImperialTherms(this decimal value) => Energy.FromImperialTherms(Convert.ToDouble(value)); - - /// - public static Energy? ImperialTherms(this decimal? value) => Energy.FromImperialTherms(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region Joule /// @@ -622,37 +554,105 @@ public static class NumberToEnergyExtensions #endregion - #region UsTherm + #region ThermEc + + /// + public static Energy ThermsEc(this int value) => Energy.FromThermsEc(value); + + /// + public static Energy? ThermsEc(this int? value) => Energy.FromThermsEc(value); + + /// + public static Energy ThermsEc(this long value) => Energy.FromThermsEc(value); + + /// + public static Energy? ThermsEc(this long? value) => Energy.FromThermsEc(value); + + /// + public static Energy ThermsEc(this double value) => Energy.FromThermsEc(value); + + /// + public static Energy? ThermsEc(this double? value) => Energy.FromThermsEc(value); + + /// + public static Energy ThermsEc(this float value) => Energy.FromThermsEc(value); + + /// + public static Energy? ThermsEc(this float? value) => Energy.FromThermsEc(value); + + /// + public static Energy ThermsEc(this decimal value) => Energy.FromThermsEc(Convert.ToDouble(value)); + + /// + public static Energy? ThermsEc(this decimal? value) => Energy.FromThermsEc(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + + #region ThermImperial + + /// + public static Energy ThermsImperial(this int value) => Energy.FromThermsImperial(value); + + /// + public static Energy? ThermsImperial(this int? value) => Energy.FromThermsImperial(value); + + /// + public static Energy ThermsImperial(this long value) => Energy.FromThermsImperial(value); + + /// + public static Energy? ThermsImperial(this long? value) => Energy.FromThermsImperial(value); + + /// + public static Energy ThermsImperial(this double value) => Energy.FromThermsImperial(value); + + /// + public static Energy? ThermsImperial(this double? value) => Energy.FromThermsImperial(value); + + /// + public static Energy ThermsImperial(this float value) => Energy.FromThermsImperial(value); + + /// + public static Energy? ThermsImperial(this float? value) => Energy.FromThermsImperial(value); + + /// + public static Energy ThermsImperial(this decimal value) => Energy.FromThermsImperial(Convert.ToDouble(value)); + + /// + public static Energy? ThermsImperial(this decimal? value) => Energy.FromThermsImperial(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + + #region ThermUs - /// - public static Energy UsTherms(this int value) => Energy.FromUsTherms(value); + /// + public static Energy ThermsUs(this int value) => Energy.FromThermsUs(value); - /// - public static Energy? UsTherms(this int? value) => Energy.FromUsTherms(value); + /// + public static Energy? ThermsUs(this int? value) => Energy.FromThermsUs(value); - /// - public static Energy UsTherms(this long value) => Energy.FromUsTherms(value); + /// + public static Energy ThermsUs(this long value) => Energy.FromThermsUs(value); - /// - public static Energy? UsTherms(this long? value) => Energy.FromUsTherms(value); + /// + public static Energy? ThermsUs(this long? value) => Energy.FromThermsUs(value); - /// - public static Energy UsTherms(this double value) => Energy.FromUsTherms(value); + /// + public static Energy ThermsUs(this double value) => Energy.FromThermsUs(value); - /// - public static Energy? UsTherms(this double? value) => Energy.FromUsTherms(value); + /// + public static Energy? ThermsUs(this double? value) => Energy.FromThermsUs(value); - /// - public static Energy UsTherms(this float value) => Energy.FromUsTherms(value); + /// + public static Energy ThermsUs(this float value) => Energy.FromThermsUs(value); - /// - public static Energy? UsTherms(this float? value) => Energy.FromUsTherms(value); + /// + public static Energy? ThermsUs(this float? value) => Energy.FromThermsUs(value); - /// - public static Energy UsTherms(this decimal value) => Energy.FromUsTherms(Convert.ToDouble(value)); + /// + public static Energy ThermsUs(this decimal value) => Energy.FromThermsUs(Convert.ToDouble(value)); - /// - public static Energy? UsTherms(this decimal? value) => Energy.FromUsTherms(value == null ? (double?)null : Convert.ToDouble(value.Value)); + /// + public static Energy? ThermsUs(this decimal? value) => Energy.FromThermsUs(value == null ? (double?)null : Convert.ToDouble(value.Value)); #endregion diff --git a/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs index 6c584b9377..920a9c8381 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs @@ -146,25 +146,25 @@ public double Calories } /// - /// Get Energy in DecaeuTherms. + /// Get Energy in DecathermsEc. /// - public double DecaeuTherms + public double DecathermsEc { get { return (_joules/1.05506e+8) / 1e1d; } } /// - /// Get Energy in DecaimperialTherms. + /// Get Energy in DecathermsImperial. /// - public double DecaimperialTherms + public double DecathermsImperial { get { return (_joules/1.05505585257348e+14) / 1e1d; } } /// - /// Get Energy in DecausTherms. + /// Get Energy in DecathermsUs. /// - public double DecausTherms + public double DecathermsUs { get { return (_joules/1.054804e+8) / 1e1d; } } @@ -185,14 +185,6 @@ public double Ergs get { return _joules/1e-7; } } - /// - /// Get Energy in EuTherms. - /// - public double EuTherms - { - get { return _joules/1.05506e+8; } - } - /// /// Get Energy in FootPounds. /// @@ -209,14 +201,6 @@ public double GigawattHours get { return (_joules/3600d) / 1e9d; } } - /// - /// Get Energy in ImperialTherms. - /// - public double ImperialTherms - { - get { return _joules/1.05505585257348e+14; } - } - /// /// Get Energy in Joules. /// @@ -266,9 +250,25 @@ public double MegawattHours } /// - /// Get Energy in UsTherms. + /// Get Energy in ThermsEc. + /// + public double ThermsEc + { + get { return _joules/1.05506e+8; } + } + + /// + /// Get Energy in ThermsImperial. + /// + public double ThermsImperial + { + get { return _joules/1.05505585257348e+14; } + } + + /// + /// Get Energy in ThermsUs. /// - public double UsTherms + public double ThermsUs { get { return _joules/1.054804e+8; } } @@ -307,27 +307,27 @@ public static Energy FromCalories(double calories) } /// - /// Get Energy from DecaeuTherms. + /// Get Energy from DecathermsEc. /// - public static Energy FromDecaeuTherms(double decaeutherms) + public static Energy FromDecathermsEc(double decathermsec) { - return new Energy((decaeutherms*1.05506e+8) * 1e1d); + return new Energy((decathermsec*1.05506e+8) * 1e1d); } /// - /// Get Energy from DecaimperialTherms. + /// Get Energy from DecathermsImperial. /// - public static Energy FromDecaimperialTherms(double decaimperialtherms) + public static Energy FromDecathermsImperial(double decathermsimperial) { - return new Energy((decaimperialtherms*1.05505585257348e+14) * 1e1d); + return new Energy((decathermsimperial*1.05505585257348e+14) * 1e1d); } /// - /// Get Energy from DecausTherms. + /// Get Energy from DecathermsUs. /// - public static Energy FromDecausTherms(double decaustherms) + public static Energy FromDecathermsUs(double decathermsus) { - return new Energy((decaustherms*1.054804e+8) * 1e1d); + return new Energy((decathermsus*1.054804e+8) * 1e1d); } /// @@ -346,14 +346,6 @@ public static Energy FromErgs(double ergs) return new Energy(ergs*1e-7); } - /// - /// Get Energy from EuTherms. - /// - public static Energy FromEuTherms(double eutherms) - { - return new Energy(eutherms*1.05506e+8); - } - /// /// Get Energy from FootPounds. /// @@ -370,14 +362,6 @@ public static Energy FromGigawattHours(double gigawatthours) return new Energy((gigawatthours*3600d) * 1e9d); } - /// - /// Get Energy from ImperialTherms. - /// - public static Energy FromImperialTherms(double imperialtherms) - { - return new Energy(imperialtherms*1.05505585257348e+14); - } - /// /// Get Energy from Joules. /// @@ -427,11 +411,27 @@ public static Energy FromMegawattHours(double megawatthours) } /// - /// Get Energy from UsTherms. + /// Get Energy from ThermsEc. + /// + public static Energy FromThermsEc(double thermsec) + { + return new Energy(thermsec*1.05506e+8); + } + + /// + /// Get Energy from ThermsImperial. + /// + public static Energy FromThermsImperial(double thermsimperial) + { + return new Energy(thermsimperial*1.05505585257348e+14); + } + + /// + /// Get Energy from ThermsUs. /// - public static Energy FromUsTherms(double ustherms) + public static Energy FromThermsUs(double thermsus) { - return new Energy(ustherms*1.054804e+8); + return new Energy(thermsus*1.054804e+8); } /// @@ -475,13 +475,13 @@ public static Energy FromWattHours(double watthours) } /// - /// Get nullable Energy from nullable DecaeuTherms. + /// Get nullable Energy from nullable DecathermsEc. /// - public static Energy? FromDecaeuTherms(double? decaeutherms) + public static Energy? FromDecathermsEc(double? decathermsec) { - if (decaeutherms.HasValue) + if (decathermsec.HasValue) { - return FromDecaeuTherms(decaeutherms.Value); + return FromDecathermsEc(decathermsec.Value); } else { @@ -490,13 +490,13 @@ public static Energy FromWattHours(double watthours) } /// - /// Get nullable Energy from nullable DecaimperialTherms. + /// Get nullable Energy from nullable DecathermsImperial. /// - public static Energy? FromDecaimperialTherms(double? decaimperialtherms) + public static Energy? FromDecathermsImperial(double? decathermsimperial) { - if (decaimperialtherms.HasValue) + if (decathermsimperial.HasValue) { - return FromDecaimperialTherms(decaimperialtherms.Value); + return FromDecathermsImperial(decathermsimperial.Value); } else { @@ -505,13 +505,13 @@ public static Energy FromWattHours(double watthours) } /// - /// Get nullable Energy from nullable DecausTherms. + /// Get nullable Energy from nullable DecathermsUs. /// - public static Energy? FromDecausTherms(double? decaustherms) + public static Energy? FromDecathermsUs(double? decathermsus) { - if (decaustherms.HasValue) + if (decathermsus.HasValue) { - return FromDecausTherms(decaustherms.Value); + return FromDecathermsUs(decathermsus.Value); } else { @@ -549,21 +549,6 @@ public static Energy FromWattHours(double watthours) } } - /// - /// Get nullable Energy from nullable EuTherms. - /// - public static Energy? FromEuTherms(double? eutherms) - { - if (eutherms.HasValue) - { - return FromEuTherms(eutherms.Value); - } - else - { - return null; - } - } - /// /// Get nullable Energy from nullable FootPounds. /// @@ -594,21 +579,6 @@ public static Energy FromWattHours(double watthours) } } - /// - /// Get nullable Energy from nullable ImperialTherms. - /// - public static Energy? FromImperialTherms(double? imperialtherms) - { - if (imperialtherms.HasValue) - { - return FromImperialTherms(imperialtherms.Value); - } - else - { - return null; - } - } - /// /// Get nullable Energy from nullable Joules. /// @@ -700,13 +670,43 @@ public static Energy FromWattHours(double watthours) } /// - /// Get nullable Energy from nullable UsTherms. + /// Get nullable Energy from nullable ThermsEc. + /// + public static Energy? FromThermsEc(double? thermsec) + { + if (thermsec.HasValue) + { + return FromThermsEc(thermsec.Value); + } + else + { + return null; + } + } + + /// + /// Get nullable Energy from nullable ThermsImperial. + /// + public static Energy? FromThermsImperial(double? thermsimperial) + { + if (thermsimperial.HasValue) + { + return FromThermsImperial(thermsimperial.Value); + } + else + { + return null; + } + } + + /// + /// Get nullable Energy from nullable ThermsUs. /// - public static Energy? FromUsTherms(double? ustherms) + public static Energy? FromThermsUs(double? thermsus) { - if (ustherms.HasValue) + if (thermsus.HasValue) { - return FromUsTherms(ustherms.Value); + return FromThermsUs(thermsus.Value); } else { @@ -745,24 +745,20 @@ public static Energy From(double val, EnergyUnit fromUnit) return FromBritishThermalUnits(val); case EnergyUnit.Calorie: return FromCalories(val); - case EnergyUnit.DecaeuTherm: - return FromDecaeuTherms(val); - case EnergyUnit.DecaimperialTherm: - return FromDecaimperialTherms(val); - case EnergyUnit.DecausTherm: - return FromDecausTherms(val); + case EnergyUnit.DecathermEc: + return FromDecathermsEc(val); + case EnergyUnit.DecathermImperial: + return FromDecathermsImperial(val); + case EnergyUnit.DecathermUs: + return FromDecathermsUs(val); case EnergyUnit.ElectronVolt: return FromElectronVolts(val); case EnergyUnit.Erg: return FromErgs(val); - case EnergyUnit.EuTherm: - return FromEuTherms(val); case EnergyUnit.FootPound: return FromFootPounds(val); case EnergyUnit.GigawattHour: return FromGigawattHours(val); - case EnergyUnit.ImperialTherm: - return FromImperialTherms(val); case EnergyUnit.Joule: return FromJoules(val); case EnergyUnit.Kilocalorie: @@ -775,8 +771,12 @@ public static Energy From(double val, EnergyUnit fromUnit) return FromMegajoules(val); case EnergyUnit.MegawattHour: return FromMegawattHours(val); - case EnergyUnit.UsTherm: - return FromUsTherms(val); + case EnergyUnit.ThermEc: + return FromThermsEc(val); + case EnergyUnit.ThermImperial: + return FromThermsImperial(val); + case EnergyUnit.ThermUs: + return FromThermsUs(val); case EnergyUnit.WattHour: return FromWattHours(val); @@ -805,24 +805,20 @@ public static Energy From(double val, EnergyUnit fromUnit) return FromBritishThermalUnits(value.Value); case EnergyUnit.Calorie: return FromCalories(value.Value); - case EnergyUnit.DecaeuTherm: - return FromDecaeuTherms(value.Value); - case EnergyUnit.DecaimperialTherm: - return FromDecaimperialTherms(value.Value); - case EnergyUnit.DecausTherm: - return FromDecausTherms(value.Value); + case EnergyUnit.DecathermEc: + return FromDecathermsEc(value.Value); + case EnergyUnit.DecathermImperial: + return FromDecathermsImperial(value.Value); + case EnergyUnit.DecathermUs: + return FromDecathermsUs(value.Value); case EnergyUnit.ElectronVolt: return FromElectronVolts(value.Value); case EnergyUnit.Erg: return FromErgs(value.Value); - case EnergyUnit.EuTherm: - return FromEuTherms(value.Value); case EnergyUnit.FootPound: return FromFootPounds(value.Value); case EnergyUnit.GigawattHour: return FromGigawattHours(value.Value); - case EnergyUnit.ImperialTherm: - return FromImperialTherms(value.Value); case EnergyUnit.Joule: return FromJoules(value.Value); case EnergyUnit.Kilocalorie: @@ -835,8 +831,12 @@ public static Energy From(double val, EnergyUnit fromUnit) return FromMegajoules(value.Value); case EnergyUnit.MegawattHour: return FromMegawattHours(value.Value); - case EnergyUnit.UsTherm: - return FromUsTherms(value.Value); + case EnergyUnit.ThermEc: + return FromThermsEc(value.Value); + case EnergyUnit.ThermImperial: + return FromThermsImperial(value.Value); + case EnergyUnit.ThermUs: + return FromThermsUs(value.Value); case EnergyUnit.WattHour: return FromWattHours(value.Value); @@ -1000,24 +1000,20 @@ public double As(EnergyUnit unit) return BritishThermalUnits; case EnergyUnit.Calorie: return Calories; - case EnergyUnit.DecaeuTherm: - return DecaeuTherms; - case EnergyUnit.DecaimperialTherm: - return DecaimperialTherms; - case EnergyUnit.DecausTherm: - return DecausTherms; + case EnergyUnit.DecathermEc: + return DecathermsEc; + case EnergyUnit.DecathermImperial: + return DecathermsImperial; + case EnergyUnit.DecathermUs: + return DecathermsUs; case EnergyUnit.ElectronVolt: return ElectronVolts; case EnergyUnit.Erg: return Ergs; - case EnergyUnit.EuTherm: - return EuTherms; case EnergyUnit.FootPound: return FootPounds; case EnergyUnit.GigawattHour: return GigawattHours; - case EnergyUnit.ImperialTherm: - return ImperialTherms; case EnergyUnit.Joule: return Joules; case EnergyUnit.Kilocalorie: @@ -1030,8 +1026,12 @@ public double As(EnergyUnit unit) return Megajoules; case EnergyUnit.MegawattHour: return MegawattHours; - case EnergyUnit.UsTherm: - return UsTherms; + case EnergyUnit.ThermEc: + return ThermsEc; + case EnergyUnit.ThermImperial: + return ThermsImperial; + case EnergyUnit.ThermUs: + return ThermsUs; case EnergyUnit.WattHour: return WattHours; diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index e1ea8896ce..3cce9dd493 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -806,23 +806,23 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "cal"), }), - new CulturesForEnumValue((int) EnergyUnit.DecaeuTherm, + new CulturesForEnumValue((int) EnergyUnit.DecathermEc, new[] { - new AbbreviationsForCulture("en-US", "dathm (E.U.)"), - new AbbreviationsForCulture("ru-RU", "daЕвропейский терм"), + new AbbreviationsForCulture("en-US", "Dth (E.C.)"), + new AbbreviationsForCulture("ru-RU", ""), }), - new CulturesForEnumValue((int) EnergyUnit.DecaimperialTherm, + new CulturesForEnumValue((int) EnergyUnit.DecathermImperial, new[] { - new AbbreviationsForCulture("en-US", "dathm (imp.)"), - new AbbreviationsForCulture("ru-RU", "daАнглийский терм"), + new AbbreviationsForCulture("en-US", "Dth (imp.)"), + new AbbreviationsForCulture("ru-RU", ""), }), - new CulturesForEnumValue((int) EnergyUnit.DecausTherm, + new CulturesForEnumValue((int) EnergyUnit.DecathermUs, new[] { - new AbbreviationsForCulture("en-US", "dathm (U.S.)"), - new AbbreviationsForCulture("ru-RU", "daАмериканский терм"), + new AbbreviationsForCulture("en-US", "Dth (U.S.)"), + new AbbreviationsForCulture("ru-RU", ""), }), new CulturesForEnumValue((int) EnergyUnit.ElectronVolt, new[] @@ -834,12 +834,6 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "erg"), }), - new CulturesForEnumValue((int) EnergyUnit.EuTherm, - new[] - { - new AbbreviationsForCulture("en-US", "thm (E.U.)"), - new AbbreviationsForCulture("ru-RU", "Европейский терм"), - }), new CulturesForEnumValue((int) EnergyUnit.FootPound, new[] { @@ -850,12 +844,6 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "GWh"), }), - new CulturesForEnumValue((int) EnergyUnit.ImperialTherm, - new[] - { - new AbbreviationsForCulture("en-US", "thm (imp.)"), - new AbbreviationsForCulture("ru-RU", "Английский терм"), - }), new CulturesForEnumValue((int) EnergyUnit.Joule, new[] { @@ -886,10 +874,22 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "MWh"), }), - new CulturesForEnumValue((int) EnergyUnit.UsTherm, + new CulturesForEnumValue((int) EnergyUnit.ThermEc, + new[] + { + new AbbreviationsForCulture("en-US", "th (E.C.)"), + new AbbreviationsForCulture("ru-RU", "Европейский терм"), + }), + new CulturesForEnumValue((int) EnergyUnit.ThermImperial, + new[] + { + new AbbreviationsForCulture("en-US", "th (imp.)"), + new AbbreviationsForCulture("ru-RU", "Английский терм"), + }), + new CulturesForEnumValue((int) EnergyUnit.ThermUs, new[] { - new AbbreviationsForCulture("en-US", "thm (U.S.)"), + new AbbreviationsForCulture("en-US", "th (U.S.)"), new AbbreviationsForCulture("ru-RU", "Американский терм"), }), new CulturesForEnumValue((int) EnergyUnit.WattHour, diff --git a/UnitsNet/UnitDefinitions/Energy.json b/UnitsNet/UnitDefinitions/Energy.json index fde3651c79..65f51eab09 100644 --- a/UnitsNet/UnitDefinitions/Energy.json +++ b/UnitsNet/UnitDefinitions/Energy.json @@ -91,53 +91,59 @@ ] }, { - "SingularName": "EuTherm", - "PluralName": "EuTherms", + "SingularName": "ThermEc", + "PluralName": "ThermsEc", "FromUnitToBaseFunc": "x*1.05506e+8", "FromBaseToUnitFunc": "x/1.05506e+8", "Prefixes": [ "Deca" ], "Localization": [ { "Culture": "en-US", - "Abbreviations": [ "thm (E.U.)" ] + "Abbreviations": [ "th (E.C.)" ], + "AbbreviationsWithPrefixes": [ "Dth (E.C.)" ] }, { "Culture": "ru-RU", - "Abbreviations": [ "Европейский терм" ] + "Abbreviations": [ "Европейский терм" ], + "AbbreviationsWithPrefixes": [ "Европейский декатерм" ] } ] }, { - "SingularName": "UsTherm", - "PluralName": "UsTherms", + "SingularName": "ThermUs", + "PluralName": "ThermsUs", "FromUnitToBaseFunc": "x*1.054804e+8", "FromBaseToUnitFunc": "x/1.054804e+8", "Prefixes": [ "Deca" ], "Localization": [ { "Culture": "en-US", - "Abbreviations": [ "thm (U.S.)" ] + "Abbreviations": [ "th (U.S.)" ], + "AbbreviationsWithPrefixes": [ "Dth (U.S.)" ] }, { "Culture": "ru-RU", - "Abbreviations": [ "Американский терм" ] + "Abbreviations": [ "Американский терм" ], + "AbbreviationsWithPrefixes": [ "Американский декатерм" ] } ] }, { - "SingularName": "ImperialTherm", - "PluralName": "ImperialTherms", + "SingularName": "ThermImperial", + "PluralName": "ThermsImperial", "FromUnitToBaseFunc": "x*1.05505585257348e+14", "FromBaseToUnitFunc": "x/1.05505585257348e+14", "Prefixes": [ "Deca" ], "Localization": [ { "Culture": "en-US", - "Abbreviations": [ "thm (imp.)" ] + "Abbreviations": [ "th (imp.)" ], + "AbbreviationsWithPrefixes": [ "Dth (imp.)" ] }, { "Culture": "ru-RU", - "Abbreviations": [ "Английский терм" ] + "Abbreviations": [ "Английский терм" ], + "AbbreviationsWithPrefixes": [ "Английский декатерм" ] } ] } From 6eb66885bff55354dcf319b39f7b8766882f8344 Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Mon, 25 Sep 2017 16:10:03 +0300 Subject: [PATCH 08/19] Add 'TonPerHour' unit and tests --- UnitsNet.Tests/CustomCode/MassFlowTests.cs | 1 + .../GeneratedCode/MassFlowTestsBase.g.cs | 6 +++ .../GeneratedCode/Enums/MassFlowUnit.g.cs | 1 + .../Number/NumberToMassFlowExtensions.g.cs | 34 +++++++++++++++++ .../GeneratedCode/UnitClasses/MassFlow.g.cs | 37 +++++++++++++++++++ .../GeneratedCode/UnitSystem.Default.g.cs | 9 ++++- UnitsNet/UnitDefinitions/MassFlow.json | 14 ++++++- 7 files changed, 99 insertions(+), 3 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/MassFlowTests.cs b/UnitsNet.Tests/CustomCode/MassFlowTests.cs index eb91b9e15b..2ca3d46778 100644 --- a/UnitsNet.Tests/CustomCode/MassFlowTests.cs +++ b/UnitsNet.Tests/CustomCode/MassFlowTests.cs @@ -46,6 +46,7 @@ public class MassFlowTests : MassFlowTestsBase protected override double NanogramsPerSecondInOneGramPerSecond => 1E9; + protected override double ShortTonsPerHourInOneGramPerSecond => 3.96832e-3; protected override double TonnesPerDayInOneGramPerSecond => 60.0*60*24/1E6; protected override double PoundsPerHourInOneGramPerSecond => 7.93664; diff --git a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs index 6fb0cc5c26..a13052996c 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs @@ -63,6 +63,7 @@ public abstract partial class MassFlowTestsBase protected abstract double MilligramsPerSecondInOneGramPerSecond { get; } protected abstract double NanogramsPerSecondInOneGramPerSecond { get; } protected abstract double PoundsPerHourInOneGramPerSecond { get; } + protected abstract double ShortTonsPerHourInOneGramPerSecond { get; } protected abstract double TonnesPerDayInOneGramPerSecond { get; } // ReSharper disable VirtualMemberNeverOverriden.Global @@ -77,6 +78,7 @@ public abstract partial class MassFlowTestsBase protected virtual double MilligramsPerSecondTolerance { get { return 1e-5; } } protected virtual double NanogramsPerSecondTolerance { get { return 1e-5; } } protected virtual double PoundsPerHourTolerance { get { return 1e-5; } } + protected virtual double ShortTonsPerHourTolerance { get { return 1e-5; } } protected virtual double TonnesPerDayTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global @@ -95,6 +97,7 @@ public void GramPerSecondToMassFlowUnits() AssertEx.EqualTolerance(MilligramsPerSecondInOneGramPerSecond, grampersecond.MilligramsPerSecond, MilligramsPerSecondTolerance); AssertEx.EqualTolerance(NanogramsPerSecondInOneGramPerSecond, grampersecond.NanogramsPerSecond, NanogramsPerSecondTolerance); AssertEx.EqualTolerance(PoundsPerHourInOneGramPerSecond, grampersecond.PoundsPerHour, PoundsPerHourTolerance); + AssertEx.EqualTolerance(ShortTonsPerHourInOneGramPerSecond, grampersecond.ShortTonsPerHour, ShortTonsPerHourTolerance); AssertEx.EqualTolerance(TonnesPerDayInOneGramPerSecond, grampersecond.TonnesPerDay, TonnesPerDayTolerance); } @@ -112,6 +115,7 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MilligramPerSecond).MilligramsPerSecond, MilligramsPerSecondTolerance); AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.NanogramPerSecond).NanogramsPerSecond, NanogramsPerSecondTolerance); AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.PoundPerHour).PoundsPerHour, PoundsPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.ShortTonPerHour).ShortTonsPerHour, ShortTonsPerHourTolerance); AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.TonnePerDay).TonnesPerDay, TonnesPerDayTolerance); } @@ -130,6 +134,7 @@ public void As() AssertEx.EqualTolerance(MilligramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.MilligramPerSecond), MilligramsPerSecondTolerance); AssertEx.EqualTolerance(NanogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.NanogramPerSecond), NanogramsPerSecondTolerance); AssertEx.EqualTolerance(PoundsPerHourInOneGramPerSecond, grampersecond.As(MassFlowUnit.PoundPerHour), PoundsPerHourTolerance); + AssertEx.EqualTolerance(ShortTonsPerHourInOneGramPerSecond, grampersecond.As(MassFlowUnit.ShortTonPerHour), ShortTonsPerHourTolerance); AssertEx.EqualTolerance(TonnesPerDayInOneGramPerSecond, grampersecond.As(MassFlowUnit.TonnePerDay), TonnesPerDayTolerance); } @@ -148,6 +153,7 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, MassFlow.FromMilligramsPerSecond(grampersecond.MilligramsPerSecond).GramsPerSecond, MilligramsPerSecondTolerance); AssertEx.EqualTolerance(1, MassFlow.FromNanogramsPerSecond(grampersecond.NanogramsPerSecond).GramsPerSecond, NanogramsPerSecondTolerance); AssertEx.EqualTolerance(1, MassFlow.FromPoundsPerHour(grampersecond.PoundsPerHour).GramsPerSecond, PoundsPerHourTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromShortTonsPerHour(grampersecond.ShortTonsPerHour).GramsPerSecond, ShortTonsPerHourTolerance); AssertEx.EqualTolerance(1, MassFlow.FromTonnesPerDay(grampersecond.TonnesPerDay).GramsPerSecond, TonnesPerDayTolerance); } diff --git a/UnitsNet/GeneratedCode/Enums/MassFlowUnit.g.cs b/UnitsNet/GeneratedCode/Enums/MassFlowUnit.g.cs index ac0616ab55..c9f9b6f0b7 100644 --- a/UnitsNet/GeneratedCode/Enums/MassFlowUnit.g.cs +++ b/UnitsNet/GeneratedCode/Enums/MassFlowUnit.g.cs @@ -53,6 +53,7 @@ public enum MassFlowUnit MilligramPerSecond, NanogramPerSecond, PoundPerHour, + ShortTonPerHour, TonnePerDay, } } diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs index 23d0ba273f..b88ae691aa 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs @@ -418,6 +418,40 @@ public static class NumberToMassFlowExtensions #endregion + #region ShortTonPerHour + + /// + public static MassFlow ShortTonsPerHour(this int value) => MassFlow.FromShortTonsPerHour(value); + + /// + public static MassFlow? ShortTonsPerHour(this int? value) => MassFlow.FromShortTonsPerHour(value); + + /// + public static MassFlow ShortTonsPerHour(this long value) => MassFlow.FromShortTonsPerHour(value); + + /// + public static MassFlow? ShortTonsPerHour(this long? value) => MassFlow.FromShortTonsPerHour(value); + + /// + public static MassFlow ShortTonsPerHour(this double value) => MassFlow.FromShortTonsPerHour(value); + + /// + public static MassFlow? ShortTonsPerHour(this double? value) => MassFlow.FromShortTonsPerHour(value); + + /// + public static MassFlow ShortTonsPerHour(this float value) => MassFlow.FromShortTonsPerHour(value); + + /// + public static MassFlow? ShortTonsPerHour(this float? value) => MassFlow.FromShortTonsPerHour(value); + + /// + public static MassFlow ShortTonsPerHour(this decimal value) => MassFlow.FromShortTonsPerHour(Convert.ToDouble(value)); + + /// + public static MassFlow? ShortTonsPerHour(this decimal? value) => MassFlow.FromShortTonsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region TonnePerDay /// diff --git a/UnitsNet/GeneratedCode/UnitClasses/MassFlow.g.cs b/UnitsNet/GeneratedCode/UnitClasses/MassFlow.g.cs index 856633dfee..2288552ba6 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/MassFlow.g.cs @@ -217,6 +217,14 @@ public double PoundsPerHour get { return _gramsPerSecond*7.93664; } } + /// + /// Get MassFlow in ShortTonsPerHour. + /// + public double ShortTonsPerHour + { + get { return _gramsPerSecond/251.9957611; } + } + /// /// Get MassFlow in TonnesPerDay. /// @@ -322,6 +330,14 @@ public static MassFlow FromPoundsPerHour(double poundsperhour) return new MassFlow(poundsperhour/7.93664); } + /// + /// Get MassFlow from ShortTonsPerHour. + /// + public static MassFlow FromShortTonsPerHour(double shorttonsperhour) + { + return new MassFlow(shorttonsperhour*251.9957611); + } + /// /// Get MassFlow from TonnesPerDay. /// @@ -497,6 +513,21 @@ public static MassFlow FromTonnesPerDay(double tonnesperday) } } + /// + /// Get nullable MassFlow from nullable ShortTonsPerHour. + /// + public static MassFlow? FromShortTonsPerHour(double? shorttonsperhour) + { + if (shorttonsperhour.HasValue) + { + return FromShortTonsPerHour(shorttonsperhour.Value); + } + else + { + return null; + } + } + /// /// Get nullable MassFlow from nullable TonnesPerDay. /// @@ -546,6 +577,8 @@ public static MassFlow From(double val, MassFlowUnit fromUnit) return FromNanogramsPerSecond(val); case MassFlowUnit.PoundPerHour: return FromPoundsPerHour(val); + case MassFlowUnit.ShortTonPerHour: + return FromShortTonsPerHour(val); case MassFlowUnit.TonnePerDay: return FromTonnesPerDay(val); @@ -592,6 +625,8 @@ public static MassFlow From(double val, MassFlowUnit fromUnit) return FromNanogramsPerSecond(value.Value); case MassFlowUnit.PoundPerHour: return FromPoundsPerHour(value.Value); + case MassFlowUnit.ShortTonPerHour: + return FromShortTonsPerHour(value.Value); case MassFlowUnit.TonnePerDay: return FromTonnesPerDay(value.Value); @@ -773,6 +808,8 @@ public double As(MassFlowUnit unit) return NanogramsPerSecond; case MassFlowUnit.PoundPerHour: return PoundsPerHour; + case MassFlowUnit.ShortTonPerHour: + return ShortTonsPerHour; case MassFlowUnit.TonnePerDay: return TonnesPerDay; diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index 5d9045a98d..fb02cd98dc 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -1551,7 +1551,7 @@ private static readonly ReadOnlyCollection DefaultLocalization new CulturesForEnumValue((int) MassUnit.Kilopound, new[] { - new AbbreviationsForCulture("en-US", "klb"), + new AbbreviationsForCulture("en-US", "KLbs"), new AbbreviationsForCulture("ru-RU", "kфунт"), }), new CulturesForEnumValue((int) MassUnit.Kilotonne, @@ -1574,7 +1574,7 @@ private static readonly ReadOnlyCollection DefaultLocalization new CulturesForEnumValue((int) MassUnit.Megapound, new[] { - new AbbreviationsForCulture("en-US", "Mlb"), + new AbbreviationsForCulture("en-US", "MLbs"), new AbbreviationsForCulture("ru-RU", "Mфунт"), }), new CulturesForEnumValue((int) MassUnit.Megatonne, @@ -1694,6 +1694,11 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "lb/h"), }), + new CulturesForEnumValue((int) MassFlowUnit.ShortTonPerHour, + new[] + { + new AbbreviationsForCulture("en-US", "short tn/h"), + }), new CulturesForEnumValue((int) MassFlowUnit.TonnePerDay, new[] { diff --git a/UnitsNet/UnitDefinitions/MassFlow.json b/UnitsNet/UnitDefinitions/MassFlow.json index cbd32844b2..f896c895dc 100644 --- a/UnitsNet/UnitDefinitions/MassFlow.json +++ b/UnitsNet/UnitDefinitions/MassFlow.json @@ -32,7 +32,7 @@ } ] }, - { + { "SingularName": "PoundPerHour", "PluralName": "PoundsPerHour", "FromUnitToBaseFunc": "x/7.93664", @@ -55,6 +55,18 @@ "Abbreviations": [ "t/d" ] } ] + }, + { + "SingularName": "ShortTonPerHour", + "PluralName": "ShortTonsPerHour", + "FromUnitToBaseFunc": "x*251.9957611", + "FromBaseToUnitFunc": "x/251.9957611", + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "short tn/h" ] + } + ] } ] } \ No newline at end of file From 5e0903b1b061ab2746e3c56e4eaa1951bdfe7f61 Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Thu, 28 Sep 2017 12:40:49 +0300 Subject: [PATCH 09/19] Update for ThermsEC --- UnitsNet.Tests/CustomCode/EnergyTests.cs | 2 +- UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs | 8 ++++---- UnitsNet/UnitDefinitions/Energy.json | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/EnergyTests.cs b/UnitsNet.Tests/CustomCode/EnergyTests.cs index 1a898d1c2a..98ac21b49f 100644 --- a/UnitsNet.Tests/CustomCode/EnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/EnergyTests.cs @@ -50,7 +50,7 @@ public class EnergyTests : EnergyTestsBase protected override double ErgsInOneJoule => 10000000; - protected override double ThermsEcInOneJoule => 9.47816988e-9; + protected override double ThermsEcInOneJoule => 9.4781712031331720001278504447561e-9; protected override double FootPoundsInOneJoule => 0.737562149; diff --git a/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs index afc298215c..9999b6c31f 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs @@ -150,7 +150,7 @@ public double Calories /// public double DecathermsEc { - get { return (_joules/1.05506e+8) / 1e1d; } + get { return (_joules/105505585.262) / 1e1d; } } /// @@ -270,7 +270,7 @@ public double MegawattHours /// public double ThermsEc { - get { return _joules/1.05506e+8; } + get { return _joules/105505585.262; } } /// @@ -327,7 +327,7 @@ public static Energy FromCalories(double calories) /// public static Energy FromDecathermsEc(double decathermsec) { - return new Energy((decathermsec*1.05506e+8) * 1e1d); + return new Energy((decathermsec*105505585.262) * 1e1d); } /// @@ -447,7 +447,7 @@ public static Energy FromMegawattHours(double megawatthours) /// public static Energy FromThermsEc(double thermsec) { - return new Energy(thermsec*1.05506e+8); + return new Energy(thermsec*105505585.262); } /// diff --git a/UnitsNet/UnitDefinitions/Energy.json b/UnitsNet/UnitDefinitions/Energy.json index 1b61d8b96b..e0993b325d 100644 --- a/UnitsNet/UnitDefinitions/Energy.json +++ b/UnitsNet/UnitDefinitions/Energy.json @@ -98,8 +98,8 @@ { "SingularName": "ThermEc", "PluralName": "ThermsEc", - "FromUnitToBaseFunc": "x*1.05506e+8", - "FromBaseToUnitFunc": "x/1.05506e+8", + "FromUnitToBaseFunc": "x*105505585.262", + "FromBaseToUnitFunc": "x/105505585.262", "Prefixes": [ "Deca" ], "Localization": [ { From 15baeef6a1e04cd5733c85621ed6d6334711f170 Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Thu, 28 Sep 2017 12:40:49 +0300 Subject: [PATCH 10/19] Update for ThermsEC --- UnitsNet.Tests/CustomCode/EnergyTests.cs | 2 +- UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs | 8 ++++---- UnitsNet/UnitDefinitions/Energy.json | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/EnergyTests.cs b/UnitsNet.Tests/CustomCode/EnergyTests.cs index e7bf4e7312..b366d9f4e4 100644 --- a/UnitsNet.Tests/CustomCode/EnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/EnergyTests.cs @@ -46,7 +46,7 @@ public class EnergyTests : EnergyTestsBase protected override double ErgsInOneJoule => 10000000; - protected override double ThermsEcInOneJoule => 9.47816988e-9; + protected override double ThermsEcInOneJoule => 9.4781712031331720001278504447561e-9; protected override double FootPoundsInOneJoule => 0.737562149; diff --git a/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs index 920a9c8381..e7d8603715 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs @@ -150,7 +150,7 @@ public double Calories /// public double DecathermsEc { - get { return (_joules/1.05506e+8) / 1e1d; } + get { return (_joules/105505585.262) / 1e1d; } } /// @@ -254,7 +254,7 @@ public double MegawattHours /// public double ThermsEc { - get { return _joules/1.05506e+8; } + get { return _joules/105505585.262; } } /// @@ -311,7 +311,7 @@ public static Energy FromCalories(double calories) /// public static Energy FromDecathermsEc(double decathermsec) { - return new Energy((decathermsec*1.05506e+8) * 1e1d); + return new Energy((decathermsec*105505585.262) * 1e1d); } /// @@ -415,7 +415,7 @@ public static Energy FromMegawattHours(double megawatthours) /// public static Energy FromThermsEc(double thermsec) { - return new Energy(thermsec*1.05506e+8); + return new Energy(thermsec*105505585.262); } /// diff --git a/UnitsNet/UnitDefinitions/Energy.json b/UnitsNet/UnitDefinitions/Energy.json index 65f51eab09..258d5bdf85 100644 --- a/UnitsNet/UnitDefinitions/Energy.json +++ b/UnitsNet/UnitDefinitions/Energy.json @@ -93,8 +93,8 @@ { "SingularName": "ThermEc", "PluralName": "ThermsEc", - "FromUnitToBaseFunc": "x*1.05506e+8", - "FromBaseToUnitFunc": "x/1.05506e+8", + "FromUnitToBaseFunc": "x*105505585.262", + "FromBaseToUnitFunc": "x/105505585.262", "Prefixes": [ "Deca" ], "Localization": [ { From eb03a6ddbc6525d00465d964bbd90604144a94da Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Thu, 28 Sep 2017 15:33:13 +0300 Subject: [PATCH 11/19] Add 'BTU/hr' unit of measure. --- UnitsNet.Tests/CustomCode/PowerTests.cs | 3 + .../GeneratedCode/PowerTestsBase.g.cs | 12 +++ UnitsNet/GeneratedCode/Enums/PowerUnit.g.cs | 2 + .../Number/NumberToPowerExtensions.g.cs | 68 +++++++++++++++++ UnitsNet/GeneratedCode/UnitClasses/Power.g.cs | 74 +++++++++++++++++++ .../GeneratedCode/UnitSystem.Default.g.cs | 10 +++ UnitsNet/UnitDefinitions/Power.json | 14 ++++ 7 files changed, 183 insertions(+) diff --git a/UnitsNet.Tests/CustomCode/PowerTests.cs b/UnitsNet.Tests/CustomCode/PowerTests.cs index 20d7ed229c..b12f17ea92 100644 --- a/UnitsNet.Tests/CustomCode/PowerTests.cs +++ b/UnitsNet.Tests/CustomCode/PowerTests.cs @@ -38,6 +38,8 @@ public class PowerTests : PowerTestsBase protected override double WattsInOneWatt => 1; + protected override double KilobritishThermalUnitsPerHourInOneWatt => 3.412141633e-3; + protected override double KilowattsInOneWatt => 1e-3; protected override double MegawattsInOneWatt => 1e-6; @@ -49,6 +51,7 @@ public class PowerTests : PowerTestsBase protected override double PetawattsInOneWatt => 1e-15; protected override double BoilerHorsepowerInOneWatt => 1.0191082802547770700636942675159e-4; + protected override double BritishThermalUnitsPerHourInOneWatt => 3.412141633; protected override double ElectricalHorsepowerInOneWatt => 0.00134048257372654155495978552279; diff --git a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs index 7c0df6a292..0755f923c0 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs @@ -53,10 +53,12 @@ namespace UnitsNet.Tests public abstract partial class PowerTestsBase { protected abstract double BoilerHorsepowerInOneWatt { get; } + protected abstract double BritishThermalUnitsPerHourInOneWatt { get; } protected abstract double ElectricalHorsepowerInOneWatt { get; } protected abstract double FemtowattsInOneWatt { get; } protected abstract double GigawattsInOneWatt { get; } protected abstract double HydraulicHorsepowerInOneWatt { get; } + protected abstract double KilobritishThermalUnitsPerHourInOneWatt { get; } protected abstract double KilowattsInOneWatt { get; } protected abstract double MechanicalHorsepowerInOneWatt { get; } protected abstract double MegawattsInOneWatt { get; } @@ -71,10 +73,12 @@ public abstract partial class PowerTestsBase // ReSharper disable VirtualMemberNeverOverriden.Global protected virtual double BoilerHorsepowerTolerance { get { return 1e-5; } } + protected virtual double BritishThermalUnitsPerHourTolerance { get { return 1e-5; } } protected virtual double ElectricalHorsepowerTolerance { get { return 1e-5; } } protected virtual double FemtowattsTolerance { get { return 1e-5; } } protected virtual double GigawattsTolerance { get { return 1e-5; } } protected virtual double HydraulicHorsepowerTolerance { get { return 1e-5; } } + protected virtual double KilobritishThermalUnitsPerHourTolerance { get { return 1e-5; } } protected virtual double KilowattsTolerance { get { return 1e-5; } } protected virtual double MechanicalHorsepowerTolerance { get { return 1e-5; } } protected virtual double MegawattsTolerance { get { return 1e-5; } } @@ -93,10 +97,12 @@ public void WattToPowerUnits() { Power watt = Power.FromWatts(1); AssertEx.EqualTolerance(BoilerHorsepowerInOneWatt, watt.BoilerHorsepower, BoilerHorsepowerTolerance); + AssertEx.EqualTolerance(BritishThermalUnitsPerHourInOneWatt, watt.BritishThermalUnitsPerHour, BritishThermalUnitsPerHourTolerance); AssertEx.EqualTolerance(ElectricalHorsepowerInOneWatt, watt.ElectricalHorsepower, ElectricalHorsepowerTolerance); AssertEx.EqualTolerance(FemtowattsInOneWatt, watt.Femtowatts, FemtowattsTolerance); AssertEx.EqualTolerance(GigawattsInOneWatt, watt.Gigawatts, GigawattsTolerance); AssertEx.EqualTolerance(HydraulicHorsepowerInOneWatt, watt.HydraulicHorsepower, HydraulicHorsepowerTolerance); + AssertEx.EqualTolerance(KilobritishThermalUnitsPerHourInOneWatt, watt.KilobritishThermalUnitsPerHour, KilobritishThermalUnitsPerHourTolerance); AssertEx.EqualTolerance(KilowattsInOneWatt, watt.Kilowatts, KilowattsTolerance); AssertEx.EqualTolerance(MechanicalHorsepowerInOneWatt, watt.MechanicalHorsepower, MechanicalHorsepowerTolerance); AssertEx.EqualTolerance(MegawattsInOneWatt, watt.Megawatts, MegawattsTolerance); @@ -114,10 +120,12 @@ public void WattToPowerUnits() public void FromValueAndUnit() { AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.BoilerHorsepower).BoilerHorsepower, BoilerHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.BritishThermalUnitPerHour).BritishThermalUnitsPerHour, BritishThermalUnitsPerHourTolerance); AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.ElectricalHorsepower).ElectricalHorsepower, ElectricalHorsepowerTolerance); AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Femtowatt).Femtowatts, FemtowattsTolerance); AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Gigawatt).Gigawatts, GigawattsTolerance); AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.HydraulicHorsepower).HydraulicHorsepower, HydraulicHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.KilobritishThermalUnitPerHour).KilobritishThermalUnitsPerHour, KilobritishThermalUnitsPerHourTolerance); AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Kilowatt).Kilowatts, KilowattsTolerance); AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.MechanicalHorsepower).MechanicalHorsepower, MechanicalHorsepowerTolerance); AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Megawatt).Megawatts, MegawattsTolerance); @@ -136,10 +144,12 @@ public void As() { var watt = Power.FromWatts(1); AssertEx.EqualTolerance(BoilerHorsepowerInOneWatt, watt.As(PowerUnit.BoilerHorsepower), BoilerHorsepowerTolerance); + AssertEx.EqualTolerance(BritishThermalUnitsPerHourInOneWatt, watt.As(PowerUnit.BritishThermalUnitPerHour), BritishThermalUnitsPerHourTolerance); AssertEx.EqualTolerance(ElectricalHorsepowerInOneWatt, watt.As(PowerUnit.ElectricalHorsepower), ElectricalHorsepowerTolerance); AssertEx.EqualTolerance(FemtowattsInOneWatt, watt.As(PowerUnit.Femtowatt), FemtowattsTolerance); AssertEx.EqualTolerance(GigawattsInOneWatt, watt.As(PowerUnit.Gigawatt), GigawattsTolerance); AssertEx.EqualTolerance(HydraulicHorsepowerInOneWatt, watt.As(PowerUnit.HydraulicHorsepower), HydraulicHorsepowerTolerance); + AssertEx.EqualTolerance(KilobritishThermalUnitsPerHourInOneWatt, watt.As(PowerUnit.KilobritishThermalUnitPerHour), KilobritishThermalUnitsPerHourTolerance); AssertEx.EqualTolerance(KilowattsInOneWatt, watt.As(PowerUnit.Kilowatt), KilowattsTolerance); AssertEx.EqualTolerance(MechanicalHorsepowerInOneWatt, watt.As(PowerUnit.MechanicalHorsepower), MechanicalHorsepowerTolerance); AssertEx.EqualTolerance(MegawattsInOneWatt, watt.As(PowerUnit.Megawatt), MegawattsTolerance); @@ -158,10 +168,12 @@ public void ConversionRoundTrip() { Power watt = Power.FromWatts(1); AssertEx.EqualTolerance(1, Power.FromBoilerHorsepower(watt.BoilerHorsepower).Watts, BoilerHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.FromBritishThermalUnitsPerHour(watt.BritishThermalUnitsPerHour).Watts, BritishThermalUnitsPerHourTolerance); AssertEx.EqualTolerance(1, Power.FromElectricalHorsepower(watt.ElectricalHorsepower).Watts, ElectricalHorsepowerTolerance); AssertEx.EqualTolerance(1, Power.FromFemtowatts(watt.Femtowatts).Watts, FemtowattsTolerance); AssertEx.EqualTolerance(1, Power.FromGigawatts(watt.Gigawatts).Watts, GigawattsTolerance); AssertEx.EqualTolerance(1, Power.FromHydraulicHorsepower(watt.HydraulicHorsepower).Watts, HydraulicHorsepowerTolerance); + AssertEx.EqualTolerance(1, Power.FromKilobritishThermalUnitsPerHour(watt.KilobritishThermalUnitsPerHour).Watts, KilobritishThermalUnitsPerHourTolerance); AssertEx.EqualTolerance(1, Power.FromKilowatts(watt.Kilowatts).Watts, KilowattsTolerance); AssertEx.EqualTolerance(1, Power.FromMechanicalHorsepower(watt.MechanicalHorsepower).Watts, MechanicalHorsepowerTolerance); AssertEx.EqualTolerance(1, Power.FromMegawatts(watt.Megawatts).Watts, MegawattsTolerance); diff --git a/UnitsNet/GeneratedCode/Enums/PowerUnit.g.cs b/UnitsNet/GeneratedCode/Enums/PowerUnit.g.cs index cc3792d1a6..6f3bc0c76d 100644 --- a/UnitsNet/GeneratedCode/Enums/PowerUnit.g.cs +++ b/UnitsNet/GeneratedCode/Enums/PowerUnit.g.cs @@ -43,10 +43,12 @@ public enum PowerUnit { Undefined = 0, BoilerHorsepower, + BritishThermalUnitPerHour, ElectricalHorsepower, Femtowatt, Gigawatt, HydraulicHorsepower, + KilobritishThermalUnitPerHour, Kilowatt, MechanicalHorsepower, Megawatt, diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs index d81af7c420..8925b1b729 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs @@ -78,6 +78,40 @@ public static class NumberToPowerExtensions #endregion + #region BritishThermalUnitPerHour + + /// + public static Power BritishThermalUnitsPerHour(this int value) => Power.FromBritishThermalUnitsPerHour(value); + + /// + public static Power? BritishThermalUnitsPerHour(this int? value) => Power.FromBritishThermalUnitsPerHour(value); + + /// + public static Power BritishThermalUnitsPerHour(this long value) => Power.FromBritishThermalUnitsPerHour(value); + + /// + public static Power? BritishThermalUnitsPerHour(this long? value) => Power.FromBritishThermalUnitsPerHour(value); + + /// + public static Power BritishThermalUnitsPerHour(this double value) => Power.FromBritishThermalUnitsPerHour(value); + + /// + public static Power? BritishThermalUnitsPerHour(this double? value) => Power.FromBritishThermalUnitsPerHour(value); + + /// + public static Power BritishThermalUnitsPerHour(this float value) => Power.FromBritishThermalUnitsPerHour(value); + + /// + public static Power? BritishThermalUnitsPerHour(this float? value) => Power.FromBritishThermalUnitsPerHour(value); + + /// + public static Power BritishThermalUnitsPerHour(this decimal value) => Power.FromBritishThermalUnitsPerHour(Convert.ToDouble(value)); + + /// + public static Power? BritishThermalUnitsPerHour(this decimal? value) => Power.FromBritishThermalUnitsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region ElectricalHorsepower /// @@ -214,6 +248,40 @@ public static class NumberToPowerExtensions #endregion + #region KilobritishThermalUnitPerHour + + /// + public static Power KilobritishThermalUnitsPerHour(this int value) => Power.FromKilobritishThermalUnitsPerHour(value); + + /// + public static Power? KilobritishThermalUnitsPerHour(this int? value) => Power.FromKilobritishThermalUnitsPerHour(value); + + /// + public static Power KilobritishThermalUnitsPerHour(this long value) => Power.FromKilobritishThermalUnitsPerHour(value); + + /// + public static Power? KilobritishThermalUnitsPerHour(this long? value) => Power.FromKilobritishThermalUnitsPerHour(value); + + /// + public static Power KilobritishThermalUnitsPerHour(this double value) => Power.FromKilobritishThermalUnitsPerHour(value); + + /// + public static Power? KilobritishThermalUnitsPerHour(this double? value) => Power.FromKilobritishThermalUnitsPerHour(value); + + /// + public static Power KilobritishThermalUnitsPerHour(this float value) => Power.FromKilobritishThermalUnitsPerHour(value); + + /// + public static Power? KilobritishThermalUnitsPerHour(this float? value) => Power.FromKilobritishThermalUnitsPerHour(value); + + /// + public static Power KilobritishThermalUnitsPerHour(this decimal value) => Power.FromKilobritishThermalUnitsPerHour(Convert.ToDouble(value)); + + /// + public static Power? KilobritishThermalUnitsPerHour(this decimal? value) => Power.FromKilobritishThermalUnitsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region Kilowatt /// diff --git a/UnitsNet/GeneratedCode/UnitClasses/Power.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Power.g.cs index 75e2c576e8..295dbd1849 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Power.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Power.g.cs @@ -137,6 +137,14 @@ public double BoilerHorsepower get { return Convert.ToDouble(_watts/9812.5m); } } + /// + /// Get Power in BritishThermalUnitsPerHour. + /// + public double BritishThermalUnitsPerHour + { + get { return Convert.ToDouble(_watts/0.293071m); } + } + /// /// Get Power in ElectricalHorsepower. /// @@ -169,6 +177,14 @@ public double HydraulicHorsepower get { return Convert.ToDouble(_watts/745.69988145m); } } + /// + /// Get Power in KilobritishThermalUnitsPerHour. + /// + public double KilobritishThermalUnitsPerHour + { + get { return Convert.ToDouble((_watts/0.293071m) / 1e3m); } + } + /// /// Get Power in Kilowatts. /// @@ -274,6 +290,14 @@ public static Power FromBoilerHorsepower(double boilerhorsepower) return new Power(Convert.ToDecimal(boilerhorsepower*9812.5d)); } + /// + /// Get Power from BritishThermalUnitsPerHour. + /// + public static Power FromBritishThermalUnitsPerHour(double britishthermalunitsperhour) + { + return new Power(Convert.ToDecimal(britishthermalunitsperhour*0.293071d)); + } + /// /// Get Power from ElectricalHorsepower. /// @@ -306,6 +330,14 @@ public static Power FromHydraulicHorsepower(double hydraulichorsepower) return new Power(Convert.ToDecimal(hydraulichorsepower*745.69988145d)); } + /// + /// Get Power from KilobritishThermalUnitsPerHour. + /// + public static Power FromKilobritishThermalUnitsPerHour(double kilobritishthermalunitsperhour) + { + return new Power(Convert.ToDecimal((kilobritishthermalunitsperhour*0.293071d) * 1e3d)); + } + /// /// Get Power from Kilowatts. /// @@ -411,6 +443,21 @@ public static Power FromWatts(double watts) } } + /// + /// Get nullable Power from nullable BritishThermalUnitsPerHour. + /// + public static Power? FromBritishThermalUnitsPerHour(double? britishthermalunitsperhour) + { + if (britishthermalunitsperhour.HasValue) + { + return FromBritishThermalUnitsPerHour(britishthermalunitsperhour.Value); + } + else + { + return null; + } + } + /// /// Get nullable Power from nullable ElectricalHorsepower. /// @@ -471,6 +518,21 @@ public static Power FromWatts(double watts) } } + /// + /// Get nullable Power from nullable KilobritishThermalUnitsPerHour. + /// + public static Power? FromKilobritishThermalUnitsPerHour(double? kilobritishthermalunitsperhour) + { + if (kilobritishthermalunitsperhour.HasValue) + { + return FromKilobritishThermalUnitsPerHour(kilobritishthermalunitsperhour.Value); + } + else + { + return null; + } + } + /// /// Get nullable Power from nullable Kilowatts. /// @@ -650,6 +712,8 @@ public static Power From(double val, PowerUnit fromUnit) { case PowerUnit.BoilerHorsepower: return FromBoilerHorsepower(val); + case PowerUnit.BritishThermalUnitPerHour: + return FromBritishThermalUnitsPerHour(val); case PowerUnit.ElectricalHorsepower: return FromElectricalHorsepower(val); case PowerUnit.Femtowatt: @@ -658,6 +722,8 @@ public static Power From(double val, PowerUnit fromUnit) return FromGigawatts(val); case PowerUnit.HydraulicHorsepower: return FromHydraulicHorsepower(val); + case PowerUnit.KilobritishThermalUnitPerHour: + return FromKilobritishThermalUnitsPerHour(val); case PowerUnit.Kilowatt: return FromKilowatts(val); case PowerUnit.MechanicalHorsepower: @@ -704,6 +770,8 @@ public static Power From(double val, PowerUnit fromUnit) { case PowerUnit.BoilerHorsepower: return FromBoilerHorsepower(value.Value); + case PowerUnit.BritishThermalUnitPerHour: + return FromBritishThermalUnitsPerHour(value.Value); case PowerUnit.ElectricalHorsepower: return FromElectricalHorsepower(value.Value); case PowerUnit.Femtowatt: @@ -712,6 +780,8 @@ public static Power From(double val, PowerUnit fromUnit) return FromGigawatts(value.Value); case PowerUnit.HydraulicHorsepower: return FromHydraulicHorsepower(value.Value); + case PowerUnit.KilobritishThermalUnitPerHour: + return FromKilobritishThermalUnitsPerHour(value.Value); case PowerUnit.Kilowatt: return FromKilowatts(value.Value); case PowerUnit.MechanicalHorsepower: @@ -893,6 +963,8 @@ public double As(PowerUnit unit) { case PowerUnit.BoilerHorsepower: return BoilerHorsepower; + case PowerUnit.BritishThermalUnitPerHour: + return BritishThermalUnitsPerHour; case PowerUnit.ElectricalHorsepower: return ElectricalHorsepower; case PowerUnit.Femtowatt: @@ -901,6 +973,8 @@ public double As(PowerUnit unit) return Gigawatts; case PowerUnit.HydraulicHorsepower: return HydraulicHorsepower; + case PowerUnit.KilobritishThermalUnitPerHour: + return KilobritishThermalUnitsPerHour; case PowerUnit.Kilowatt: return Kilowatts; case PowerUnit.MechanicalHorsepower: diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index fb02cd98dc..47b9771d0b 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -1831,6 +1831,11 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "hp(S)"), }), + new CulturesForEnumValue((int) PowerUnit.BritishThermalUnitPerHour, + new[] + { + new AbbreviationsForCulture("en-US", "Btu/hr"), + }), new CulturesForEnumValue((int) PowerUnit.ElectricalHorsepower, new[] { @@ -1851,6 +1856,11 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "hp(H)"), }), + new CulturesForEnumValue((int) PowerUnit.KilobritishThermalUnitPerHour, + new[] + { + new AbbreviationsForCulture("en-US", "kBtu/hr"), + }), new CulturesForEnumValue((int) PowerUnit.Kilowatt, new[] { diff --git a/UnitsNet/UnitDefinitions/Power.json b/UnitsNet/UnitDefinitions/Power.json index ef5540c8e6..da47552033 100644 --- a/UnitsNet/UnitDefinitions/Power.json +++ b/UnitsNet/UnitDefinitions/Power.json @@ -76,6 +76,20 @@ "Abbreviations": [ "hp(H)" ] } ] + }, + { + "SingularName": "BritishThermalUnitPerHour", + "PluralName": "BritishThermalUnitsPerHour", + "FromUnitToBaseFunc": "x*0.293071m", + "FromBaseToUnitFunc": "x/0.293071m", + "Prefixes": [ "Kilo" ], + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "Btu/hr" ], + "AbbreviationsWithPrefixes": [ "kBtu/hr" ] + } + ] } ] } \ No newline at end of file From 33283700bdc47a190a0d3b3c930f09937fd2ce7d Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Thu, 28 Sep 2017 17:02:41 +0300 Subject: [PATCH 12/19] Add 'cf/hr' Unit of measure. --- UnitsNet.Tests/CustomCode/FlowTests.cs | 2 + .../GeneratedCode/FlowTestsBase.g.cs | 6 +++ UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs | 1 + .../Number/NumberToFlowExtensions.g.cs | 34 +++++++++++++++++ UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs | 37 +++++++++++++++++++ .../GeneratedCode/UnitSystem.Default.g.cs | 5 +++ UnitsNet/UnitDefinitions/Flow.json | 12 ++++++ 7 files changed, 97 insertions(+) diff --git a/UnitsNet.Tests/CustomCode/FlowTests.cs b/UnitsNet.Tests/CustomCode/FlowTests.cs index 37f19c7271..e935464bab 100644 --- a/UnitsNet.Tests/CustomCode/FlowTests.cs +++ b/UnitsNet.Tests/CustomCode/FlowTests.cs @@ -27,6 +27,8 @@ public class FlowTests : FlowTestsBase protected override double CubicDecimetersPerMinuteInOneCubicMeterPerSecond => 60000.00000; + protected override double CubicFeetPerHourInOneCubicMeterPerSecond => 1.2713300937959091422759633856933e+5; + protected override double CubicFeetPerSecondInOneCubicMeterPerSecond => 35.314666213; protected override double MillionUsGallonsPerDayInOneCubicMeterPerSecond => 22.824465227; diff --git a/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs index 80079d5602..a9cbffdf0d 100644 --- a/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs @@ -54,6 +54,7 @@ public abstract partial class FlowTestsBase { protected abstract double CentilitersPerMinuteInOneCubicMeterPerSecond { get; } protected abstract double CubicDecimetersPerMinuteInOneCubicMeterPerSecond { get; } + protected abstract double CubicFeetPerHourInOneCubicMeterPerSecond { get; } protected abstract double CubicFeetPerSecondInOneCubicMeterPerSecond { get; } protected abstract double CubicMetersPerHourInOneCubicMeterPerSecond { get; } protected abstract double CubicMetersPerSecondInOneCubicMeterPerSecond { get; } @@ -72,6 +73,7 @@ public abstract partial class FlowTestsBase // ReSharper disable VirtualMemberNeverOverriden.Global protected virtual double CentilitersPerMinuteTolerance { get { return 1e-5; } } protected virtual double CubicDecimetersPerMinuteTolerance { get { return 1e-5; } } + protected virtual double CubicFeetPerHourTolerance { get { return 1e-5; } } protected virtual double CubicFeetPerSecondTolerance { get { return 1e-5; } } protected virtual double CubicMetersPerHourTolerance { get { return 1e-5; } } protected virtual double CubicMetersPerSecondTolerance { get { return 1e-5; } } @@ -94,6 +96,7 @@ public void CubicMeterPerSecondToFlowUnits() Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CentilitersPerMinute, CentilitersPerMinuteTolerance); AssertEx.EqualTolerance(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance); + AssertEx.EqualTolerance(CubicFeetPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerHour, CubicFeetPerHourTolerance); AssertEx.EqualTolerance(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerSecond, CubicFeetPerSecondTolerance); AssertEx.EqualTolerance(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerHour, CubicMetersPerHourTolerance); AssertEx.EqualTolerance(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerSecond, CubicMetersPerSecondTolerance); @@ -115,6 +118,7 @@ public void FromValueAndUnit() { AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CentilitersPerMinute).CentilitersPerMinute, CentilitersPerMinuteTolerance); AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicDecimeterPerMinute).CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance); + AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicFootPerHour).CubicFeetPerHour, CubicFeetPerHourTolerance); AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicFootPerSecond).CubicFeetPerSecond, CubicFeetPerSecondTolerance); AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicMeterPerHour).CubicMetersPerHour, CubicMetersPerHourTolerance); AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicMeterPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance); @@ -137,6 +141,7 @@ public void As() var cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CentilitersPerMinute), CentilitersPerMinuteTolerance); AssertEx.EqualTolerance(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicDecimeterPerMinute), CubicDecimetersPerMinuteTolerance); + AssertEx.EqualTolerance(CubicFeetPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicFootPerHour), CubicFeetPerHourTolerance); AssertEx.EqualTolerance(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicFootPerSecond), CubicFeetPerSecondTolerance); AssertEx.EqualTolerance(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerHour), CubicMetersPerHourTolerance); AssertEx.EqualTolerance(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerSecond), CubicMetersPerSecondTolerance); @@ -159,6 +164,7 @@ public void ConversionRoundTrip() Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); AssertEx.EqualTolerance(1, Flow.FromCentilitersPerMinute(cubicmeterpersecond.CentilitersPerMinute).CubicMetersPerSecond, CentilitersPerMinuteTolerance); AssertEx.EqualTolerance(1, Flow.FromCubicDecimetersPerMinute(cubicmeterpersecond.CubicDecimetersPerMinute).CubicMetersPerSecond, CubicDecimetersPerMinuteTolerance); + AssertEx.EqualTolerance(1, Flow.FromCubicFeetPerHour(cubicmeterpersecond.CubicFeetPerHour).CubicMetersPerSecond, CubicFeetPerHourTolerance); AssertEx.EqualTolerance(1, Flow.FromCubicFeetPerSecond(cubicmeterpersecond.CubicFeetPerSecond).CubicMetersPerSecond, CubicFeetPerSecondTolerance); AssertEx.EqualTolerance(1, Flow.FromCubicMetersPerHour(cubicmeterpersecond.CubicMetersPerHour).CubicMetersPerSecond, CubicMetersPerHourTolerance); AssertEx.EqualTolerance(1, Flow.FromCubicMetersPerSecond(cubicmeterpersecond.CubicMetersPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance); diff --git a/UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs b/UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs index 79d1a9dc7e..1e6fb19098 100644 --- a/UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs +++ b/UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs @@ -44,6 +44,7 @@ public enum FlowUnit Undefined = 0, CentilitersPerMinute, CubicDecimeterPerMinute, + CubicFootPerHour, CubicFootPerSecond, CubicMeterPerHour, CubicMeterPerSecond, diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs index 3e344f42dc..f4cf30b5a4 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs @@ -112,6 +112,40 @@ public static class NumberToFlowExtensions #endregion + #region CubicFootPerHour + + /// + public static Flow CubicFeetPerHour(this int value) => Flow.FromCubicFeetPerHour(value); + + /// + public static Flow? CubicFeetPerHour(this int? value) => Flow.FromCubicFeetPerHour(value); + + /// + public static Flow CubicFeetPerHour(this long value) => Flow.FromCubicFeetPerHour(value); + + /// + public static Flow? CubicFeetPerHour(this long? value) => Flow.FromCubicFeetPerHour(value); + + /// + public static Flow CubicFeetPerHour(this double value) => Flow.FromCubicFeetPerHour(value); + + /// + public static Flow? CubicFeetPerHour(this double? value) => Flow.FromCubicFeetPerHour(value); + + /// + public static Flow CubicFeetPerHour(this float value) => Flow.FromCubicFeetPerHour(value); + + /// + public static Flow? CubicFeetPerHour(this float? value) => Flow.FromCubicFeetPerHour(value); + + /// + public static Flow CubicFeetPerHour(this decimal value) => Flow.FromCubicFeetPerHour(Convert.ToDouble(value)); + + /// + public static Flow? CubicFeetPerHour(this decimal? value) => Flow.FromCubicFeetPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region CubicFootPerSecond /// diff --git a/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs index bd53db7fc0..4932530200 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs @@ -145,6 +145,14 @@ public double CubicDecimetersPerMinute get { return _cubicMetersPerSecond*60000.00000; } } + /// + /// Get Flow in CubicFeetPerHour. + /// + public double CubicFeetPerHour + { + get { return _cubicMetersPerSecond/7.8657777777777777777777777777778e-6; } + } + /// /// Get Flow in CubicFeetPerSecond. /// @@ -282,6 +290,14 @@ public static Flow FromCubicDecimetersPerMinute(double cubicdecimetersperminute) return new Flow(cubicdecimetersperminute/60000.00000); } + /// + /// Get Flow from CubicFeetPerHour. + /// + public static Flow FromCubicFeetPerHour(double cubicfeetperhour) + { + return new Flow(cubicfeetperhour*7.8657777777777777777777777777778e-6); + } + /// /// Get Flow from CubicFeetPerSecond. /// @@ -426,6 +442,21 @@ public static Flow FromUsGallonsPerMinute(double usgallonsperminute) } } + /// + /// Get nullable Flow from nullable CubicFeetPerHour. + /// + public static Flow? FromCubicFeetPerHour(double? cubicfeetperhour) + { + if (cubicfeetperhour.HasValue) + { + return FromCubicFeetPerHour(cubicfeetperhour.Value); + } + else + { + return null; + } + } + /// /// Get nullable Flow from nullable CubicFeetPerSecond. /// @@ -652,6 +683,8 @@ public static Flow From(double val, FlowUnit fromUnit) return FromCentilitersPerMinute(val); case FlowUnit.CubicDecimeterPerMinute: return FromCubicDecimetersPerMinute(val); + case FlowUnit.CubicFootPerHour: + return FromCubicFeetPerHour(val); case FlowUnit.CubicFootPerSecond: return FromCubicFeetPerSecond(val); case FlowUnit.CubicMeterPerHour: @@ -706,6 +739,8 @@ public static Flow From(double val, FlowUnit fromUnit) return FromCentilitersPerMinute(value.Value); case FlowUnit.CubicDecimeterPerMinute: return FromCubicDecimetersPerMinute(value.Value); + case FlowUnit.CubicFootPerHour: + return FromCubicFeetPerHour(value.Value); case FlowUnit.CubicFootPerSecond: return FromCubicFeetPerSecond(value.Value); case FlowUnit.CubicMeterPerHour: @@ -895,6 +930,8 @@ public double As(FlowUnit unit) return CentilitersPerMinute; case FlowUnit.CubicDecimeterPerMinute: return CubicDecimetersPerMinute; + case FlowUnit.CubicFootPerHour: + return CubicFeetPerHour; case FlowUnit.CubicFootPerSecond: return CubicFeetPerSecond; case FlowUnit.CubicMeterPerHour: diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index 47b9771d0b..bcc8f8d2c2 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -926,6 +926,11 @@ private static readonly ReadOnlyCollection DefaultLocalization new AbbreviationsForCulture("en-US", "dm³/min"), new AbbreviationsForCulture("ru-RU", "дм³/мин"), }), + new CulturesForEnumValue((int) FlowUnit.CubicFootPerHour, + new[] + { + new AbbreviationsForCulture("en-US", "cf/hr"), + }), new CulturesForEnumValue((int) FlowUnit.CubicFootPerSecond, new[] { diff --git a/UnitsNet/UnitDefinitions/Flow.json b/UnitsNet/UnitDefinitions/Flow.json index f00e94bcf7..b1031ebc50 100644 --- a/UnitsNet/UnitDefinitions/Flow.json +++ b/UnitsNet/UnitDefinitions/Flow.json @@ -141,6 +141,18 @@ "Abbreviations": [ "bbl/d", "BOPD" ] } ] + }, + { + "SingularName": "CubicFootPerHour", + "PluralName": "CubicFeetPerHour", + "FromUnitToBaseFunc": "x*7.8657777777777777777777777777778e-6", + "FromBaseToUnitFunc": "x/7.8657777777777777777777777777778e-6", + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "cf/hr" ] + } + ] } ] } From 38801de42c79d8221dc870e7b3d66fabf0d07203 Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Thu, 28 Sep 2017 18:00:41 +0300 Subject: [PATCH 13/19] Add new prefixes. --- UnitsNet.Tests/CustomCode/EnergyTests.cs | 2 + UnitsNet.Tests/CustomCode/MassFlowTests.cs | 3 ++ .../GeneratedCode/EnergyTestsBase.g.cs | 6 +++ .../GeneratedCode/MassFlowTestsBase.g.cs | 6 +++ UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs | 1 + .../GeneratedCode/Enums/MassFlowUnit.g.cs | 1 + .../Number/NumberToEnergyExtensions.g.cs | 34 +++++++++++++++++ .../Number/NumberToMassFlowExtensions.g.cs | 34 +++++++++++++++++ .../GeneratedCode/UnitClasses/Energy.g.cs | 37 +++++++++++++++++++ .../GeneratedCode/UnitClasses/MassFlow.g.cs | 37 +++++++++++++++++++ .../GeneratedCode/UnitSystem.Default.g.cs | 12 +++++- UnitsNet/UnitDefinitions/Energy.json | 5 ++- UnitsNet/UnitDefinitions/MassFlow.json | 4 +- 13 files changed, 178 insertions(+), 4 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/EnergyTests.cs b/UnitsNet.Tests/CustomCode/EnergyTests.cs index 98ac21b49f..cdfa19ec29 100644 --- a/UnitsNet.Tests/CustomCode/EnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/EnergyTests.cs @@ -54,6 +54,8 @@ public class EnergyTests : EnergyTestsBase protected override double FootPoundsInOneJoule => 0.737562149; + protected override double GigabritishThermalUnitsInOneJoule => 9.4781339449889105832843629746176e-13; + protected override double GigawattHoursInOneJoule => 2.77777778e-13; protected override double KilocaloriesInOneJoule => 0.00023900573614; diff --git a/UnitsNet.Tests/CustomCode/MassFlowTests.cs b/UnitsNet.Tests/CustomCode/MassFlowTests.cs index 2ca3d46778..0de0ba41a9 100644 --- a/UnitsNet.Tests/CustomCode/MassFlowTests.cs +++ b/UnitsNet.Tests/CustomCode/MassFlowTests.cs @@ -36,6 +36,8 @@ public class MassFlowTests : MassFlowTestsBase protected override double KilogramsPerSecondInOneGramPerSecond => 1E-3; + protected override double MegapoundsPerHourInOneGramPerSecond => 7.93664e-6; + protected override double DecigramsPerSecondInOneGramPerSecond => 1E1; protected override double CentigramsPerSecondInOneGramPerSecond => 1E2; @@ -47,6 +49,7 @@ public class MassFlowTests : MassFlowTestsBase protected override double NanogramsPerSecondInOneGramPerSecond => 1E9; protected override double ShortTonsPerHourInOneGramPerSecond => 3.96832e-3; + protected override double TonnesPerDayInOneGramPerSecond => 60.0*60*24/1E6; protected override double PoundsPerHourInOneGramPerSecond => 7.93664; diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index 59c631e939..8627a5cec7 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -60,6 +60,7 @@ public abstract partial class EnergyTestsBase protected abstract double ElectronVoltsInOneJoule { get; } protected abstract double ErgsInOneJoule { get; } protected abstract double FootPoundsInOneJoule { get; } + protected abstract double GigabritishThermalUnitsInOneJoule { get; } protected abstract double GigawattHoursInOneJoule { get; } protected abstract double JoulesInOneJoule { get; } protected abstract double KilobritishThermalUnitsInOneJoule { get; } @@ -83,6 +84,7 @@ public abstract partial class EnergyTestsBase protected virtual double ElectronVoltsTolerance { get { return 1e-5; } } protected virtual double ErgsTolerance { get { return 1e-5; } } protected virtual double FootPoundsTolerance { get { return 1e-5; } } + protected virtual double GigabritishThermalUnitsTolerance { get { return 1e-5; } } protected virtual double GigawattHoursTolerance { get { return 1e-5; } } protected virtual double JoulesTolerance { get { return 1e-5; } } protected virtual double KilobritishThermalUnitsTolerance { get { return 1e-5; } } @@ -110,6 +112,7 @@ public void JouleToEnergyUnits() AssertEx.EqualTolerance(ElectronVoltsInOneJoule, joule.ElectronVolts, ElectronVoltsTolerance); AssertEx.EqualTolerance(ErgsInOneJoule, joule.Ergs, ErgsTolerance); AssertEx.EqualTolerance(FootPoundsInOneJoule, joule.FootPounds, FootPoundsTolerance); + AssertEx.EqualTolerance(GigabritishThermalUnitsInOneJoule, joule.GigabritishThermalUnits, GigabritishThermalUnitsTolerance); AssertEx.EqualTolerance(GigawattHoursInOneJoule, joule.GigawattHours, GigawattHoursTolerance); AssertEx.EqualTolerance(JoulesInOneJoule, joule.Joules, JoulesTolerance); AssertEx.EqualTolerance(KilobritishThermalUnitsInOneJoule, joule.KilobritishThermalUnits, KilobritishThermalUnitsTolerance); @@ -136,6 +139,7 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ElectronVolt).ElectronVolts, ElectronVoltsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Erg).Ergs, ErgsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.FootPound).FootPounds, FootPoundsTolerance); + AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.GigabritishThermalUnit).GigabritishThermalUnits, GigabritishThermalUnitsTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.GigawattHour).GigawattHours, GigawattHoursTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Joule).Joules, JoulesTolerance); AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.KilobritishThermalUnit).KilobritishThermalUnits, KilobritishThermalUnitsTolerance); @@ -163,6 +167,7 @@ public void As() AssertEx.EqualTolerance(ElectronVoltsInOneJoule, joule.As(EnergyUnit.ElectronVolt), ElectronVoltsTolerance); AssertEx.EqualTolerance(ErgsInOneJoule, joule.As(EnergyUnit.Erg), ErgsTolerance); AssertEx.EqualTolerance(FootPoundsInOneJoule, joule.As(EnergyUnit.FootPound), FootPoundsTolerance); + AssertEx.EqualTolerance(GigabritishThermalUnitsInOneJoule, joule.As(EnergyUnit.GigabritishThermalUnit), GigabritishThermalUnitsTolerance); AssertEx.EqualTolerance(GigawattHoursInOneJoule, joule.As(EnergyUnit.GigawattHour), GigawattHoursTolerance); AssertEx.EqualTolerance(JoulesInOneJoule, joule.As(EnergyUnit.Joule), JoulesTolerance); AssertEx.EqualTolerance(KilobritishThermalUnitsInOneJoule, joule.As(EnergyUnit.KilobritishThermalUnit), KilobritishThermalUnitsTolerance); @@ -190,6 +195,7 @@ public void ConversionRoundTrip() 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); diff --git a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs index a13052996c..e0a10f4bed 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs @@ -59,6 +59,7 @@ public abstract partial class MassFlowTestsBase protected abstract double HectogramsPerSecondInOneGramPerSecond { get; } protected abstract double KilogramsPerHourInOneGramPerSecond { get; } protected abstract double KilogramsPerSecondInOneGramPerSecond { get; } + protected abstract double MegapoundsPerHourInOneGramPerSecond { get; } protected abstract double MicrogramsPerSecondInOneGramPerSecond { get; } protected abstract double MilligramsPerSecondInOneGramPerSecond { get; } protected abstract double NanogramsPerSecondInOneGramPerSecond { get; } @@ -74,6 +75,7 @@ public abstract partial class MassFlowTestsBase protected virtual double HectogramsPerSecondTolerance { get { return 1e-5; } } protected virtual double KilogramsPerHourTolerance { get { return 1e-5; } } protected virtual double KilogramsPerSecondTolerance { get { return 1e-5; } } + protected virtual double MegapoundsPerHourTolerance { get { return 1e-5; } } protected virtual double MicrogramsPerSecondTolerance { get { return 1e-5; } } protected virtual double MilligramsPerSecondTolerance { get { return 1e-5; } } protected virtual double NanogramsPerSecondTolerance { get { return 1e-5; } } @@ -93,6 +95,7 @@ public void GramPerSecondToMassFlowUnits() AssertEx.EqualTolerance(HectogramsPerSecondInOneGramPerSecond, grampersecond.HectogramsPerSecond, HectogramsPerSecondTolerance); AssertEx.EqualTolerance(KilogramsPerHourInOneGramPerSecond, grampersecond.KilogramsPerHour, KilogramsPerHourTolerance); AssertEx.EqualTolerance(KilogramsPerSecondInOneGramPerSecond, grampersecond.KilogramsPerSecond, KilogramsPerSecondTolerance); + AssertEx.EqualTolerance(MegapoundsPerHourInOneGramPerSecond, grampersecond.MegapoundsPerHour, MegapoundsPerHourTolerance); AssertEx.EqualTolerance(MicrogramsPerSecondInOneGramPerSecond, grampersecond.MicrogramsPerSecond, MicrogramsPerSecondTolerance); AssertEx.EqualTolerance(MilligramsPerSecondInOneGramPerSecond, grampersecond.MilligramsPerSecond, MilligramsPerSecondTolerance); AssertEx.EqualTolerance(NanogramsPerSecondInOneGramPerSecond, grampersecond.NanogramsPerSecond, NanogramsPerSecondTolerance); @@ -111,6 +114,7 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.HectogramPerSecond).HectogramsPerSecond, HectogramsPerSecondTolerance); AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.KilogramPerHour).KilogramsPerHour, KilogramsPerHourTolerance); AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.KilogramPerSecond).KilogramsPerSecond, KilogramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MegapoundPerHour).MegapoundsPerHour, MegapoundsPerHourTolerance); AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MicrogramPerSecond).MicrogramsPerSecond, MicrogramsPerSecondTolerance); AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MilligramPerSecond).MilligramsPerSecond, MilligramsPerSecondTolerance); AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.NanogramPerSecond).NanogramsPerSecond, NanogramsPerSecondTolerance); @@ -130,6 +134,7 @@ public void As() AssertEx.EqualTolerance(HectogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.HectogramPerSecond), HectogramsPerSecondTolerance); AssertEx.EqualTolerance(KilogramsPerHourInOneGramPerSecond, grampersecond.As(MassFlowUnit.KilogramPerHour), KilogramsPerHourTolerance); AssertEx.EqualTolerance(KilogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.KilogramPerSecond), KilogramsPerSecondTolerance); + AssertEx.EqualTolerance(MegapoundsPerHourInOneGramPerSecond, grampersecond.As(MassFlowUnit.MegapoundPerHour), MegapoundsPerHourTolerance); AssertEx.EqualTolerance(MicrogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.MicrogramPerSecond), MicrogramsPerSecondTolerance); AssertEx.EqualTolerance(MilligramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.MilligramPerSecond), MilligramsPerSecondTolerance); AssertEx.EqualTolerance(NanogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.NanogramPerSecond), NanogramsPerSecondTolerance); @@ -149,6 +154,7 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, MassFlow.FromHectogramsPerSecond(grampersecond.HectogramsPerSecond).GramsPerSecond, HectogramsPerSecondTolerance); AssertEx.EqualTolerance(1, MassFlow.FromKilogramsPerHour(grampersecond.KilogramsPerHour).GramsPerSecond, KilogramsPerHourTolerance); AssertEx.EqualTolerance(1, MassFlow.FromKilogramsPerSecond(grampersecond.KilogramsPerSecond).GramsPerSecond, KilogramsPerSecondTolerance); + AssertEx.EqualTolerance(1, MassFlow.FromMegapoundsPerHour(grampersecond.MegapoundsPerHour).GramsPerSecond, MegapoundsPerHourTolerance); AssertEx.EqualTolerance(1, MassFlow.FromMicrogramsPerSecond(grampersecond.MicrogramsPerSecond).GramsPerSecond, MicrogramsPerSecondTolerance); AssertEx.EqualTolerance(1, MassFlow.FromMilligramsPerSecond(grampersecond.MilligramsPerSecond).GramsPerSecond, MilligramsPerSecondTolerance); AssertEx.EqualTolerance(1, MassFlow.FromNanogramsPerSecond(grampersecond.NanogramsPerSecond).GramsPerSecond, NanogramsPerSecondTolerance); diff --git a/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs b/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs index 78cae9c541..6559331211 100644 --- a/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Enums/EnergyUnit.g.cs @@ -50,6 +50,7 @@ public enum EnergyUnit ElectronVolt, Erg, FootPound, + GigabritishThermalUnit, GigawattHour, Joule, KilobritishThermalUnit, diff --git a/UnitsNet/GeneratedCode/Enums/MassFlowUnit.g.cs b/UnitsNet/GeneratedCode/Enums/MassFlowUnit.g.cs index c9f9b6f0b7..73e0cb044b 100644 --- a/UnitsNet/GeneratedCode/Enums/MassFlowUnit.g.cs +++ b/UnitsNet/GeneratedCode/Enums/MassFlowUnit.g.cs @@ -49,6 +49,7 @@ public enum MassFlowUnit HectogramPerSecond, KilogramPerHour, KilogramPerSecond, + MegapoundPerHour, MicrogramPerSecond, MilligramPerSecond, NanogramPerSecond, diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs index 8ac63c2da5..874797792e 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs @@ -316,6 +316,40 @@ public static class NumberToEnergyExtensions #endregion + #region GigabritishThermalUnit + + /// + public static Energy GigabritishThermalUnits(this int value) => Energy.FromGigabritishThermalUnits(value); + + /// + public static Energy? GigabritishThermalUnits(this int? value) => Energy.FromGigabritishThermalUnits(value); + + /// + public static Energy GigabritishThermalUnits(this long value) => Energy.FromGigabritishThermalUnits(value); + + /// + public static Energy? GigabritishThermalUnits(this long? value) => Energy.FromGigabritishThermalUnits(value); + + /// + public static Energy GigabritishThermalUnits(this double value) => Energy.FromGigabritishThermalUnits(value); + + /// + public static Energy? GigabritishThermalUnits(this double? value) => Energy.FromGigabritishThermalUnits(value); + + /// + public static Energy GigabritishThermalUnits(this float value) => Energy.FromGigabritishThermalUnits(value); + + /// + public static Energy? GigabritishThermalUnits(this float? value) => Energy.FromGigabritishThermalUnits(value); + + /// + public static Energy GigabritishThermalUnits(this decimal value) => Energy.FromGigabritishThermalUnits(Convert.ToDouble(value)); + + /// + public static Energy? GigabritishThermalUnits(this decimal? value) => Energy.FromGigabritishThermalUnits(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region GigawattHour /// diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs index b88ae691aa..050760f49e 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs @@ -282,6 +282,40 @@ public static class NumberToMassFlowExtensions #endregion + #region MegapoundPerHour + + /// + public static MassFlow MegapoundsPerHour(this int value) => MassFlow.FromMegapoundsPerHour(value); + + /// + public static MassFlow? MegapoundsPerHour(this int? value) => MassFlow.FromMegapoundsPerHour(value); + + /// + public static MassFlow MegapoundsPerHour(this long value) => MassFlow.FromMegapoundsPerHour(value); + + /// + public static MassFlow? MegapoundsPerHour(this long? value) => MassFlow.FromMegapoundsPerHour(value); + + /// + public static MassFlow MegapoundsPerHour(this double value) => MassFlow.FromMegapoundsPerHour(value); + + /// + public static MassFlow? MegapoundsPerHour(this double? value) => MassFlow.FromMegapoundsPerHour(value); + + /// + public static MassFlow MegapoundsPerHour(this float value) => MassFlow.FromMegapoundsPerHour(value); + + /// + public static MassFlow? MegapoundsPerHour(this float? value) => MassFlow.FromMegapoundsPerHour(value); + + /// + public static MassFlow MegapoundsPerHour(this decimal value) => MassFlow.FromMegapoundsPerHour(Convert.ToDouble(value)); + + /// + public static MassFlow? MegapoundsPerHour(this decimal? value) => MassFlow.FromMegapoundsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region MicrogramPerSecond /// diff --git a/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs index 9999b6c31f..1b41c7c3e8 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Energy.g.cs @@ -193,6 +193,14 @@ public double FootPounds get { return _joules/1.355817948; } } + /// + /// Get Energy in GigabritishThermalUnits. + /// + public double GigabritishThermalUnits + { + get { return (_joules/1055.05585262) / 1e9d; } + } + /// /// Get Energy in GigawattHours. /// @@ -370,6 +378,14 @@ public static Energy FromFootPounds(double footpounds) return new Energy(footpounds*1.355817948); } + /// + /// Get Energy from GigabritishThermalUnits. + /// + public static Energy FromGigabritishThermalUnits(double gigabritishthermalunits) + { + return new Energy((gigabritishthermalunits*1055.05585262) * 1e9d); + } + /// /// Get Energy from GigawattHours. /// @@ -596,6 +612,21 @@ public static Energy FromWattHours(double watthours) } } + /// + /// Get nullable Energy from nullable GigabritishThermalUnits. + /// + public static Energy? FromGigabritishThermalUnits(double? gigabritishthermalunits) + { + if (gigabritishthermalunits.HasValue) + { + return FromGigabritishThermalUnits(gigabritishthermalunits.Value); + } + else + { + return null; + } + } + /// /// Get nullable Energy from nullable GigawattHours. /// @@ -819,6 +850,8 @@ public static Energy From(double val, EnergyUnit fromUnit) return FromErgs(val); case EnergyUnit.FootPound: return FromFootPounds(val); + case EnergyUnit.GigabritishThermalUnit: + return FromGigabritishThermalUnits(val); case EnergyUnit.GigawattHour: return FromGigawattHours(val); case EnergyUnit.Joule: @@ -883,6 +916,8 @@ public static Energy From(double val, EnergyUnit fromUnit) return FromErgs(value.Value); case EnergyUnit.FootPound: return FromFootPounds(value.Value); + case EnergyUnit.GigabritishThermalUnit: + return FromGigabritishThermalUnits(value.Value); case EnergyUnit.GigawattHour: return FromGigawattHours(value.Value); case EnergyUnit.Joule: @@ -1082,6 +1117,8 @@ public double As(EnergyUnit unit) return Ergs; case EnergyUnit.FootPound: return FootPounds; + case EnergyUnit.GigabritishThermalUnit: + return GigabritishThermalUnits; case EnergyUnit.GigawattHour: return GigawattHours; case EnergyUnit.Joule: diff --git a/UnitsNet/GeneratedCode/UnitClasses/MassFlow.g.cs b/UnitsNet/GeneratedCode/UnitClasses/MassFlow.g.cs index 2288552ba6..297ea46815 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/MassFlow.g.cs @@ -185,6 +185,14 @@ public double KilogramsPerSecond get { return (_gramsPerSecond) / 1e3d; } } + /// + /// Get MassFlow in MegapoundsPerHour. + /// + public double MegapoundsPerHour + { + get { return (_gramsPerSecond*7.93664) / 1e6d; } + } + /// /// Get MassFlow in MicrogramsPerSecond. /// @@ -298,6 +306,14 @@ public static MassFlow FromKilogramsPerSecond(double kilogramspersecond) return new MassFlow((kilogramspersecond) * 1e3d); } + /// + /// Get MassFlow from MegapoundsPerHour. + /// + public static MassFlow FromMegapoundsPerHour(double megapoundsperhour) + { + return new MassFlow((megapoundsperhour/7.93664) * 1e6d); + } + /// /// Get MassFlow from MicrogramsPerSecond. /// @@ -453,6 +469,21 @@ public static MassFlow FromTonnesPerDay(double tonnesperday) } } + /// + /// Get nullable MassFlow from nullable MegapoundsPerHour. + /// + public static MassFlow? FromMegapoundsPerHour(double? megapoundsperhour) + { + if (megapoundsperhour.HasValue) + { + return FromMegapoundsPerHour(megapoundsperhour.Value); + } + else + { + return null; + } + } + /// /// Get nullable MassFlow from nullable MicrogramsPerSecond. /// @@ -569,6 +600,8 @@ public static MassFlow From(double val, MassFlowUnit fromUnit) return FromKilogramsPerHour(val); case MassFlowUnit.KilogramPerSecond: return FromKilogramsPerSecond(val); + case MassFlowUnit.MegapoundPerHour: + return FromMegapoundsPerHour(val); case MassFlowUnit.MicrogramPerSecond: return FromMicrogramsPerSecond(val); case MassFlowUnit.MilligramPerSecond: @@ -617,6 +650,8 @@ public static MassFlow From(double val, MassFlowUnit fromUnit) return FromKilogramsPerHour(value.Value); case MassFlowUnit.KilogramPerSecond: return FromKilogramsPerSecond(value.Value); + case MassFlowUnit.MegapoundPerHour: + return FromMegapoundsPerHour(value.Value); case MassFlowUnit.MicrogramPerSecond: return FromMicrogramsPerSecond(value.Value); case MassFlowUnit.MilligramPerSecond: @@ -800,6 +835,8 @@ public double As(MassFlowUnit unit) return KilogramsPerHour; case MassFlowUnit.KilogramPerSecond: return KilogramsPerSecond; + case MassFlowUnit.MegapoundPerHour: + return MegapoundsPerHour; case MassFlowUnit.MicrogramPerSecond: return MicrogramsPerSecond; case MassFlowUnit.MilligramPerSecond: diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index bcc8f8d2c2..93f22375eb 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -839,6 +839,11 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "ft·lb"), }), + new CulturesForEnumValue((int) EnergyUnit.GigabritishThermalUnit, + new[] + { + new AbbreviationsForCulture("en-US", "mmBTU"), + }), new CulturesForEnumValue((int) EnergyUnit.GigawattHour, new[] { @@ -874,7 +879,7 @@ private static readonly ReadOnlyCollection DefaultLocalization new CulturesForEnumValue((int) EnergyUnit.MegabritishThermalUnit, new[] { - new AbbreviationsForCulture("en-US", "MBTU"), + new AbbreviationsForCulture("en-US", "mBTU"), }), new CulturesForEnumValue((int) EnergyUnit.Megajoule, new[] @@ -1679,6 +1684,11 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "kg/S"), }), + new CulturesForEnumValue((int) MassFlowUnit.MegapoundPerHour, + new[] + { + new AbbreviationsForCulture("en-US", "Mlb/h"), + }), new CulturesForEnumValue((int) MassFlowUnit.MicrogramPerSecond, new[] { diff --git a/UnitsNet/UnitDefinitions/Energy.json b/UnitsNet/UnitDefinitions/Energy.json index e0993b325d..26dd8fe195 100644 --- a/UnitsNet/UnitDefinitions/Energy.json +++ b/UnitsNet/UnitDefinitions/Energy.json @@ -34,11 +34,12 @@ "PluralName": "BritishThermalUnits", "FromUnitToBaseFunc": "x*1055.05585262", "FromBaseToUnitFunc": "x/1055.05585262", - "Prefixes": [ "Kilo", "Mega" ], + "Prefixes": [ "Kilo", "Mega", "Giga" ], "Localization": [ { "Culture": "en-US", - "Abbreviations": [ "BTU" ] + "Abbreviations": [ "BTU" ], + "AbbreviationsWithPrefixes": [ "kBTU", "mBTU", "mmBTU" ] } ] }, diff --git a/UnitsNet/UnitDefinitions/MassFlow.json b/UnitsNet/UnitDefinitions/MassFlow.json index f896c895dc..1833ed6e91 100644 --- a/UnitsNet/UnitDefinitions/MassFlow.json +++ b/UnitsNet/UnitDefinitions/MassFlow.json @@ -37,10 +37,12 @@ "PluralName": "PoundsPerHour", "FromUnitToBaseFunc": "x/7.93664", "FromBaseToUnitFunc": "x*7.93664", + "Prefixes": [ "Mega" ], "Localization": [ { "Culture": "en-US", - "Abbreviations": [ "lb/h" ] + "Abbreviations": [ "lb/h" ], + "AbbreviationsWithPrefixes": [ "Mlb/h" ] } ] }, From 51cc39b2821fc8472d9d3c9181596f37aed018fe Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Tue, 3 Oct 2017 13:48:59 +0300 Subject: [PATCH 14/19] Dublication removed from Energy.json --- .../GeneratedCode/UnitSystem.Default.g.cs | 18 ------ UnitsNet/UnitDefinitions/Energy.json | 57 ------------------- 2 files changed, 75 deletions(-) diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index 668e643880..cd0557bba0 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -910,24 +910,6 @@ private static readonly ReadOnlyCollection DefaultLocalization new AbbreviationsForCulture("en-US", "th (U.S.)"), new AbbreviationsForCulture("ru-RU", "Американский терм"), }), - new CulturesForEnumValue((int) EnergyUnit.ThermEc, - new[] - { - new AbbreviationsForCulture("en-US", "th (E.C.)"), - new AbbreviationsForCulture("ru-RU", "Европейский терм"), - }), - new CulturesForEnumValue((int) EnergyUnit.ThermImperial, - new[] - { - new AbbreviationsForCulture("en-US", "th (imp.)"), - new AbbreviationsForCulture("ru-RU", "Английский терм"), - }), - new CulturesForEnumValue((int) EnergyUnit.ThermUs, - new[] - { - new AbbreviationsForCulture("en-US", "th (U.S.)"), - new AbbreviationsForCulture("ru-RU", "Американский терм"), - }), new CulturesForEnumValue((int) EnergyUnit.WattHour, new[] { diff --git a/UnitsNet/UnitDefinitions/Energy.json b/UnitsNet/UnitDefinitions/Energy.json index c3b223b8f2..26dd8fe195 100644 --- a/UnitsNet/UnitDefinitions/Energy.json +++ b/UnitsNet/UnitDefinitions/Energy.json @@ -134,63 +134,6 @@ } ] }, - { - "SingularName": "ThermImperial", - "PluralName": "ThermsImperial", - "FromUnitToBaseFunc": "x*1.05505585257348e+14", - "FromBaseToUnitFunc": "x/1.05505585257348e+14", - "Prefixes": [ "Deca" ], - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "th (imp.)" ], - "AbbreviationsWithPrefixes": [ "Dth (imp.)" ] - }, - { - "Culture": "ru-RU", - "Abbreviations": [ "Английский терм" ], - "AbbreviationsWithPrefixes": [ "Английский декатерм" ] - } - ] - }, - { - "SingularName": "ThermEc", - "PluralName": "ThermsEc", - "FromUnitToBaseFunc": "x*105505585.262", - "FromBaseToUnitFunc": "x/105505585.262", - "Prefixes": [ "Deca" ], - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "th (E.C.)" ], - "AbbreviationsWithPrefixes": [ "Dth (E.C.)" ] - }, - { - "Culture": "ru-RU", - "Abbreviations": [ "Европейский терм" ], - "AbbreviationsWithPrefixes": [ "Европейский декатерм" ] - } - ] - }, - { - "SingularName": "ThermUs", - "PluralName": "ThermsUs", - "FromUnitToBaseFunc": "x*1.054804e+8", - "FromBaseToUnitFunc": "x/1.054804e+8", - "Prefixes": [ "Deca" ], - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "th (U.S.)" ], - "AbbreviationsWithPrefixes": [ "Dth (U.S.)" ] - }, - { - "Culture": "ru-RU", - "Abbreviations": [ "Американский терм" ], - "AbbreviationsWithPrefixes": [ "Американский декатерм" ] - } - ] - }, { "SingularName": "ThermImperial", "PluralName": "ThermsImperial", From 0f8c226cf1eb9e1850b17b7cfeb8a4f49243cdfc Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Wed, 4 Oct 2017 13:28:01 +0300 Subject: [PATCH 15/19] Changed test values for KilobritishThermalUnitsInOneJoule and MegabritishThermalUnitsInOneJoule --- UnitsNet.Tests/CustomCode/EnergyTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/EnergyTests.cs b/UnitsNet.Tests/CustomCode/EnergyTests.cs index df9a7a241b..25828c5af8 100644 --- a/UnitsNet.Tests/CustomCode/EnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/EnergyTests.cs @@ -28,11 +28,11 @@ public class EnergyTests : EnergyTestsBase protected override double JoulesInOneJoule => 1; - protected override double KilobritishThermalUnitsInOneJoule => 9.4781339449889105832843629746176e-7; + protected override double KilobritishThermalUnitsInOneJoule => 9.4781712e-7; protected override double KilojoulesInOneJoule => 1E-3; - protected override double MegabritishThermalUnitsInOneJoule => 9.4781339449889105832843629746176e-10; + protected override double MegabritishThermalUnitsInOneJoule => 9.4781712e-10; protected override double MegajoulesInOneJoule => 1E-6; From 9bbcab5b0abac2b868f9993809328ad6b488c80c Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Wed, 4 Oct 2017 22:40:40 +0300 Subject: [PATCH 16/19] Some more adjustments --- UnitsNet.Tests/CustomCode/EnergyTests.cs | 2 +- UnitsNet.Tests/CustomCode/FlowTests.cs | 2 +- UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs | 4 ++-- UnitsNet/UnitDefinitions/Flow.json | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/EnergyTests.cs b/UnitsNet.Tests/CustomCode/EnergyTests.cs index 25828c5af8..717fc8c877 100644 --- a/UnitsNet.Tests/CustomCode/EnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/EnergyTests.cs @@ -54,7 +54,7 @@ public class EnergyTests : EnergyTestsBase protected override double FootPoundsInOneJoule => 0.737562149; - protected override double GigabritishThermalUnitsInOneJoule => 9.4781339449889105832843629746176e-13; + protected override double GigabritishThermalUnitsInOneJoule => 9.4781712e-13; protected override double GigawattHoursInOneJoule => 2.77777778e-13; diff --git a/UnitsNet.Tests/CustomCode/FlowTests.cs b/UnitsNet.Tests/CustomCode/FlowTests.cs index b96787ec35..942664b94c 100644 --- a/UnitsNet.Tests/CustomCode/FlowTests.cs +++ b/UnitsNet.Tests/CustomCode/FlowTests.cs @@ -27,7 +27,7 @@ public class FlowTests : FlowTestsBase protected override double CubicDecimetersPerMinuteInOneCubicMeterPerSecond => 60000.00000; - protected override double CubicFeetPerHourInOneCubicMeterPerSecond => 1.2713300937959091422759633856933e+5; + protected override double CubicFeetPerHourInOneCubicMeterPerSecond => 1.271327983668e+5; protected override double CubicFeetPerSecondInOneCubicMeterPerSecond => 35.314666213; diff --git a/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs index 2bac616b4a..1206a31942 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs @@ -150,7 +150,7 @@ public double CubicDecimetersPerMinute /// public double CubicFeetPerHour { - get { return _cubicMetersPerSecond/7.8657777777777777777777777777778e-6; } + get { return _cubicMetersPerSecond/7.8657908332578971664023576305118e-6; } } /// @@ -295,7 +295,7 @@ public static Flow FromCubicDecimetersPerMinute(double cubicdecimetersperminute) /// public static Flow FromCubicFeetPerHour(double cubicfeetperhour) { - return new Flow(cubicfeetperhour*7.8657777777777777777777777777778e-6); + return new Flow(cubicfeetperhour*7.8657908332578971664023576305118e-6); } /// diff --git a/UnitsNet/UnitDefinitions/Flow.json b/UnitsNet/UnitDefinitions/Flow.json index b1031ebc50..3fbf760d81 100644 --- a/UnitsNet/UnitDefinitions/Flow.json +++ b/UnitsNet/UnitDefinitions/Flow.json @@ -145,8 +145,8 @@ { "SingularName": "CubicFootPerHour", "PluralName": "CubicFeetPerHour", - "FromUnitToBaseFunc": "x*7.8657777777777777777777777777778e-6", - "FromBaseToUnitFunc": "x/7.8657777777777777777777777777778e-6", + "FromUnitToBaseFunc": "x*7.8657908332578971664023576305118e-6", + "FromBaseToUnitFunc": "x/7.8657908332578971664023576305118e-6", "Localization": [ { "Culture": "en-US", From fb8f405983e9e9aa08d3ac908bfb09ec78e23225 Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Thu, 5 Oct 2017 13:38:46 +0300 Subject: [PATCH 17/19] Some corrections for 'CubicFootPerSecond' and 'CubicFootPerHour' values. --- UnitsNet.Tests/CustomCode/FlowTests.cs | 4 ++-- UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs | 8 ++++---- UnitsNet/UnitDefinitions/Flow.json | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/FlowTests.cs b/UnitsNet.Tests/CustomCode/FlowTests.cs index 942664b94c..a819f7d9f2 100644 --- a/UnitsNet.Tests/CustomCode/FlowTests.cs +++ b/UnitsNet.Tests/CustomCode/FlowTests.cs @@ -27,9 +27,9 @@ public class FlowTests : FlowTestsBase protected override double CubicDecimetersPerMinuteInOneCubicMeterPerSecond => 60000.00000; - protected override double CubicFeetPerHourInOneCubicMeterPerSecond => 1.271327983668e+5; + protected override double CubicFeetPerHourInOneCubicMeterPerSecond => 1.271328001973604e+5; - protected override double CubicFeetPerSecondInOneCubicMeterPerSecond => 35.314666213; + protected override double CubicFeetPerSecondInOneCubicMeterPerSecond => 35.314666721489; protected override double MillionUsGallonsPerDayInOneCubicMeterPerSecond => 22.824465227; diff --git a/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs index 1206a31942..0fc77a64ba 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs @@ -150,7 +150,7 @@ public double CubicDecimetersPerMinute /// public double CubicFeetPerHour { - get { return _cubicMetersPerSecond/7.8657908332578971664023576305118e-6; } + get { return _cubicMetersPerSecond/7.8657907199999087346816086183876e-6; } } /// @@ -158,7 +158,7 @@ public double CubicFeetPerHour /// public double CubicFeetPerSecond { - get { return _cubicMetersPerSecond*35.314666213; } + get { return _cubicMetersPerSecond*35.314666721; } } /// @@ -295,7 +295,7 @@ public static Flow FromCubicDecimetersPerMinute(double cubicdecimetersperminute) /// public static Flow FromCubicFeetPerHour(double cubicfeetperhour) { - return new Flow(cubicfeetperhour*7.8657908332578971664023576305118e-6); + return new Flow(cubicfeetperhour*7.8657907199999087346816086183876e-6); } /// @@ -303,7 +303,7 @@ public static Flow FromCubicFeetPerHour(double cubicfeetperhour) /// public static Flow FromCubicFeetPerSecond(double cubicfeetpersecond) { - return new Flow(cubicfeetpersecond/35.314666213); + return new Flow(cubicfeetpersecond/35.314666721); } /// diff --git a/UnitsNet/UnitDefinitions/Flow.json b/UnitsNet/UnitDefinitions/Flow.json index 3fbf760d81..ccdf8ffebf 100644 --- a/UnitsNet/UnitDefinitions/Flow.json +++ b/UnitsNet/UnitDefinitions/Flow.json @@ -38,8 +38,8 @@ { "SingularName": "CubicFootPerSecond", "PluralName": "CubicFeetPerSecond", - "FromUnitToBaseFunc": "x/35.314666213", - "FromBaseToUnitFunc": "x*35.314666213", + "FromUnitToBaseFunc": "x/35.314666721", + "FromBaseToUnitFunc": "x*35.314666721", "Localization": [ { "Culture": "en-US", @@ -145,8 +145,8 @@ { "SingularName": "CubicFootPerHour", "PluralName": "CubicFeetPerHour", - "FromUnitToBaseFunc": "x*7.8657908332578971664023576305118e-6", - "FromBaseToUnitFunc": "x/7.8657908332578971664023576305118e-6", + "FromUnitToBaseFunc": "x*7.8657907199999087346816086183876e-6", + "FromBaseToUnitFunc": "x/7.8657907199999087346816086183876e-6", "Localization": [ { "Culture": "en-US", From 997a383cf7192391f23998a8dad2883722aaf84d Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Fri, 24 Apr 2020 19:15:21 +0300 Subject: [PATCH 18/19] Added 'Deca', 'Hecto' prefixes for 'UsGallons' --- Common/UnitDefinitions/Volume.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/UnitDefinitions/Volume.json b/Common/UnitDefinitions/Volume.json index d2e87ac4b2..a156b03392 100644 --- a/Common/UnitDefinitions/Volume.json +++ b/Common/UnitDefinitions/Volume.json @@ -242,7 +242,7 @@ "PluralName": "UsGallons", "FromUnitToBaseFunc": "x*0.00378541", "FromBaseToUnitFunc": "x/0.00378541", - "Prefixes": [ "Kilo", "Mega" ], + "Prefixes": [ "Deca", "Hecto", "Kilo", "Mega" ], "Localization": [ { "Culture": "en-US", From b83b8d220ecacbbb218b72a663948a94475dc1c0 Mon Sep 17 00:00:00 2001 From: Dmitriy Inozemtsev Date: Fri, 24 Apr 2020 20:21:19 +0300 Subject: [PATCH 19/19] Added "Deci" prefix and tests --- Common/UnitDefinitions/Volume.json | 2 +- .../NumberToVolumeExtensionsTest.g.cs | 12 + .../NumberToVolumeExtensions.g.cs | 12 + UnitsNet.Tests/CustomCode/VolumeTests.cs | 5 + .../TestsBase/VolumeTestsBase.g.cs | 243 +++++++++++------- .../GeneratedCode/Quantities/Volume.g.cs | 51 ++++ .../GeneratedCode/UnitAbbreviationsCache.g.cs | 6 + .../GeneratedCode/Units/VolumeUnit.g.cs | 3 + UnitsNet/GeneratedCode/Quantities/Volume.g.cs | 51 ++++ .../GeneratedCode/UnitAbbreviationsCache.g.cs | 6 + UnitsNet/GeneratedCode/UnitConverter.g.cs | 6 + UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs | 3 + 12 files changed, 300 insertions(+), 100 deletions(-) diff --git a/Common/UnitDefinitions/Volume.json b/Common/UnitDefinitions/Volume.json index a156b03392..f1d933dbe9 100644 --- a/Common/UnitDefinitions/Volume.json +++ b/Common/UnitDefinitions/Volume.json @@ -242,7 +242,7 @@ "PluralName": "UsGallons", "FromUnitToBaseFunc": "x*0.00378541", "FromBaseToUnitFunc": "x/0.00378541", - "Prefixes": [ "Deca", "Hecto", "Kilo", "Mega" ], + "Prefixes": [ "Deca", "Deci", "Hecto", "Kilo", "Mega" ], "Localization": [ { "Culture": "en-US", diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeExtensionsTest.g.cs index 7db2fa9c11..9086c1d7f9 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeExtensionsTest.g.cs @@ -80,10 +80,18 @@ public void NumberToCubicMillimetersTest() => public void NumberToCubicYardsTest() => Assert.Equal(Volume.FromCubicYards(2), 2.CubicYards()); + [Fact] + public void NumberToDecausGallonsTest() => + Assert.Equal(Volume.FromDecausGallons(2), 2.DecausGallons()); + [Fact] public void NumberToDecilitersTest() => Assert.Equal(Volume.FromDeciliters(2), 2.Deciliters()); + [Fact] + public void NumberToDeciusGallonsTest() => + Assert.Equal(Volume.FromDeciusGallons(2), 2.DeciusGallons()); + [Fact] public void NumberToHectocubicFeetTest() => Assert.Equal(Volume.FromHectocubicFeet(2), 2.HectocubicFeet()); @@ -96,6 +104,10 @@ public void NumberToHectocubicMetersTest() => public void NumberToHectolitersTest() => Assert.Equal(Volume.FromHectoliters(2), 2.Hectoliters()); + [Fact] + public void NumberToHectousGallonsTest() => + Assert.Equal(Volume.FromHectousGallons(2), 2.HectousGallons()); + [Fact] public void NumberToImperialBeerBarrelsTest() => Assert.Equal(Volume.FromImperialBeerBarrels(2), 2.ImperialBeerBarrels()); diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeExtensions.g.cs index b037633869..2fc02fa339 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeExtensions.g.cs @@ -82,10 +82,18 @@ public static Volume CubicMillimeters(this T value) => public static Volume CubicYards(this T value) => Volume.FromCubicYards(Convert.ToDouble(value)); + /// + public static Volume DecausGallons(this T value) => + Volume.FromDecausGallons(Convert.ToDouble(value)); + /// public static Volume Deciliters(this T value) => Volume.FromDeciliters(Convert.ToDouble(value)); + /// + public static Volume DeciusGallons(this T value) => + Volume.FromDeciusGallons(Convert.ToDouble(value)); + /// public static Volume HectocubicFeet(this T value) => Volume.FromHectocubicFeet(Convert.ToDouble(value)); @@ -98,6 +106,10 @@ public static Volume HectocubicMeters(this T value) => public static Volume Hectoliters(this T value) => Volume.FromHectoliters(Convert.ToDouble(value)); + /// + public static Volume HectousGallons(this T value) => + Volume.FromHectousGallons(Convert.ToDouble(value)); + /// public static Volume ImperialBeerBarrels(this T value) => Volume.FromImperialBeerBarrels(Convert.ToDouble(value)); diff --git a/UnitsNet.Tests/CustomCode/VolumeTests.cs b/UnitsNet.Tests/CustomCode/VolumeTests.cs index ad6c2dca04..41720c53d4 100644 --- a/UnitsNet.Tests/CustomCode/VolumeTests.cs +++ b/UnitsNet.Tests/CustomCode/VolumeTests.cs @@ -32,12 +32,17 @@ public class VolumeTests : VolumeTestsBase protected override double CubicYardsInOneCubicMeter => 1.30795062; + protected override double DecausGallonsInOneCubicMeter => 2.6417217e+1; + protected override double DecilitersInOneCubicMeter => 1E4; + protected override double DeciusGallonsInOneCubicMeter => 2.6417217e+3; protected override double HectocubicFeetInOneCubicMeter => 3.531472e-1; protected override double HectocubicMetersInOneCubicMeter => 0.01; protected override double HectolitersInOneCubicMeter => 1E1; + protected override double HectousGallonsInOneCubicMeter => 2.6417217; + protected override double ImperialGallonsInOneCubicMeter => 219.96924; protected override double ImperialOuncesInOneCubicMeter => 35195.07972; diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs index 9cf267017e..171d19ac38 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs @@ -50,10 +50,13 @@ public abstract partial class VolumeTestsBase protected abstract double CubicMilesInOneCubicMeter { get; } protected abstract double CubicMillimetersInOneCubicMeter { get; } protected abstract double CubicYardsInOneCubicMeter { get; } + protected abstract double DecausGallonsInOneCubicMeter { get; } protected abstract double DecilitersInOneCubicMeter { get; } + protected abstract double DeciusGallonsInOneCubicMeter { get; } protected abstract double HectocubicFeetInOneCubicMeter { get; } protected abstract double HectocubicMetersInOneCubicMeter { get; } protected abstract double HectolitersInOneCubicMeter { get; } + protected abstract double HectousGallonsInOneCubicMeter { get; } protected abstract double ImperialBeerBarrelsInOneCubicMeter { get; } protected abstract double ImperialGallonsInOneCubicMeter { get; } protected abstract double ImperialOuncesInOneCubicMeter { get; } @@ -99,10 +102,13 @@ public abstract partial class VolumeTestsBase protected virtual double CubicMilesTolerance { get { return 1e-5; } } protected virtual double CubicMillimetersTolerance { get { return 1e-5; } } protected virtual double CubicYardsTolerance { get { return 1e-5; } } + protected virtual double DecausGallonsTolerance { get { return 1e-5; } } protected virtual double DecilitersTolerance { get { return 1e-5; } } + protected virtual double DeciusGallonsTolerance { get { return 1e-5; } } protected virtual double HectocubicFeetTolerance { get { return 1e-5; } } protected virtual double HectocubicMetersTolerance { get { return 1e-5; } } protected virtual double HectolitersTolerance { get { return 1e-5; } } + protected virtual double HectousGallonsTolerance { get { return 1e-5; } } protected virtual double ImperialBeerBarrelsTolerance { get { return 1e-5; } } protected virtual double ImperialGallonsTolerance { get { return 1e-5; } } protected virtual double ImperialOuncesTolerance { get { return 1e-5; } } @@ -207,10 +213,13 @@ public void CubicMeterToVolumeUnits() AssertEx.EqualTolerance(CubicMilesInOneCubicMeter, cubicmeter.CubicMiles, CubicMilesTolerance); AssertEx.EqualTolerance(CubicMillimetersInOneCubicMeter, cubicmeter.CubicMillimeters, CubicMillimetersTolerance); AssertEx.EqualTolerance(CubicYardsInOneCubicMeter, cubicmeter.CubicYards, CubicYardsTolerance); + AssertEx.EqualTolerance(DecausGallonsInOneCubicMeter, cubicmeter.DecausGallons, DecausGallonsTolerance); AssertEx.EqualTolerance(DecilitersInOneCubicMeter, cubicmeter.Deciliters, DecilitersTolerance); + AssertEx.EqualTolerance(DeciusGallonsInOneCubicMeter, cubicmeter.DeciusGallons, DeciusGallonsTolerance); AssertEx.EqualTolerance(HectocubicFeetInOneCubicMeter, cubicmeter.HectocubicFeet, HectocubicFeetTolerance); AssertEx.EqualTolerance(HectocubicMetersInOneCubicMeter, cubicmeter.HectocubicMeters, HectocubicMetersTolerance); AssertEx.EqualTolerance(HectolitersInOneCubicMeter, cubicmeter.Hectoliters, HectolitersTolerance); + AssertEx.EqualTolerance(HectousGallonsInOneCubicMeter, cubicmeter.HectousGallons, HectousGallonsTolerance); AssertEx.EqualTolerance(ImperialBeerBarrelsInOneCubicMeter, cubicmeter.ImperialBeerBarrels, ImperialBeerBarrelsTolerance); AssertEx.EqualTolerance(ImperialGallonsInOneCubicMeter, cubicmeter.ImperialGallons, ImperialGallonsTolerance); AssertEx.EqualTolerance(ImperialOuncesInOneCubicMeter, cubicmeter.ImperialOunces, ImperialOuncesTolerance); @@ -301,137 +310,149 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() AssertEx.EqualTolerance(1, quantity13.CubicYards, CubicYardsTolerance); Assert.Equal(VolumeUnit.CubicYard, quantity13.Unit); - var quantity14 = Volume.From(1, VolumeUnit.Deciliter); - AssertEx.EqualTolerance(1, quantity14.Deciliters, DecilitersTolerance); - Assert.Equal(VolumeUnit.Deciliter, quantity14.Unit); + var quantity14 = Volume.From(1, VolumeUnit.DecausGallon); + AssertEx.EqualTolerance(1, quantity14.DecausGallons, DecausGallonsTolerance); + Assert.Equal(VolumeUnit.DecausGallon, quantity14.Unit); - var quantity15 = Volume.From(1, VolumeUnit.HectocubicFoot); - AssertEx.EqualTolerance(1, quantity15.HectocubicFeet, HectocubicFeetTolerance); - Assert.Equal(VolumeUnit.HectocubicFoot, quantity15.Unit); + var quantity15 = Volume.From(1, VolumeUnit.Deciliter); + AssertEx.EqualTolerance(1, quantity15.Deciliters, DecilitersTolerance); + Assert.Equal(VolumeUnit.Deciliter, quantity15.Unit); - var quantity16 = Volume.From(1, VolumeUnit.HectocubicMeter); - AssertEx.EqualTolerance(1, quantity16.HectocubicMeters, HectocubicMetersTolerance); - Assert.Equal(VolumeUnit.HectocubicMeter, quantity16.Unit); + var quantity16 = Volume.From(1, VolumeUnit.DeciusGallon); + AssertEx.EqualTolerance(1, quantity16.DeciusGallons, DeciusGallonsTolerance); + Assert.Equal(VolumeUnit.DeciusGallon, quantity16.Unit); - var quantity17 = Volume.From(1, VolumeUnit.Hectoliter); - AssertEx.EqualTolerance(1, quantity17.Hectoliters, HectolitersTolerance); - Assert.Equal(VolumeUnit.Hectoliter, quantity17.Unit); + var quantity17 = Volume.From(1, VolumeUnit.HectocubicFoot); + AssertEx.EqualTolerance(1, quantity17.HectocubicFeet, HectocubicFeetTolerance); + Assert.Equal(VolumeUnit.HectocubicFoot, quantity17.Unit); - var quantity18 = Volume.From(1, VolumeUnit.ImperialBeerBarrel); - AssertEx.EqualTolerance(1, quantity18.ImperialBeerBarrels, ImperialBeerBarrelsTolerance); - Assert.Equal(VolumeUnit.ImperialBeerBarrel, quantity18.Unit); + var quantity18 = Volume.From(1, VolumeUnit.HectocubicMeter); + AssertEx.EqualTolerance(1, quantity18.HectocubicMeters, HectocubicMetersTolerance); + Assert.Equal(VolumeUnit.HectocubicMeter, quantity18.Unit); - var quantity19 = Volume.From(1, VolumeUnit.ImperialGallon); - AssertEx.EqualTolerance(1, quantity19.ImperialGallons, ImperialGallonsTolerance); - Assert.Equal(VolumeUnit.ImperialGallon, quantity19.Unit); + var quantity19 = Volume.From(1, VolumeUnit.Hectoliter); + AssertEx.EqualTolerance(1, quantity19.Hectoliters, HectolitersTolerance); + Assert.Equal(VolumeUnit.Hectoliter, quantity19.Unit); - var quantity20 = Volume.From(1, VolumeUnit.ImperialOunce); - AssertEx.EqualTolerance(1, quantity20.ImperialOunces, ImperialOuncesTolerance); - Assert.Equal(VolumeUnit.ImperialOunce, quantity20.Unit); + var quantity20 = Volume.From(1, VolumeUnit.HectousGallon); + AssertEx.EqualTolerance(1, quantity20.HectousGallons, HectousGallonsTolerance); + Assert.Equal(VolumeUnit.HectousGallon, quantity20.Unit); - var quantity21 = Volume.From(1, VolumeUnit.ImperialPint); - AssertEx.EqualTolerance(1, quantity21.ImperialPints, ImperialPintsTolerance); - Assert.Equal(VolumeUnit.ImperialPint, quantity21.Unit); + var quantity21 = Volume.From(1, VolumeUnit.ImperialBeerBarrel); + AssertEx.EqualTolerance(1, quantity21.ImperialBeerBarrels, ImperialBeerBarrelsTolerance); + Assert.Equal(VolumeUnit.ImperialBeerBarrel, quantity21.Unit); - var quantity22 = Volume.From(1, VolumeUnit.KilocubicFoot); - AssertEx.EqualTolerance(1, quantity22.KilocubicFeet, KilocubicFeetTolerance); - Assert.Equal(VolumeUnit.KilocubicFoot, quantity22.Unit); + var quantity22 = Volume.From(1, VolumeUnit.ImperialGallon); + AssertEx.EqualTolerance(1, quantity22.ImperialGallons, ImperialGallonsTolerance); + Assert.Equal(VolumeUnit.ImperialGallon, quantity22.Unit); - var quantity23 = Volume.From(1, VolumeUnit.KilocubicMeter); - AssertEx.EqualTolerance(1, quantity23.KilocubicMeters, KilocubicMetersTolerance); - Assert.Equal(VolumeUnit.KilocubicMeter, quantity23.Unit); + var quantity23 = Volume.From(1, VolumeUnit.ImperialOunce); + AssertEx.EqualTolerance(1, quantity23.ImperialOunces, ImperialOuncesTolerance); + Assert.Equal(VolumeUnit.ImperialOunce, quantity23.Unit); - var quantity24 = Volume.From(1, VolumeUnit.KiloimperialGallon); - AssertEx.EqualTolerance(1, quantity24.KiloimperialGallons, KiloimperialGallonsTolerance); - Assert.Equal(VolumeUnit.KiloimperialGallon, quantity24.Unit); + var quantity24 = Volume.From(1, VolumeUnit.ImperialPint); + AssertEx.EqualTolerance(1, quantity24.ImperialPints, ImperialPintsTolerance); + Assert.Equal(VolumeUnit.ImperialPint, quantity24.Unit); - var quantity25 = Volume.From(1, VolumeUnit.Kiloliter); - AssertEx.EqualTolerance(1, quantity25.Kiloliters, KilolitersTolerance); - Assert.Equal(VolumeUnit.Kiloliter, quantity25.Unit); + var quantity25 = Volume.From(1, VolumeUnit.KilocubicFoot); + AssertEx.EqualTolerance(1, quantity25.KilocubicFeet, KilocubicFeetTolerance); + Assert.Equal(VolumeUnit.KilocubicFoot, quantity25.Unit); - var quantity26 = Volume.From(1, VolumeUnit.KilousGallon); - AssertEx.EqualTolerance(1, quantity26.KilousGallons, KilousGallonsTolerance); - Assert.Equal(VolumeUnit.KilousGallon, quantity26.Unit); + var quantity26 = Volume.From(1, VolumeUnit.KilocubicMeter); + AssertEx.EqualTolerance(1, quantity26.KilocubicMeters, KilocubicMetersTolerance); + Assert.Equal(VolumeUnit.KilocubicMeter, quantity26.Unit); - var quantity27 = Volume.From(1, VolumeUnit.Liter); - AssertEx.EqualTolerance(1, quantity27.Liters, LitersTolerance); - Assert.Equal(VolumeUnit.Liter, quantity27.Unit); + var quantity27 = Volume.From(1, VolumeUnit.KiloimperialGallon); + AssertEx.EqualTolerance(1, quantity27.KiloimperialGallons, KiloimperialGallonsTolerance); + Assert.Equal(VolumeUnit.KiloimperialGallon, quantity27.Unit); - var quantity28 = Volume.From(1, VolumeUnit.MegacubicFoot); - AssertEx.EqualTolerance(1, quantity28.MegacubicFeet, MegacubicFeetTolerance); - Assert.Equal(VolumeUnit.MegacubicFoot, quantity28.Unit); + var quantity28 = Volume.From(1, VolumeUnit.Kiloliter); + AssertEx.EqualTolerance(1, quantity28.Kiloliters, KilolitersTolerance); + Assert.Equal(VolumeUnit.Kiloliter, quantity28.Unit); - var quantity29 = Volume.From(1, VolumeUnit.MegaimperialGallon); - AssertEx.EqualTolerance(1, quantity29.MegaimperialGallons, MegaimperialGallonsTolerance); - Assert.Equal(VolumeUnit.MegaimperialGallon, quantity29.Unit); + var quantity29 = Volume.From(1, VolumeUnit.KilousGallon); + AssertEx.EqualTolerance(1, quantity29.KilousGallons, KilousGallonsTolerance); + Assert.Equal(VolumeUnit.KilousGallon, quantity29.Unit); - var quantity30 = Volume.From(1, VolumeUnit.Megaliter); - AssertEx.EqualTolerance(1, quantity30.Megaliters, MegalitersTolerance); - Assert.Equal(VolumeUnit.Megaliter, quantity30.Unit); + var quantity30 = Volume.From(1, VolumeUnit.Liter); + AssertEx.EqualTolerance(1, quantity30.Liters, LitersTolerance); + Assert.Equal(VolumeUnit.Liter, quantity30.Unit); - var quantity31 = Volume.From(1, VolumeUnit.MegausGallon); - AssertEx.EqualTolerance(1, quantity31.MegausGallons, MegausGallonsTolerance); - Assert.Equal(VolumeUnit.MegausGallon, quantity31.Unit); + var quantity31 = Volume.From(1, VolumeUnit.MegacubicFoot); + AssertEx.EqualTolerance(1, quantity31.MegacubicFeet, MegacubicFeetTolerance); + Assert.Equal(VolumeUnit.MegacubicFoot, quantity31.Unit); - var quantity32 = Volume.From(1, VolumeUnit.MetricCup); - AssertEx.EqualTolerance(1, quantity32.MetricCups, MetricCupsTolerance); - Assert.Equal(VolumeUnit.MetricCup, quantity32.Unit); + var quantity32 = Volume.From(1, VolumeUnit.MegaimperialGallon); + AssertEx.EqualTolerance(1, quantity32.MegaimperialGallons, MegaimperialGallonsTolerance); + Assert.Equal(VolumeUnit.MegaimperialGallon, quantity32.Unit); - var quantity33 = Volume.From(1, VolumeUnit.MetricTeaspoon); - AssertEx.EqualTolerance(1, quantity33.MetricTeaspoons, MetricTeaspoonsTolerance); - Assert.Equal(VolumeUnit.MetricTeaspoon, quantity33.Unit); + var quantity33 = Volume.From(1, VolumeUnit.Megaliter); + AssertEx.EqualTolerance(1, quantity33.Megaliters, MegalitersTolerance); + Assert.Equal(VolumeUnit.Megaliter, quantity33.Unit); - var quantity34 = Volume.From(1, VolumeUnit.Microliter); - AssertEx.EqualTolerance(1, quantity34.Microliters, MicrolitersTolerance); - Assert.Equal(VolumeUnit.Microliter, quantity34.Unit); + var quantity34 = Volume.From(1, VolumeUnit.MegausGallon); + AssertEx.EqualTolerance(1, quantity34.MegausGallons, MegausGallonsTolerance); + Assert.Equal(VolumeUnit.MegausGallon, quantity34.Unit); - var quantity35 = Volume.From(1, VolumeUnit.Milliliter); - AssertEx.EqualTolerance(1, quantity35.Milliliters, MillilitersTolerance); - Assert.Equal(VolumeUnit.Milliliter, quantity35.Unit); + var quantity35 = Volume.From(1, VolumeUnit.MetricCup); + AssertEx.EqualTolerance(1, quantity35.MetricCups, MetricCupsTolerance); + Assert.Equal(VolumeUnit.MetricCup, quantity35.Unit); - var quantity36 = Volume.From(1, VolumeUnit.OilBarrel); - AssertEx.EqualTolerance(1, quantity36.OilBarrels, OilBarrelsTolerance); - Assert.Equal(VolumeUnit.OilBarrel, quantity36.Unit); + var quantity36 = Volume.From(1, VolumeUnit.MetricTeaspoon); + AssertEx.EqualTolerance(1, quantity36.MetricTeaspoons, MetricTeaspoonsTolerance); + Assert.Equal(VolumeUnit.MetricTeaspoon, quantity36.Unit); - var quantity37 = Volume.From(1, VolumeUnit.UkTablespoon); - AssertEx.EqualTolerance(1, quantity37.UkTablespoons, UkTablespoonsTolerance); - Assert.Equal(VolumeUnit.UkTablespoon, quantity37.Unit); + var quantity37 = Volume.From(1, VolumeUnit.Microliter); + AssertEx.EqualTolerance(1, quantity37.Microliters, MicrolitersTolerance); + Assert.Equal(VolumeUnit.Microliter, quantity37.Unit); - var quantity38 = Volume.From(1, VolumeUnit.UsBeerBarrel); - AssertEx.EqualTolerance(1, quantity38.UsBeerBarrels, UsBeerBarrelsTolerance); - Assert.Equal(VolumeUnit.UsBeerBarrel, quantity38.Unit); + var quantity38 = Volume.From(1, VolumeUnit.Milliliter); + AssertEx.EqualTolerance(1, quantity38.Milliliters, MillilitersTolerance); + Assert.Equal(VolumeUnit.Milliliter, quantity38.Unit); - var quantity39 = Volume.From(1, VolumeUnit.UsCustomaryCup); - AssertEx.EqualTolerance(1, quantity39.UsCustomaryCups, UsCustomaryCupsTolerance); - Assert.Equal(VolumeUnit.UsCustomaryCup, quantity39.Unit); + var quantity39 = Volume.From(1, VolumeUnit.OilBarrel); + AssertEx.EqualTolerance(1, quantity39.OilBarrels, OilBarrelsTolerance); + Assert.Equal(VolumeUnit.OilBarrel, quantity39.Unit); - var quantity40 = Volume.From(1, VolumeUnit.UsGallon); - AssertEx.EqualTolerance(1, quantity40.UsGallons, UsGallonsTolerance); - Assert.Equal(VolumeUnit.UsGallon, quantity40.Unit); + var quantity40 = Volume.From(1, VolumeUnit.UkTablespoon); + AssertEx.EqualTolerance(1, quantity40.UkTablespoons, UkTablespoonsTolerance); + Assert.Equal(VolumeUnit.UkTablespoon, quantity40.Unit); - var quantity41 = Volume.From(1, VolumeUnit.UsLegalCup); - AssertEx.EqualTolerance(1, quantity41.UsLegalCups, UsLegalCupsTolerance); - Assert.Equal(VolumeUnit.UsLegalCup, quantity41.Unit); + var quantity41 = Volume.From(1, VolumeUnit.UsBeerBarrel); + AssertEx.EqualTolerance(1, quantity41.UsBeerBarrels, UsBeerBarrelsTolerance); + Assert.Equal(VolumeUnit.UsBeerBarrel, quantity41.Unit); - var quantity42 = Volume.From(1, VolumeUnit.UsOunce); - AssertEx.EqualTolerance(1, quantity42.UsOunces, UsOuncesTolerance); - Assert.Equal(VolumeUnit.UsOunce, quantity42.Unit); + var quantity42 = Volume.From(1, VolumeUnit.UsCustomaryCup); + AssertEx.EqualTolerance(1, quantity42.UsCustomaryCups, UsCustomaryCupsTolerance); + Assert.Equal(VolumeUnit.UsCustomaryCup, quantity42.Unit); - var quantity43 = Volume.From(1, VolumeUnit.UsPint); - AssertEx.EqualTolerance(1, quantity43.UsPints, UsPintsTolerance); - Assert.Equal(VolumeUnit.UsPint, quantity43.Unit); + var quantity43 = Volume.From(1, VolumeUnit.UsGallon); + AssertEx.EqualTolerance(1, quantity43.UsGallons, UsGallonsTolerance); + Assert.Equal(VolumeUnit.UsGallon, quantity43.Unit); - var quantity44 = Volume.From(1, VolumeUnit.UsQuart); - AssertEx.EqualTolerance(1, quantity44.UsQuarts, UsQuartsTolerance); - Assert.Equal(VolumeUnit.UsQuart, quantity44.Unit); + var quantity44 = Volume.From(1, VolumeUnit.UsLegalCup); + AssertEx.EqualTolerance(1, quantity44.UsLegalCups, UsLegalCupsTolerance); + Assert.Equal(VolumeUnit.UsLegalCup, quantity44.Unit); - var quantity45 = Volume.From(1, VolumeUnit.UsTablespoon); - AssertEx.EqualTolerance(1, quantity45.UsTablespoons, UsTablespoonsTolerance); - Assert.Equal(VolumeUnit.UsTablespoon, quantity45.Unit); + var quantity45 = Volume.From(1, VolumeUnit.UsOunce); + AssertEx.EqualTolerance(1, quantity45.UsOunces, UsOuncesTolerance); + Assert.Equal(VolumeUnit.UsOunce, quantity45.Unit); - var quantity46 = Volume.From(1, VolumeUnit.UsTeaspoon); - AssertEx.EqualTolerance(1, quantity46.UsTeaspoons, UsTeaspoonsTolerance); - Assert.Equal(VolumeUnit.UsTeaspoon, quantity46.Unit); + var quantity46 = Volume.From(1, VolumeUnit.UsPint); + AssertEx.EqualTolerance(1, quantity46.UsPints, UsPintsTolerance); + Assert.Equal(VolumeUnit.UsPint, quantity46.Unit); + + var quantity47 = Volume.From(1, VolumeUnit.UsQuart); + AssertEx.EqualTolerance(1, quantity47.UsQuarts, UsQuartsTolerance); + Assert.Equal(VolumeUnit.UsQuart, quantity47.Unit); + + var quantity48 = Volume.From(1, VolumeUnit.UsTablespoon); + AssertEx.EqualTolerance(1, quantity48.UsTablespoons, UsTablespoonsTolerance); + Assert.Equal(VolumeUnit.UsTablespoon, quantity48.Unit); + + var quantity49 = Volume.From(1, VolumeUnit.UsTeaspoon); + AssertEx.EqualTolerance(1, quantity49.UsTeaspoons, UsTeaspoonsTolerance); + Assert.Equal(VolumeUnit.UsTeaspoon, quantity49.Unit); } @@ -466,10 +487,13 @@ public void As() AssertEx.EqualTolerance(CubicMilesInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicMile), CubicMilesTolerance); AssertEx.EqualTolerance(CubicMillimetersInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicMillimeter), CubicMillimetersTolerance); AssertEx.EqualTolerance(CubicYardsInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicYard), CubicYardsTolerance); + AssertEx.EqualTolerance(DecausGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.DecausGallon), DecausGallonsTolerance); AssertEx.EqualTolerance(DecilitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Deciliter), DecilitersTolerance); + AssertEx.EqualTolerance(DeciusGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.DeciusGallon), DeciusGallonsTolerance); AssertEx.EqualTolerance(HectocubicFeetInOneCubicMeter, cubicmeter.As(VolumeUnit.HectocubicFoot), HectocubicFeetTolerance); AssertEx.EqualTolerance(HectocubicMetersInOneCubicMeter, cubicmeter.As(VolumeUnit.HectocubicMeter), HectocubicMetersTolerance); AssertEx.EqualTolerance(HectolitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Hectoliter), HectolitersTolerance); + AssertEx.EqualTolerance(HectousGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.HectousGallon), HectousGallonsTolerance); AssertEx.EqualTolerance(ImperialBeerBarrelsInOneCubicMeter, cubicmeter.As(VolumeUnit.ImperialBeerBarrel), ImperialBeerBarrelsTolerance); AssertEx.EqualTolerance(ImperialGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.ImperialGallon), ImperialGallonsTolerance); AssertEx.EqualTolerance(ImperialOuncesInOneCubicMeter, cubicmeter.As(VolumeUnit.ImperialOunce), ImperialOuncesTolerance); @@ -562,10 +586,18 @@ public void ToUnit() AssertEx.EqualTolerance(CubicYardsInOneCubicMeter, (double)cubicyardQuantity.Value, CubicYardsTolerance); Assert.Equal(VolumeUnit.CubicYard, cubicyardQuantity.Unit); + var decausgallonQuantity = cubicmeter.ToUnit(VolumeUnit.DecausGallon); + AssertEx.EqualTolerance(DecausGallonsInOneCubicMeter, (double)decausgallonQuantity.Value, DecausGallonsTolerance); + Assert.Equal(VolumeUnit.DecausGallon, decausgallonQuantity.Unit); + var deciliterQuantity = cubicmeter.ToUnit(VolumeUnit.Deciliter); AssertEx.EqualTolerance(DecilitersInOneCubicMeter, (double)deciliterQuantity.Value, DecilitersTolerance); Assert.Equal(VolumeUnit.Deciliter, deciliterQuantity.Unit); + var deciusgallonQuantity = cubicmeter.ToUnit(VolumeUnit.DeciusGallon); + AssertEx.EqualTolerance(DeciusGallonsInOneCubicMeter, (double)deciusgallonQuantity.Value, DeciusGallonsTolerance); + Assert.Equal(VolumeUnit.DeciusGallon, deciusgallonQuantity.Unit); + var hectocubicfootQuantity = cubicmeter.ToUnit(VolumeUnit.HectocubicFoot); AssertEx.EqualTolerance(HectocubicFeetInOneCubicMeter, (double)hectocubicfootQuantity.Value, HectocubicFeetTolerance); Assert.Equal(VolumeUnit.HectocubicFoot, hectocubicfootQuantity.Unit); @@ -578,6 +610,10 @@ public void ToUnit() AssertEx.EqualTolerance(HectolitersInOneCubicMeter, (double)hectoliterQuantity.Value, HectolitersTolerance); Assert.Equal(VolumeUnit.Hectoliter, hectoliterQuantity.Unit); + var hectousgallonQuantity = cubicmeter.ToUnit(VolumeUnit.HectousGallon); + AssertEx.EqualTolerance(HectousGallonsInOneCubicMeter, (double)hectousgallonQuantity.Value, HectousGallonsTolerance); + Assert.Equal(VolumeUnit.HectousGallon, hectousgallonQuantity.Unit); + var imperialbeerbarrelQuantity = cubicmeter.ToUnit(VolumeUnit.ImperialBeerBarrel); AssertEx.EqualTolerance(ImperialBeerBarrelsInOneCubicMeter, (double)imperialbeerbarrelQuantity.Value, ImperialBeerBarrelsTolerance); Assert.Equal(VolumeUnit.ImperialBeerBarrel, imperialbeerbarrelQuantity.Unit); @@ -713,10 +749,13 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Volume.FromCubicMiles(cubicmeter.CubicMiles).CubicMeters, CubicMilesTolerance); AssertEx.EqualTolerance(1, Volume.FromCubicMillimeters(cubicmeter.CubicMillimeters).CubicMeters, CubicMillimetersTolerance); AssertEx.EqualTolerance(1, Volume.FromCubicYards(cubicmeter.CubicYards).CubicMeters, CubicYardsTolerance); + AssertEx.EqualTolerance(1, Volume.FromDecausGallons(cubicmeter.DecausGallons).CubicMeters, DecausGallonsTolerance); AssertEx.EqualTolerance(1, Volume.FromDeciliters(cubicmeter.Deciliters).CubicMeters, DecilitersTolerance); + AssertEx.EqualTolerance(1, Volume.FromDeciusGallons(cubicmeter.DeciusGallons).CubicMeters, DeciusGallonsTolerance); AssertEx.EqualTolerance(1, Volume.FromHectocubicFeet(cubicmeter.HectocubicFeet).CubicMeters, HectocubicFeetTolerance); AssertEx.EqualTolerance(1, Volume.FromHectocubicMeters(cubicmeter.HectocubicMeters).CubicMeters, HectocubicMetersTolerance); AssertEx.EqualTolerance(1, Volume.FromHectoliters(cubicmeter.Hectoliters).CubicMeters, HectolitersTolerance); + AssertEx.EqualTolerance(1, Volume.FromHectousGallons(cubicmeter.HectousGallons).CubicMeters, HectousGallonsTolerance); AssertEx.EqualTolerance(1, Volume.FromImperialBeerBarrels(cubicmeter.ImperialBeerBarrels).CubicMeters, ImperialBeerBarrelsTolerance); AssertEx.EqualTolerance(1, Volume.FromImperialGallons(cubicmeter.ImperialGallons).CubicMeters, ImperialGallonsTolerance); AssertEx.EqualTolerance(1, Volume.FromImperialOunces(cubicmeter.ImperialOunces).CubicMeters, ImperialOuncesTolerance); @@ -899,10 +938,13 @@ public void ToString_ReturnsValueAndUnitAbbreviationInCurrentCulture() Assert.Equal("1 mi³", new Volume(1, VolumeUnit.CubicMile).ToString()); Assert.Equal("1 mm³", new Volume(1, VolumeUnit.CubicMillimeter).ToString()); Assert.Equal("1 yd³", new Volume(1, VolumeUnit.CubicYard).ToString()); + Assert.Equal("1 dagal (U.S.)", new Volume(1, VolumeUnit.DecausGallon).ToString()); Assert.Equal("1 dl", new Volume(1, VolumeUnit.Deciliter).ToString()); + Assert.Equal("1 dgal (U.S.)", new Volume(1, VolumeUnit.DeciusGallon).ToString()); Assert.Equal("1 hft³", new Volume(1, VolumeUnit.HectocubicFoot).ToString()); Assert.Equal("1 hm³", new Volume(1, VolumeUnit.HectocubicMeter).ToString()); Assert.Equal("1 hl", new Volume(1, VolumeUnit.Hectoliter).ToString()); + Assert.Equal("1 hgal (U.S.)", new Volume(1, VolumeUnit.HectousGallon).ToString()); Assert.Equal("1 bl (imp.)", new Volume(1, VolumeUnit.ImperialBeerBarrel).ToString()); Assert.Equal("1 gal (imp.)", new Volume(1, VolumeUnit.ImperialGallon).ToString()); Assert.Equal("1 oz (imp.)", new Volume(1, VolumeUnit.ImperialOunce).ToString()); @@ -959,10 +1001,13 @@ public void ToString_WithSwedishCulture_ReturnsUnitAbbreviationForEnglishCulture Assert.Equal("1 mi³", new Volume(1, VolumeUnit.CubicMile).ToString(swedishCulture)); Assert.Equal("1 mm³", new Volume(1, VolumeUnit.CubicMillimeter).ToString(swedishCulture)); Assert.Equal("1 yd³", new Volume(1, VolumeUnit.CubicYard).ToString(swedishCulture)); + Assert.Equal("1 dagal (U.S.)", new Volume(1, VolumeUnit.DecausGallon).ToString(swedishCulture)); Assert.Equal("1 dl", new Volume(1, VolumeUnit.Deciliter).ToString(swedishCulture)); + Assert.Equal("1 dgal (U.S.)", new Volume(1, VolumeUnit.DeciusGallon).ToString(swedishCulture)); Assert.Equal("1 hft³", new Volume(1, VolumeUnit.HectocubicFoot).ToString(swedishCulture)); Assert.Equal("1 hm³", new Volume(1, VolumeUnit.HectocubicMeter).ToString(swedishCulture)); Assert.Equal("1 hl", new Volume(1, VolumeUnit.Hectoliter).ToString(swedishCulture)); + Assert.Equal("1 hgal (U.S.)", new Volume(1, VolumeUnit.HectousGallon).ToString(swedishCulture)); Assert.Equal("1 bl (imp.)", new Volume(1, VolumeUnit.ImperialBeerBarrel).ToString(swedishCulture)); Assert.Equal("1 gal (imp.)", new Volume(1, VolumeUnit.ImperialGallon).ToString(swedishCulture)); Assert.Equal("1 oz (imp.)", new Volume(1, VolumeUnit.ImperialOunce).ToString(swedishCulture)); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.g.cs index 5ab6d276cf..e25242851d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.g.cs @@ -225,11 +225,21 @@ private Volume(double value, VolumeUnit unit) /// public double CubicYards => As(VolumeUnit.CubicYard); + /// + /// Get Volume in DecausGallons. + /// + public double DecausGallons => As(VolumeUnit.DecausGallon); + /// /// Get Volume in Deciliters. /// public double Deciliters => As(VolumeUnit.Deciliter); + /// + /// Get Volume in DeciusGallons. + /// + public double DeciusGallons => As(VolumeUnit.DeciusGallon); + /// /// Get Volume in HectocubicFeet. /// @@ -245,6 +255,11 @@ private Volume(double value, VolumeUnit unit) /// public double Hectoliters => As(VolumeUnit.Hectoliter); + /// + /// Get Volume in HectousGallons. + /// + public double HectousGallons => As(VolumeUnit.HectousGallon); + /// /// Get Volume in ImperialBeerBarrels. /// @@ -561,6 +576,16 @@ public static Volume FromCubicYards(double cubicyards) return new Volume(value, VolumeUnit.CubicYard); } /// + /// Get Volume from DecausGallons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromDecausGallons(double decausgallons) + { + double value = (double) decausgallons; + return new Volume(value, VolumeUnit.DecausGallon); + } + /// /// Get Volume from Deciliters. /// /// If value is NaN or Infinity. @@ -571,6 +596,16 @@ public static Volume FromDeciliters(double deciliters) return new Volume(value, VolumeUnit.Deciliter); } /// + /// Get Volume from DeciusGallons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromDeciusGallons(double deciusgallons) + { + double value = (double) deciusgallons; + return new Volume(value, VolumeUnit.DeciusGallon); + } + /// /// Get Volume from HectocubicFeet. /// /// If value is NaN or Infinity. @@ -601,6 +636,16 @@ public static Volume FromHectoliters(double hectoliters) return new Volume(value, VolumeUnit.Hectoliter); } /// + /// Get Volume from HectousGallons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromHectousGallons(double hectousgallons) + { + double value = (double) hectousgallons; + return new Volume(value, VolumeUnit.HectousGallon); + } + /// /// Get Volume from ImperialBeerBarrels. /// /// If value is NaN or Infinity. @@ -1195,10 +1240,13 @@ private double AsBaseUnit() case VolumeUnit.CubicMile: return _value*4.16818182544058e9; case VolumeUnit.CubicMillimeter: return _value/1e9; case VolumeUnit.CubicYard: return _value*0.764554858; + case VolumeUnit.DecausGallon: return (_value*0.00378541) * 1e1d; case VolumeUnit.Deciliter: return (_value/1e3) * 1e-1d; + case VolumeUnit.DeciusGallon: return (_value*0.00378541) * 1e-1d; case VolumeUnit.HectocubicFoot: return (_value*0.0283168) * 1e2d; case VolumeUnit.HectocubicMeter: return (_value) * 1e2d; case VolumeUnit.Hectoliter: return (_value/1e3) * 1e2d; + case VolumeUnit.HectousGallon: return (_value*0.00378541) * 1e2d; case VolumeUnit.ImperialBeerBarrel: return _value*0.16365924; case VolumeUnit.ImperialGallon: return _value*0.00454609000000181429905810072407; case VolumeUnit.ImperialOunce: return _value*2.8413062499962901241875439064617e-5; @@ -1256,10 +1304,13 @@ private double AsBaseNumericType(VolumeUnit unit) case VolumeUnit.CubicMile: return baseUnitValue/4.16818182544058e9; case VolumeUnit.CubicMillimeter: return baseUnitValue*1e9; case VolumeUnit.CubicYard: return baseUnitValue/0.764554858; + case VolumeUnit.DecausGallon: return (baseUnitValue/0.00378541) / 1e1d; case VolumeUnit.Deciliter: return (baseUnitValue*1e3) / 1e-1d; + case VolumeUnit.DeciusGallon: return (baseUnitValue/0.00378541) / 1e-1d; case VolumeUnit.HectocubicFoot: return (baseUnitValue/0.0283168) / 1e2d; case VolumeUnit.HectocubicMeter: return (baseUnitValue) / 1e2d; case VolumeUnit.Hectoliter: return (baseUnitValue*1e3) / 1e2d; + case VolumeUnit.HectousGallon: return (baseUnitValue/0.00378541) / 1e2d; case VolumeUnit.ImperialBeerBarrel: return baseUnitValue/0.16365924; case VolumeUnit.ImperialGallon: return baseUnitValue/0.00454609000000181429905810072407; case VolumeUnit.ImperialOunce: return baseUnitValue/2.8413062499962901241875439064617e-5; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs index 4bb8c274fc..cbc975a5d7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -1366,14 +1366,20 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMillimeter, new string[]{"мм³"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicYard, new string[]{"yd³"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicYard, new string[]{"ярд³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.DecausGallon, new string[]{"dagal (U.S.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.DecausGallon, new string[]{"даАмериканский галлон"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.Deciliter, new string[]{"dl"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Deciliter, new string[]{"дл"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.DeciusGallon, new string[]{"dgal (U.S.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.DeciusGallon, new string[]{"дАмериканский галлон"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.HectocubicFoot, new string[]{"hft³"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.HectocubicFoot, new string[]{"гфут³"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.HectocubicMeter, new string[]{"hm³"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.HectocubicMeter, new string[]{"гм³"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.Hectoliter, new string[]{"hl"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Hectoliter, new string[]{"гл"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.HectousGallon, new string[]{"hgal (U.S.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.HectousGallon, new string[]{"гАмериканский галлон"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialBeerBarrel, new string[]{"bl (imp.)"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialGallon, new string[]{"gal (imp.)"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.ImperialGallon, new string[]{"Английский галлон"}), diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/VolumeUnit.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/VolumeUnit.g.cs index 9dbbc08cfe..c3f687a35c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/VolumeUnit.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/VolumeUnit.g.cs @@ -40,10 +40,13 @@ public enum VolumeUnit CubicMile, CubicMillimeter, CubicYard, + DecausGallon, Deciliter, + DeciusGallon, HectocubicFoot, HectocubicMeter, Hectoliter, + HectousGallon, ImperialBeerBarrel, ImperialGallon, ImperialOunce, diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index d3a12dceaa..fbe1f2febf 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -64,10 +64,13 @@ static Volume() new UnitInfo(VolumeUnit.CubicMile, BaseUnits.Undefined), new UnitInfo(VolumeUnit.CubicMillimeter, BaseUnits.Undefined), new UnitInfo(VolumeUnit.CubicYard, BaseUnits.Undefined), + new UnitInfo(VolumeUnit.DecausGallon, BaseUnits.Undefined), new UnitInfo(VolumeUnit.Deciliter, BaseUnits.Undefined), + new UnitInfo(VolumeUnit.DeciusGallon, BaseUnits.Undefined), new UnitInfo(VolumeUnit.HectocubicFoot, BaseUnits.Undefined), new UnitInfo(VolumeUnit.HectocubicMeter, BaseUnits.Undefined), new UnitInfo(VolumeUnit.Hectoliter, BaseUnits.Undefined), + new UnitInfo(VolumeUnit.HectousGallon, BaseUnits.Undefined), new UnitInfo(VolumeUnit.ImperialBeerBarrel, BaseUnits.Undefined), new UnitInfo(VolumeUnit.ImperialGallon, BaseUnits.Undefined), new UnitInfo(VolumeUnit.ImperialOunce, BaseUnits.Undefined), @@ -279,11 +282,21 @@ public Volume(double value, UnitSystem unitSystem) /// public double CubicYards => As(VolumeUnit.CubicYard); + /// + /// Get Volume in DecausGallons. + /// + public double DecausGallons => As(VolumeUnit.DecausGallon); + /// /// Get Volume in Deciliters. /// public double Deciliters => As(VolumeUnit.Deciliter); + /// + /// Get Volume in DeciusGallons. + /// + public double DeciusGallons => As(VolumeUnit.DeciusGallon); + /// /// Get Volume in HectocubicFeet. /// @@ -299,6 +312,11 @@ public Volume(double value, UnitSystem unitSystem) /// public double Hectoliters => As(VolumeUnit.Hectoliter); + /// + /// Get Volume in HectousGallons. + /// + public double HectousGallons => As(VolumeUnit.HectousGallon); + /// /// Get Volume in ImperialBeerBarrels. /// @@ -600,6 +618,15 @@ public static Volume FromCubicYards(QuantityValue cubicyards) return new Volume(value, VolumeUnit.CubicYard); } /// + /// Get Volume from DecausGallons. + /// + /// If value is NaN or Infinity. + public static Volume FromDecausGallons(QuantityValue decausgallons) + { + double value = (double) decausgallons; + return new Volume(value, VolumeUnit.DecausGallon); + } + /// /// Get Volume from Deciliters. /// /// If value is NaN or Infinity. @@ -609,6 +636,15 @@ public static Volume FromDeciliters(QuantityValue deciliters) return new Volume(value, VolumeUnit.Deciliter); } /// + /// Get Volume from DeciusGallons. + /// + /// If value is NaN or Infinity. + public static Volume FromDeciusGallons(QuantityValue deciusgallons) + { + double value = (double) deciusgallons; + return new Volume(value, VolumeUnit.DeciusGallon); + } + /// /// Get Volume from HectocubicFeet. /// /// If value is NaN or Infinity. @@ -636,6 +672,15 @@ public static Volume FromHectoliters(QuantityValue hectoliters) return new Volume(value, VolumeUnit.Hectoliter); } /// + /// Get Volume from HectousGallons. + /// + /// If value is NaN or Infinity. + public static Volume FromHectousGallons(QuantityValue hectousgallons) + { + double value = (double) hectousgallons; + return new Volume(value, VolumeUnit.HectousGallon); + } + /// /// Get Volume from ImperialBeerBarrels. /// /// If value is NaN or Infinity. @@ -1339,10 +1384,13 @@ private double GetValueInBaseUnit() case VolumeUnit.CubicMile: return _value*4.16818182544058e9; case VolumeUnit.CubicMillimeter: return _value/1e9; case VolumeUnit.CubicYard: return _value*0.764554858; + case VolumeUnit.DecausGallon: return (_value*0.00378541) * 1e1d; case VolumeUnit.Deciliter: return (_value/1e3) * 1e-1d; + case VolumeUnit.DeciusGallon: return (_value*0.00378541) * 1e-1d; case VolumeUnit.HectocubicFoot: return (_value*0.0283168) * 1e2d; case VolumeUnit.HectocubicMeter: return (_value) * 1e2d; case VolumeUnit.Hectoliter: return (_value/1e3) * 1e2d; + case VolumeUnit.HectousGallon: return (_value*0.00378541) * 1e2d; case VolumeUnit.ImperialBeerBarrel: return _value*0.16365924; case VolumeUnit.ImperialGallon: return _value*0.00454609000000181429905810072407; case VolumeUnit.ImperialOunce: return _value*2.8413062499962901241875439064617e-5; @@ -1411,10 +1459,13 @@ private double GetValueAs(VolumeUnit unit) case VolumeUnit.CubicMile: return baseUnitValue/4.16818182544058e9; case VolumeUnit.CubicMillimeter: return baseUnitValue*1e9; case VolumeUnit.CubicYard: return baseUnitValue/0.764554858; + case VolumeUnit.DecausGallon: return (baseUnitValue/0.00378541) / 1e1d; case VolumeUnit.Deciliter: return (baseUnitValue*1e3) / 1e-1d; + case VolumeUnit.DeciusGallon: return (baseUnitValue/0.00378541) / 1e-1d; case VolumeUnit.HectocubicFoot: return (baseUnitValue/0.0283168) / 1e2d; case VolumeUnit.HectocubicMeter: return (baseUnitValue) / 1e2d; case VolumeUnit.Hectoliter: return (baseUnitValue*1e3) / 1e2d; + case VolumeUnit.HectousGallon: return (baseUnitValue/0.00378541) / 1e2d; case VolumeUnit.ImperialBeerBarrel: return baseUnitValue/0.16365924; case VolumeUnit.ImperialGallon: return baseUnitValue/0.00454609000000181429905810072407; case VolumeUnit.ImperialOunce: return baseUnitValue/2.8413062499962901241875439064617e-5; diff --git a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs index d2d4c566a6..a6ede7f36e 100644 --- a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -1366,14 +1366,20 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMillimeter, new string[]{"мм³"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicYard, new string[]{"yd³"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicYard, new string[]{"ярд³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.DecausGallon, new string[]{"dagal (U.S.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.DecausGallon, new string[]{"даАмериканский галлон"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.Deciliter, new string[]{"dl"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Deciliter, new string[]{"дл"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.DeciusGallon, new string[]{"dgal (U.S.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.DeciusGallon, new string[]{"дАмериканский галлон"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.HectocubicFoot, new string[]{"hft³"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.HectocubicFoot, new string[]{"гфут³"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.HectocubicMeter, new string[]{"hm³"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.HectocubicMeter, new string[]{"гм³"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.Hectoliter, new string[]{"hl"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Hectoliter, new string[]{"гл"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.HectousGallon, new string[]{"hgal (U.S.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.HectousGallon, new string[]{"гАмериканский галлон"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialBeerBarrel, new string[]{"bl (imp.)"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialGallon, new string[]{"gal (imp.)"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.ImperialGallon, new string[]{"Английский галлон"}), diff --git a/UnitsNet/GeneratedCode/UnitConverter.g.cs b/UnitsNet/GeneratedCode/UnitConverter.g.cs index 6e33b946de..62fe6a292e 100644 --- a/UnitsNet/GeneratedCode/UnitConverter.g.cs +++ b/UnitsNet/GeneratedCode/UnitConverter.g.cs @@ -2120,14 +2120,20 @@ public static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(VolumeUnit.CubicMillimeter, Volume.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.CubicYard, q => q.ToUnit(VolumeUnit.CubicYard)); unitConverter.SetConversionFunction(VolumeUnit.CubicYard, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.DecausGallon, q => q.ToUnit(VolumeUnit.DecausGallon)); + unitConverter.SetConversionFunction(VolumeUnit.DecausGallon, Volume.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.Deciliter, q => q.ToUnit(VolumeUnit.Deciliter)); unitConverter.SetConversionFunction(VolumeUnit.Deciliter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.DeciusGallon, q => q.ToUnit(VolumeUnit.DeciusGallon)); + unitConverter.SetConversionFunction(VolumeUnit.DeciusGallon, Volume.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.HectocubicFoot, q => q.ToUnit(VolumeUnit.HectocubicFoot)); unitConverter.SetConversionFunction(VolumeUnit.HectocubicFoot, Volume.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.HectocubicMeter, q => q.ToUnit(VolumeUnit.HectocubicMeter)); unitConverter.SetConversionFunction(VolumeUnit.HectocubicMeter, Volume.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.Hectoliter, q => q.ToUnit(VolumeUnit.Hectoliter)); unitConverter.SetConversionFunction(VolumeUnit.Hectoliter, Volume.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.HectousGallon, q => q.ToUnit(VolumeUnit.HectousGallon)); + unitConverter.SetConversionFunction(VolumeUnit.HectousGallon, Volume.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.ImperialBeerBarrel, q => q.ToUnit(VolumeUnit.ImperialBeerBarrel)); unitConverter.SetConversionFunction(VolumeUnit.ImperialBeerBarrel, Volume.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(Volume.BaseUnit, VolumeUnit.ImperialGallon, q => q.ToUnit(VolumeUnit.ImperialGallon)); diff --git a/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs index 9dbbc08cfe..c3f687a35c 100644 --- a/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs @@ -40,10 +40,13 @@ public enum VolumeUnit CubicMile, CubicMillimeter, CubicYard, + DecausGallon, Deciliter, + DeciusGallon, HectocubicFoot, HectocubicMeter, Hectoliter, + HectousGallon, ImperialBeerBarrel, ImperialGallon, ImperialOunce,