diff --git a/.gitignore b/.gitignore
index 2e6ebec7d0..729a9f42b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -259,3 +259,6 @@ Artifacts
# Build server tooling
/secure-file
/.tools/
+
+# Mac files
+**/.DS_Store
\ No newline at end of file
diff --git a/Common/UnitDefinitions/EnergyEfficiency.json b/Common/UnitDefinitions/EnergyEfficiency.json
new file mode 100644
index 0000000000..0e2f3f8664
--- /dev/null
+++ b/Common/UnitDefinitions/EnergyEfficiency.json
@@ -0,0 +1,42 @@
+{
+ "Name": "EnergyEfficiency",
+ "BaseUnit": "WattHourPerKilometer",
+ "XmlDocSummary": "",
+ "BaseDimensions": {
+ "Wh/km": 1
+ },
+ "Units": [
+ {
+ "SingularName": "WattHourPerKilometer",
+ "PluralName": "WattHoursPerKilometer",
+ "BaseUnits": {
+ "Wh/km": "WattHourPerKilometer"
+ },
+ "FromUnitToBaseFunc": "{x}",
+ "FromBaseToUnitFunc": "{x}",
+ "Prefixes": ["Kilo" ],
+ "Localization": [
+ {
+ "Culture": "en-US",
+ "Abbreviations": [ "Wh/km" ]
+ }
+ ]
+ },
+ {
+ "SingularName": "WattHourPerMeter",
+ "PluralName": "WattHoursPerMeter",
+ "BaseUnits": {
+ "Wh/m": "WattHourPerMeter"
+ },
+ "FromUnitToBaseFunc": "{x} * 1e3",
+ "FromBaseToUnitFunc": "{x} / 1e3",
+ "Prefixes": ["Kilo"],
+ "Localization": [
+ {
+ "Culture": "en-US",
+ "Abbreviations": [ "Wh/m" ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/Common/UnitEnumValues.g.json b/Common/UnitEnumValues.g.json
index e58a8e2198..bb2bab3486 100644
--- a/Common/UnitEnumValues.g.json
+++ b/Common/UnitEnumValues.g.json
@@ -1862,5 +1862,25 @@
"Sievert": 9,
"Kilosievert": 3,
"Megasievert": 6
+ },
+ "EnergyEfficiency": {
+ "FemtowattHourPerKilometer": 7,
+ "FemtowattHourPerMeter": 9,
+ "GigawattHourPerKilometer": 10,
+ "GigawattHourPerMeter": 2,
+ "KilowattHourPerKilometer": 5,
+ "KilowattHourPerMeter": 3,
+ "MegawattHourPerKilometer": 1,
+ "MegawattHourPerMeter": 6,
+ "MicrowattHourPerKilometer": 4,
+ "MicrowattHourPerMeter": 8,
+ "MilliwattHourPerKilometer": 12,
+ "MilliwattHourPerMeter": 15,
+ "NanowattHourPerKilometer": 11,
+ "NanowattHourPerMeter": 16,
+ "PicowattHourPerKilometer": 14,
+ "PicowattHourPerMeter": 19,
+ "WattHourPerKilometer": 13,
+ "WattHourPerMeter": 20
}
}
diff --git a/UnitsNet.NanoFramework/GeneratedCode/EnergyEfficiency/EnergyEfficiency.nfproj b/UnitsNet.NanoFramework/GeneratedCode/EnergyEfficiency/EnergyEfficiency.nfproj
new file mode 100644
index 0000000000..5d33ce3268
--- /dev/null
+++ b/UnitsNet.NanoFramework/GeneratedCode/EnergyEfficiency/EnergyEfficiency.nfproj
@@ -0,0 +1,42 @@
+
+
+
+ $(MSBuildExtensionsPath)\nanoFramework\v1.0\
+
+
+
+ Debug
+ AnyCPU
+ {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {31f3d11e-76d2-1914-ebad-28e0cb77326b}
+ Library
+ Properties
+ 512
+ UnitsNet
+ UnitsNet.EnergyEfficiency
+ v1.0
+ bin\$(Configuration)\$(AssemblyName).xml
+
+
+
+
+
+
+
+
+
+ ..\packages\nanoFramework.CoreLibrary.1.15.5\lib\mscorlib.dll
+ True
+ True
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/UnitsNet.NanoFramework/GeneratedCode/EnergyEfficiency/UnitsNet.NanoFramework.EnergyEfficiency.nuspec b/UnitsNet.NanoFramework/GeneratedCode/EnergyEfficiency/UnitsNet.NanoFramework.EnergyEfficiency.nuspec
new file mode 100644
index 0000000000..d7a09bc51b
--- /dev/null
+++ b/UnitsNet.NanoFramework/GeneratedCode/EnergyEfficiency/UnitsNet.NanoFramework.EnergyEfficiency.nuspec
@@ -0,0 +1,26 @@
+
+
+
+ UnitsNet.nanoFramework.EnergyEfficiency
+ 5.57.0
+ Units.NET EnergyEfficiency - nanoFramework
+ Andreas Gullberg Larsen,nanoframework
+ UnitsNet
+ MIT-0
+ https://github.com/angularsen/UnitsNet
+ false
+ Adds EnergyEfficiency units for Units.NET on .NET nanoFramework. For .NET or .NET Core, use UnitsNet instead.
+ https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png
+
+
+ Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+ en-US
+ nanoframework energyefficiency unit units quantity quantities measurement si metric imperial abbreviation abbreviations convert conversion parse immutable
+
+
+
+
+
+
+
+
diff --git a/UnitsNet.NanoFramework/GeneratedCode/EnergyEfficiency/packages.config b/UnitsNet.NanoFramework/GeneratedCode/EnergyEfficiency/packages.config
new file mode 100644
index 0000000000..313a8dccdf
--- /dev/null
+++ b/UnitsNet.NanoFramework/GeneratedCode/EnergyEfficiency/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/EnergyEfficiency.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/EnergyEfficiency.g.cs
new file mode 100644
index 0000000000..2756af7483
--- /dev/null
+++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/EnergyEfficiency.g.cs
@@ -0,0 +1,198 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities.
+// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Licensed under MIT No Attribution, see LICENSE file at the root.
+// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+
+using System;
+using UnitsNet.Units;
+
+namespace UnitsNet
+{
+ ///
+ ///
+ ///
+ ///
+ public struct EnergyEfficiency
+ {
+ ///
+ /// The numeric value this quantity was constructed with.
+ ///
+ private readonly double _value;
+
+ ///
+ /// The unit this quantity was constructed with.
+ ///
+ private readonly EnergyEfficiencyUnit _unit;
+
+ ///
+ /// The numeric value this quantity was constructed with.
+ ///
+ public double Value => _value;
+
+ ///
+ public EnergyEfficiencyUnit Unit => _unit;
+
+ ///
+ /// Creates the quantity with the given numeric value and unit.
+ ///
+ /// The numeric value to construct this quantity with.
+ /// The unit representation to construct this quantity with.
+ /// If value is NaN or Infinity.
+ public EnergyEfficiency(double value, EnergyEfficiencyUnit unit)
+ {
+ _value = value;
+ _unit = unit;
+ }
+
+ ///
+ /// The base unit of EnergyEfficiency, which is Second. All conversions go via this value.
+ ///
+ public static EnergyEfficiencyUnit BaseUnit { get; } = EnergyEfficiencyUnit.WattHourPerKilometer;
+
+ ///
+ /// Represents the largest possible value of EnergyEfficiency.
+ ///
+ public static EnergyEfficiency MaxValue { get; } = new EnergyEfficiency(double.MaxValue, BaseUnit);
+
+ ///
+ /// Represents the smallest possible value of EnergyEfficiency.
+ ///
+ public static EnergyEfficiency MinValue { get; } = new EnergyEfficiency(double.MinValue, BaseUnit);
+
+ ///
+ /// Gets an instance of this quantity with a value of 0 in the base unit Second.
+ ///
+ public static EnergyEfficiency Zero { get; } = new EnergyEfficiency(0, BaseUnit);
+ #region Conversion Properties
+
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double KilowattHoursPerKilometer => As(EnergyEfficiencyUnit.KilowattHourPerKilometer);
+
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double KilowattHoursPerMeter => As(EnergyEfficiencyUnit.KilowattHourPerMeter);
+
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double WattHoursPerKilometer => As(EnergyEfficiencyUnit.WattHourPerKilometer);
+
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double WattHoursPerMeter => As(EnergyEfficiencyUnit.WattHourPerMeter);
+
+ #endregion
+
+ #region Static Factory Methods
+
+ ///
+ /// Creates a from .
+ ///
+ /// If value is NaN or Infinity.
+ public static EnergyEfficiency FromKilowattHoursPerKilometer(double kilowatthoursperkilometer) => new EnergyEfficiency(kilowatthoursperkilometer, EnergyEfficiencyUnit.KilowattHourPerKilometer);
+
+ ///
+ /// Creates a from .
+ ///
+ /// If value is NaN or Infinity.
+ public static EnergyEfficiency FromKilowattHoursPerMeter(double kilowatthourspermeter) => new EnergyEfficiency(kilowatthourspermeter, EnergyEfficiencyUnit.KilowattHourPerMeter);
+
+ ///
+ /// Creates a from .
+ ///
+ /// If value is NaN or Infinity.
+ public static EnergyEfficiency FromWattHoursPerKilometer(double watthoursperkilometer) => new EnergyEfficiency(watthoursperkilometer, EnergyEfficiencyUnit.WattHourPerKilometer);
+
+ ///
+ /// Creates a from .
+ ///
+ /// If value is NaN or Infinity.
+ public static EnergyEfficiency FromWattHoursPerMeter(double watthourspermeter) => new EnergyEfficiency(watthourspermeter, EnergyEfficiencyUnit.WattHourPerMeter);
+
+ ///
+ /// Dynamically convert from value and unit enum to .
+ ///
+ /// Value to convert from.
+ /// Unit to convert from.
+ /// EnergyEfficiency unit value.
+ public static EnergyEfficiency From(double value, EnergyEfficiencyUnit fromUnit)
+ {
+ return new EnergyEfficiency(value, fromUnit);
+ }
+
+ #endregion
+
+ #region Conversion Methods
+
+ ///
+ /// Convert to the unit representation .
+ ///
+ /// Value converted to the specified unit.
+ public double As(EnergyEfficiencyUnit unit) => GetValueAs(unit);
+
+ ///
+ /// Converts this EnergyEfficiency to another EnergyEfficiency with the unit representation .
+ ///
+ /// A EnergyEfficiency with the specified unit.
+ public EnergyEfficiency ToUnit(EnergyEfficiencyUnit unit)
+ {
+ var convertedValue = GetValueAs(unit);
+ return new EnergyEfficiency(convertedValue, unit);
+ }
+
+ ///
+ /// Converts the current value + unit to the base unit.
+ /// This is typically the first step in converting from one unit to another.
+ ///
+ /// The value in the base unit representation.
+ private double GetValueInBaseUnit()
+ {
+ return Unit switch
+ {
+ EnergyEfficiencyUnit.KilowattHourPerKilometer => (_value) * 1e3d,
+ EnergyEfficiencyUnit.KilowattHourPerMeter => (_value * 1e3) * 1e3d,
+ EnergyEfficiencyUnit.WattHourPerKilometer => _value,
+ EnergyEfficiencyUnit.WattHourPerMeter => _value * 1e3,
+ _ => throw new NotImplementedException($"Can not convert {Unit} to base units.")
+ };
+ }
+
+ private double GetValueAs(EnergyEfficiencyUnit unit)
+ {
+ if (Unit == unit)
+ return _value;
+
+ var baseUnitValue = GetValueInBaseUnit();
+
+ return unit switch
+ {
+ EnergyEfficiencyUnit.KilowattHourPerKilometer => (baseUnitValue) / 1e3d,
+ EnergyEfficiencyUnit.KilowattHourPerMeter => (baseUnitValue / 1e3) / 1e3d,
+ EnergyEfficiencyUnit.WattHourPerKilometer => baseUnitValue,
+ EnergyEfficiencyUnit.WattHourPerMeter => baseUnitValue / 1e3,
+ _ => throw new NotImplementedException($"Can not convert {Unit} to {unit}.")
+ };
+ }
+
+ #endregion
+ }
+}
+
diff --git a/UnitsNet.NanoFramework/GeneratedCode/Units/EnergyEfficiencyUnit.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Units/EnergyEfficiencyUnit.g.cs
new file mode 100644
index 0000000000..0fc1eafbc4
--- /dev/null
+++ b/UnitsNet.NanoFramework/GeneratedCode/Units/EnergyEfficiencyUnit.g.cs
@@ -0,0 +1,35 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities.
+// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Licensed under MIT No Attribution, see LICENSE file at the root.
+// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+
+// ReSharper disable once CheckNamespace
+namespace UnitsNet.Units
+{
+ // Disable missing XML comment warnings for the generated unit enums.
+ #pragma warning disable 1591
+
+ public enum EnergyEfficiencyUnit
+ {
+ KilowattHourPerKilometer = 5,
+ KilowattHourPerMeter = 3,
+ WattHourPerKilometer = 13,
+ WattHourPerMeter = 20,
+ }
+
+ #pragma warning restore 1591
+}
diff --git a/UnitsNet.NanoFramework/GeneratedCode/UnitsNet.nanoFramework.sln b/UnitsNet.NanoFramework/GeneratedCode/UnitsNet.nanoFramework.sln
index d64098f57d..1f1969a38e 100644
--- a/UnitsNet.NanoFramework/GeneratedCode/UnitsNet.nanoFramework.sln
+++ b/UnitsNet.NanoFramework/GeneratedCode/UnitsNet.nanoFramework.sln
@@ -76,6 +76,8 @@ Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "Energy", "Energy\Energy.nfp
EndProject
Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "EnergyDensity", "EnergyDensity\EnergyDensity.nfproj", "{c5025916-5039-97c2-b450-af1420f5fb08}"
EndProject
+Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "EnergyEfficiency", "EnergyEfficiency\EnergyEfficiency.nfproj", "{31f3d11e-76d2-1914-ebad-28e0cb77326b}"
+EndProject
Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "Entropy", "Entropy\Entropy.nfproj", "{816884bb-a5f6-5c07-967b-bb8f21d724b7}"
EndProject
Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "Force", "Force\Force.nfproj", "{5517dacf-b1ff-6515-e5b6-b5081f92f407}"
@@ -478,6 +480,12 @@ Global
{c5025916-5039-97c2-b450-af1420f5fb08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{c5025916-5039-97c2-b450-af1420f5fb08}.Release|Any CPU.Build.0 = Release|Any CPU
{c5025916-5039-97c2-b450-af1420f5fb08}.Release|Any CPU.Deploy.0 = Release|Any CPU
+{31f3d11e-76d2-1914-ebad-28e0cb77326b}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+{31f3d11e-76d2-1914-ebad-28e0cb77326b}.Debug|Any CPU.Build.0 = Debug|Any CPU
+{31f3d11e-76d2-1914-ebad-28e0cb77326b}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+{31f3d11e-76d2-1914-ebad-28e0cb77326b}.Release|Any CPU.ActiveCfg = Release|Any CPU
+{31f3d11e-76d2-1914-ebad-28e0cb77326b}.Release|Any CPU.Build.0 = Release|Any CPU
+{31f3d11e-76d2-1914-ebad-28e0cb77326b}.Release|Any CPU.Deploy.0 = Release|Any CPU
{816884bb-a5f6-5c07-967b-bb8f21d724b7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{816884bb-a5f6-5c07-967b-bb8f21d724b7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{816884bb-a5f6-5c07-967b-bb8f21d724b7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToEnergyEfficiencyExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToEnergyEfficiencyExtensionsTest.g.cs
new file mode 100644
index 0000000000..3ee8b30f71
--- /dev/null
+++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToEnergyEfficiencyExtensionsTest.g.cs
@@ -0,0 +1,44 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities.
+// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Licensed under MIT No Attribution, see LICENSE file at the root.
+// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+
+using UnitsNet.NumberExtensions.NumberToEnergyEfficiency;
+using Xunit;
+
+namespace UnitsNet.Tests
+{
+ public class NumberToEnergyEfficiencyExtensionsTests
+ {
+ [Fact]
+ public void NumberToKilowattHoursPerKilometerTest() =>
+ Assert.Equal(EnergyEfficiency.FromKilowattHoursPerKilometer(2), 2.KilowattHoursPerKilometer());
+
+ [Fact]
+ public void NumberToKilowattHoursPerMeterTest() =>
+ Assert.Equal(EnergyEfficiency.FromKilowattHoursPerMeter(2), 2.KilowattHoursPerMeter());
+
+ [Fact]
+ public void NumberToWattHoursPerKilometerTest() =>
+ Assert.Equal(EnergyEfficiency.FromWattHoursPerKilometer(2), 2.WattHoursPerKilometer());
+
+ [Fact]
+ public void NumberToWattHoursPerMeterTest() =>
+ Assert.Equal(EnergyEfficiency.FromWattHoursPerMeter(2), 2.WattHoursPerMeter());
+
+ }
+}
diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToEnergyEfficiencyExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToEnergyEfficiencyExtensions.g.cs
new file mode 100644
index 0000000000..4aae2e4406
--- /dev/null
+++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToEnergyEfficiencyExtensions.g.cs
@@ -0,0 +1,68 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities.
+// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Licensed under MIT No Attribution, see LICENSE file at the root.
+// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+
+using System;
+
+#if NET7_0_OR_GREATER
+using System.Numerics;
+#endif
+
+#nullable enable
+
+namespace UnitsNet.NumberExtensions.NumberToEnergyEfficiency
+{
+ ///
+ /// A number to EnergyEfficiency Extensions
+ ///
+ public static class NumberToEnergyEfficiencyExtensions
+ {
+ ///
+ public static EnergyEfficiency KilowattHoursPerKilometer(this T value)
+ where T : notnull
+#if NET7_0_OR_GREATER
+ , INumber
+#endif
+ => EnergyEfficiency.FromKilowattHoursPerKilometer(Convert.ToDouble(value));
+
+ ///
+ public static EnergyEfficiency KilowattHoursPerMeter(this T value)
+ where T : notnull
+#if NET7_0_OR_GREATER
+ , INumber
+#endif
+ => EnergyEfficiency.FromKilowattHoursPerMeter(Convert.ToDouble(value));
+
+ ///
+ public static EnergyEfficiency WattHoursPerKilometer(this T value)
+ where T : notnull
+#if NET7_0_OR_GREATER
+ , INumber
+#endif
+ => EnergyEfficiency.FromWattHoursPerKilometer(Convert.ToDouble(value));
+
+ ///
+ public static EnergyEfficiency WattHoursPerMeter(this T value)
+ where T : notnull
+#if NET7_0_OR_GREATER
+ , INumber
+#endif
+ => EnergyEfficiency.FromWattHoursPerMeter(Convert.ToDouble(value));
+
+ }
+}
diff --git a/UnitsNet.Tests/CustomCode/EnergyEfficiencyTests.cs b/UnitsNet.Tests/CustomCode/EnergyEfficiencyTests.cs
new file mode 100644
index 0000000000..d04045833c
--- /dev/null
+++ b/UnitsNet.Tests/CustomCode/EnergyEfficiencyTests.cs
@@ -0,0 +1,32 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities.
+// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Licensed under MIT No Attribution, see LICENSE file at the root.
+// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+
+using System;
+
+namespace UnitsNet.Tests.CustomCode
+{
+ public class EnergyEfficiencyTests : EnergyEfficiencyTestsBase
+ {
+ protected override bool SupportsSIUnitSystem => false;
+ protected override double KilowattHoursPerKilometerInOneWattHourPerKilometer => 1e-3;
+ protected override double KilowattHoursPerMeterInOneWattHourPerKilometer => 1e-6;
+ protected override double WattHoursPerKilometerInOneWattHourPerKilometer => 1;
+ protected override double WattHoursPerMeterInOneWattHourPerKilometer => 1e-3;
+ }
+}
diff --git a/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs b/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs
index 7dc41682e2..aa6405a08f 100644
--- a/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs
@@ -71,6 +71,7 @@ void Assertion(int expectedValue, Enum expectedUnit, IQuantity quantity)
Assertion(3, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter, Quantity.From(3, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter));
Assertion(3, EnergyUnit.WattHour, Quantity.From(3, EnergyUnit.WattHour));
Assertion(3, EnergyDensityUnit.WattHourPerCubicMeter, Quantity.From(3, EnergyDensityUnit.WattHourPerCubicMeter));
+ Assertion(3, EnergyEfficiencyUnit.WattHourPerMeter, Quantity.From(3, EnergyEfficiencyUnit.WattHourPerMeter));
Assertion(3, EntropyUnit.MegajoulePerKelvin, Quantity.From(3, EntropyUnit.MegajoulePerKelvin));
Assertion(3, ForceUnit.TonneForce, Quantity.From(3, ForceUnit.TonneForce));
Assertion(3, ForceChangeRateUnit.PoundForcePerSecond, Quantity.From(3, ForceChangeRateUnit.PoundForcePerSecond));
@@ -202,6 +203,7 @@ public void QuantityInfo_IsSameAsStaticInfoProperty()
Assertion(ElectricSurfaceChargeDensity.Info, ElectricSurfaceChargeDensity.Zero);
Assertion(Energy.Info, Energy.Zero);
Assertion(EnergyDensity.Info, EnergyDensity.Zero);
+ Assertion(EnergyEfficiency.Info, EnergyEfficiency.Zero);
Assertion(Entropy.Info, Entropy.Zero);
Assertion(Force.Info, Force.Zero);
Assertion(ForceChangeRate.Info, ForceChangeRate.Zero);
@@ -333,6 +335,7 @@ public void Dimensions_IsSameAsStaticBaseDimensions()
Assertion(ElectricSurfaceChargeDensity.BaseDimensions, ElectricSurfaceChargeDensity.Zero);
Assertion(Energy.BaseDimensions, Energy.Zero);
Assertion(EnergyDensity.BaseDimensions, EnergyDensity.Zero);
+ Assertion(EnergyEfficiency.BaseDimensions, EnergyEfficiency.Zero);
Assertion(Entropy.BaseDimensions, Entropy.Zero);
Assertion(Force.BaseDimensions, Force.Zero);
Assertion(ForceChangeRate.BaseDimensions, ForceChangeRate.Zero);
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyEfficiencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyEfficiencyTestsBase.g.cs
new file mode 100644
index 0000000000..187a2f12f9
--- /dev/null
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyEfficiencyTestsBase.g.cs
@@ -0,0 +1,744 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities.
+// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Licensed under MIT No Attribution, see LICENSE file at the root.
+// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Threading;
+using UnitsNet.Tests.TestsBase;
+using UnitsNet.Units;
+using Xunit;
+
+// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else?
+#pragma warning disable 1718
+
+// ReSharper disable once CheckNamespace
+namespace UnitsNet.Tests
+{
+ ///
+ /// Test of EnergyEfficiency.
+ ///
+// ReSharper disable once PartialTypeWithSinglePart
+ public abstract partial class EnergyEfficiencyTestsBase : QuantityTestsBase
+ {
+ protected abstract double KilowattHoursPerKilometerInOneWattHourPerKilometer { get; }
+ protected abstract double KilowattHoursPerMeterInOneWattHourPerKilometer { get; }
+ protected abstract double WattHoursPerKilometerInOneWattHourPerKilometer { get; }
+ protected abstract double WattHoursPerMeterInOneWattHourPerKilometer { get; }
+
+// ReSharper disable VirtualMemberNeverOverriden.Global
+ protected virtual double KilowattHoursPerKilometerTolerance { get { return 1e-5; } }
+ protected virtual double KilowattHoursPerMeterTolerance { get { return 1e-5; } }
+ protected virtual double WattHoursPerKilometerTolerance { get { return 1e-5; } }
+ protected virtual double WattHoursPerMeterTolerance { get { return 1e-5; } }
+// ReSharper restore VirtualMemberNeverOverriden.Global
+
+ protected (double UnitsInBaseUnit, double Tolerence) GetConversionFactor(EnergyEfficiencyUnit unit)
+ {
+ return unit switch
+ {
+ EnergyEfficiencyUnit.KilowattHourPerKilometer => (KilowattHoursPerKilometerInOneWattHourPerKilometer, KilowattHoursPerKilometerTolerance),
+ EnergyEfficiencyUnit.KilowattHourPerMeter => (KilowattHoursPerMeterInOneWattHourPerKilometer, KilowattHoursPerMeterTolerance),
+ EnergyEfficiencyUnit.WattHourPerKilometer => (WattHoursPerKilometerInOneWattHourPerKilometer, WattHoursPerKilometerTolerance),
+ EnergyEfficiencyUnit.WattHourPerMeter => (WattHoursPerMeterInOneWattHourPerKilometer, WattHoursPerMeterTolerance),
+ _ => throw new NotSupportedException()
+ };
+ }
+
+ public static IEnumerable