From 9160e048295d54967e0cf9151c83e30b47108906 Mon Sep 17 00:00:00 2001 From: Andrew Harres Date: Tue, 5 Dec 2023 12:18:02 -0600 Subject: [PATCH] add new density unit: pounds per cubic yard --- Common/UnitDefinitions/Density.json | 18 ++ Common/UnitEnumValues.g.json | 4 +- .../GeneratedCode/Quantities/Density.g.cs | 26 ++ .../GeneratedCode/Units/DensityUnit.g.cs | 2 + .../NumberToDensityExtensionsTest.g.cs | 8 + .../NumberToDensityExtensions.g.cs | 16 ++ UnitsNet.Tests/CustomCode/DensityTests.cs | 4 + .../TestsBase/DensityTestsBase.g.cs | 260 +++++++++++------- .../GeneratedCode/Quantities/Density.g.cs | 40 +++ .../GeneratedCode/Resources/Density.restext | 2 + UnitsNet/GeneratedCode/Units/DensityUnit.g.cs | 2 + 11 files changed, 288 insertions(+), 94 deletions(-) diff --git a/Common/UnitDefinitions/Density.json b/Common/UnitDefinitions/Density.json index 99296180d6..d55bad1926 100644 --- a/Common/UnitDefinitions/Density.json +++ b/Common/UnitDefinitions/Density.json @@ -99,6 +99,24 @@ } ] }, + { + "SingularName": "PoundPerCubicYard", + "PluralName": "PoundsPerCubicYard", + "BaseUnits": { + "L": "Yard", + "M": "Pound" + }, + "FromUnitToBaseFunc": "{x} / 1.685554936", + "FromBaseToUnitFunc": "{x} * 1.685554936", + "Prefixes": [ "Kilo" ], + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "lb/yd³" ], + "AbbreviationsForPrefixes": { "Kilo": "kip/yd³" } + } + ] + }, { "SingularName": "TonnePerCubicMillimeter", "PluralName": "TonnesPerCubicMillimeter", diff --git a/Common/UnitEnumValues.g.json b/Common/UnitEnumValues.g.json index 298c16c035..b83291c05a 100644 --- a/Common/UnitEnumValues.g.json +++ b/Common/UnitEnumValues.g.json @@ -225,7 +225,9 @@ "TonnePerCubicMillimeter": 51, "FemtogramPerDeciliter": 59, "FemtogramPerLiter": 56, - "FemtogramPerMilliliter": 61 + "FemtogramPerMilliliter": 61, + "KilopoundPerCubicYard": 64, + "PoundPerCubicYard": 58 }, "Duration": { "Day": 1, diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Density.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Density.g.cs index d42ce96e68..a3a43541de 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Density.g.cs @@ -197,6 +197,11 @@ public Density(double value, DensityUnit unit) /// public double KilopoundsPerCubicInch => As(DensityUnit.KilopoundPerCubicInch); + /// + /// Gets a value of this quantity converted into + /// + public double KilopoundsPerCubicYard => As(DensityUnit.KilopoundPerCubicYard); + /// /// Gets a value of this quantity converted into /// @@ -292,6 +297,11 @@ public Density(double value, DensityUnit unit) /// public double PoundsPerCubicMillimeter => As(DensityUnit.PoundPerCubicMillimeter); + /// + /// Gets a value of this quantity converted into + /// + public double PoundsPerCubicYard => As(DensityUnit.PoundPerCubicYard); + /// /// Gets a value of this quantity converted into /// @@ -494,6 +504,12 @@ public Density(double value, DensityUnit unit) /// If value is NaN or Infinity. public static Density FromKilopoundsPerCubicInch(double kilopoundspercubicinch) => new Density(kilopoundspercubicinch, DensityUnit.KilopoundPerCubicInch); + /// + /// Creates a from . + /// + /// If value is NaN or Infinity. + public static Density FromKilopoundsPerCubicYard(double kilopoundspercubicyard) => new Density(kilopoundspercubicyard, DensityUnit.KilopoundPerCubicYard); + /// /// Creates a from . /// @@ -608,6 +624,12 @@ public Density(double value, DensityUnit unit) /// If value is NaN or Infinity. public static Density FromPoundsPerCubicMillimeter(double poundspercubicmillimeter) => new Density(poundspercubicmillimeter, DensityUnit.PoundPerCubicMillimeter); + /// + /// Creates a from . + /// + /// If value is NaN or Infinity. + public static Density FromPoundsPerCubicYard(double poundspercubicyard) => new Density(poundspercubicyard, DensityUnit.PoundPerCubicYard); + /// /// Creates a from . /// @@ -743,6 +765,7 @@ private double GetValueInBaseUnit() DensityUnit.KilogramPerLiter => _value * 1e3, DensityUnit.KilopoundPerCubicFoot => (_value / 0.062427961) * 1e3d, DensityUnit.KilopoundPerCubicInch => (_value / 3.6127298147753e-5) * 1e3d, + DensityUnit.KilopoundPerCubicYard => (_value / 1.685554936) * 1e3d, DensityUnit.MicrogramPerCubicMeter => (_value / 1e3) * 1e-6d, DensityUnit.MicrogramPerDeciliter => (_value / 1e-1) * 1e-6d, DensityUnit.MicrogramPerLiter => (_value / 1) * 1e-6d, @@ -762,6 +785,7 @@ private double GetValueInBaseUnit() DensityUnit.PoundPerCubicInch => _value / 3.6127298147753e-5, DensityUnit.PoundPerCubicMeter => _value / 2.204622621848775, DensityUnit.PoundPerCubicMillimeter => _value / 2.204622621848775e-9, + DensityUnit.PoundPerCubicYard => _value / 1.685554936, DensityUnit.PoundPerImperialGallon => _value * 9.9776398e1, DensityUnit.PoundPerUSGallon => _value * 1.19826427e2, DensityUnit.SlugPerCubicCentimeter => _value * 14593903, @@ -810,6 +834,7 @@ private double GetValueAs(DensityUnit unit) DensityUnit.KilogramPerLiter => baseUnitValue / 1e3, DensityUnit.KilopoundPerCubicFoot => (baseUnitValue * 0.062427961) / 1e3d, DensityUnit.KilopoundPerCubicInch => (baseUnitValue * 3.6127298147753e-5) / 1e3d, + DensityUnit.KilopoundPerCubicYard => (baseUnitValue * 1.685554936) / 1e3d, DensityUnit.MicrogramPerCubicMeter => (baseUnitValue * 1e3) / 1e-6d, DensityUnit.MicrogramPerDeciliter => (baseUnitValue * 1e-1) / 1e-6d, DensityUnit.MicrogramPerLiter => (baseUnitValue * 1) / 1e-6d, @@ -829,6 +854,7 @@ private double GetValueAs(DensityUnit unit) DensityUnit.PoundPerCubicInch => baseUnitValue * 3.6127298147753e-5, DensityUnit.PoundPerCubicMeter => baseUnitValue * 2.204622621848775, DensityUnit.PoundPerCubicMillimeter => baseUnitValue * 2.204622621848775e-9, + DensityUnit.PoundPerCubicYard => baseUnitValue * 1.685554936, DensityUnit.PoundPerImperialGallon => baseUnitValue / 9.9776398e1, DensityUnit.PoundPerUSGallon => baseUnitValue / 1.19826427e2, DensityUnit.SlugPerCubicCentimeter => baseUnitValue / 14593903, diff --git a/UnitsNet.NanoFramework/GeneratedCode/Units/DensityUnit.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Units/DensityUnit.g.cs index 5584b0398c..7ddfd3c648 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Units/DensityUnit.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Units/DensityUnit.g.cs @@ -48,6 +48,7 @@ public enum DensityUnit KilogramPerLiter = 18, KilopoundPerCubicFoot = 19, KilopoundPerCubicInch = 20, + KilopoundPerCubicYard = 64, MicrogramPerCubicMeter = 21, MicrogramPerDeciliter = 22, MicrogramPerLiter = 23, @@ -67,6 +68,7 @@ public enum DensityUnit PoundPerCubicInch = 37, PoundPerCubicMeter = 38, PoundPerCubicMillimeter = 39, + PoundPerCubicYard = 58, PoundPerImperialGallon = 40, PoundPerUSGallon = 41, SlugPerCubicCentimeter = 42, diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDensityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDensityExtensionsTest.g.cs index d5d757c5db..f61c2cf329 100644 --- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDensityExtensionsTest.g.cs +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToDensityExtensionsTest.g.cs @@ -116,6 +116,10 @@ public void NumberToKilopoundsPerCubicFootTest() => public void NumberToKilopoundsPerCubicInchTest() => Assert.Equal(Density.FromKilopoundsPerCubicInch(2), 2.KilopoundsPerCubicInch()); + [Fact] + public void NumberToKilopoundsPerCubicYardTest() => + Assert.Equal(Density.FromKilopoundsPerCubicYard(2), 2.KilopoundsPerCubicYard()); + [Fact] public void NumberToMicrogramsPerCubicMeterTest() => Assert.Equal(Density.FromMicrogramsPerCubicMeter(2), 2.MicrogramsPerCubicMeter()); @@ -192,6 +196,10 @@ public void NumberToPoundsPerCubicMeterTest() => public void NumberToPoundsPerCubicMillimeterTest() => Assert.Equal(Density.FromPoundsPerCubicMillimeter(2), 2.PoundsPerCubicMillimeter()); + [Fact] + public void NumberToPoundsPerCubicYardTest() => + Assert.Equal(Density.FromPoundsPerCubicYard(2), 2.PoundsPerCubicYard()); + [Fact] public void NumberToPoundsPerImperialGallonTest() => Assert.Equal(Density.FromPoundsPerImperialGallon(2), 2.PoundsPerImperialGallon()); diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToDensityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToDensityExtensions.g.cs index be9edb1554..2ef9a7e913 100644 --- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToDensityExtensions.g.cs +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToDensityExtensions.g.cs @@ -216,6 +216,14 @@ public static Density KilopoundsPerCubicInch(this T value) #endif => Density.FromKilopoundsPerCubicInch(Convert.ToDouble(value)); + /// + public static Density KilopoundsPerCubicYard(this T value) + where T : notnull +#if NET7_0_OR_GREATER + , INumber +#endif + => Density.FromKilopoundsPerCubicYard(Convert.ToDouble(value)); + /// public static Density MicrogramsPerCubicMeter(this T value) where T : notnull @@ -368,6 +376,14 @@ public static Density PoundsPerCubicMillimeter(this T value) #endif => Density.FromPoundsPerCubicMillimeter(Convert.ToDouble(value)); + /// + public static Density PoundsPerCubicYard(this T value) + where T : notnull +#if NET7_0_OR_GREATER + , INumber +#endif + => Density.FromPoundsPerCubicYard(Convert.ToDouble(value)); + /// public static Density PoundsPerImperialGallon(this T value) where T : notnull diff --git a/UnitsNet.Tests/CustomCode/DensityTests.cs b/UnitsNet.Tests/CustomCode/DensityTests.cs index 6542e531d2..1bec0dac10 100644 --- a/UnitsNet.Tests/CustomCode/DensityTests.cs +++ b/UnitsNet.Tests/CustomCode/DensityTests.cs @@ -23,10 +23,14 @@ public class DensityTests : DensityTestsBase protected override double KilogramsPerCubicMillimeterInOneKilogramPerCubicMeter => 1e-9; + protected override double KilopoundsPerCubicYardInOneKilogramPerCubicMeter => 1.6855549356e-3; + protected override double KilopoundsPerCubicFootInOneKilogramPerCubicMeter => 6.242796e-5; protected override double KilopoundsPerCubicInchInOneKilogramPerCubicMeter => 3.6127292e-8; + protected override double PoundsPerCubicYardInOneKilogramPerCubicMeter => 1.6855549356; + protected override double PoundsPerCubicFootInOneKilogramPerCubicMeter => 6.242796e-2; protected override double PoundsPerCubicInchInOneKilogramPerCubicMeter => 3.61272923e-5; diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs index fd431530ef..9d12072063 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs @@ -61,6 +61,7 @@ public abstract partial class DensityTestsBase : QuantityTestsBase protected abstract double KilogramsPerLiterInOneKilogramPerCubicMeter { get; } protected abstract double KilopoundsPerCubicFootInOneKilogramPerCubicMeter { get; } protected abstract double KilopoundsPerCubicInchInOneKilogramPerCubicMeter { get; } + protected abstract double KilopoundsPerCubicYardInOneKilogramPerCubicMeter { get; } protected abstract double MicrogramsPerCubicMeterInOneKilogramPerCubicMeter { get; } protected abstract double MicrogramsPerDeciLiterInOneKilogramPerCubicMeter { get; } protected abstract double MicrogramsPerLiterInOneKilogramPerCubicMeter { get; } @@ -80,6 +81,7 @@ public abstract partial class DensityTestsBase : QuantityTestsBase protected abstract double PoundsPerCubicInchInOneKilogramPerCubicMeter { get; } protected abstract double PoundsPerCubicMeterInOneKilogramPerCubicMeter { get; } protected abstract double PoundsPerCubicMillimeterInOneKilogramPerCubicMeter { get; } + protected abstract double PoundsPerCubicYardInOneKilogramPerCubicMeter { get; } protected abstract double PoundsPerImperialGallonInOneKilogramPerCubicMeter { get; } protected abstract double PoundsPerUSGallonInOneKilogramPerCubicMeter { get; } protected abstract double SlugsPerCubicCentimeterInOneKilogramPerCubicMeter { get; } @@ -117,6 +119,7 @@ public abstract partial class DensityTestsBase : QuantityTestsBase protected virtual double KilogramsPerLiterTolerance { get { return 1e-5; } } protected virtual double KilopoundsPerCubicFootTolerance { get { return 1e-5; } } protected virtual double KilopoundsPerCubicInchTolerance { get { return 1e-5; } } + protected virtual double KilopoundsPerCubicYardTolerance { get { return 1e-5; } } protected virtual double MicrogramsPerCubicMeterTolerance { get { return 1e-5; } } protected virtual double MicrogramsPerDeciLiterTolerance { get { return 1e-5; } } protected virtual double MicrogramsPerLiterTolerance { get { return 1e-5; } } @@ -136,6 +139,7 @@ public abstract partial class DensityTestsBase : QuantityTestsBase protected virtual double PoundsPerCubicInchTolerance { get { return 1e-5; } } protected virtual double PoundsPerCubicMeterTolerance { get { return 1e-5; } } protected virtual double PoundsPerCubicMillimeterTolerance { get { return 1e-5; } } + protected virtual double PoundsPerCubicYardTolerance { get { return 1e-5; } } protected virtual double PoundsPerImperialGallonTolerance { get { return 1e-5; } } protected virtual double PoundsPerUSGallonTolerance { get { return 1e-5; } } protected virtual double SlugsPerCubicCentimeterTolerance { get { return 1e-5; } } @@ -177,6 +181,7 @@ public abstract partial class DensityTestsBase : QuantityTestsBase DensityUnit.KilogramPerLiter => (KilogramsPerLiterInOneKilogramPerCubicMeter, KilogramsPerLiterTolerance), DensityUnit.KilopoundPerCubicFoot => (KilopoundsPerCubicFootInOneKilogramPerCubicMeter, KilopoundsPerCubicFootTolerance), DensityUnit.KilopoundPerCubicInch => (KilopoundsPerCubicInchInOneKilogramPerCubicMeter, KilopoundsPerCubicInchTolerance), + DensityUnit.KilopoundPerCubicYard => (KilopoundsPerCubicYardInOneKilogramPerCubicMeter, KilopoundsPerCubicYardTolerance), DensityUnit.MicrogramPerCubicMeter => (MicrogramsPerCubicMeterInOneKilogramPerCubicMeter, MicrogramsPerCubicMeterTolerance), DensityUnit.MicrogramPerDeciliter => (MicrogramsPerDeciLiterInOneKilogramPerCubicMeter, MicrogramsPerDeciLiterTolerance), DensityUnit.MicrogramPerLiter => (MicrogramsPerLiterInOneKilogramPerCubicMeter, MicrogramsPerLiterTolerance), @@ -196,6 +201,7 @@ public abstract partial class DensityTestsBase : QuantityTestsBase DensityUnit.PoundPerCubicInch => (PoundsPerCubicInchInOneKilogramPerCubicMeter, PoundsPerCubicInchTolerance), DensityUnit.PoundPerCubicMeter => (PoundsPerCubicMeterInOneKilogramPerCubicMeter, PoundsPerCubicMeterTolerance), DensityUnit.PoundPerCubicMillimeter => (PoundsPerCubicMillimeterInOneKilogramPerCubicMeter, PoundsPerCubicMillimeterTolerance), + DensityUnit.PoundPerCubicYard => (PoundsPerCubicYardInOneKilogramPerCubicMeter, PoundsPerCubicYardTolerance), DensityUnit.PoundPerImperialGallon => (PoundsPerImperialGallonInOneKilogramPerCubicMeter, PoundsPerImperialGallonTolerance), DensityUnit.PoundPerUSGallon => (PoundsPerUSGallonInOneKilogramPerCubicMeter, PoundsPerUSGallonTolerance), DensityUnit.SlugPerCubicCentimeter => (SlugsPerCubicCentimeterInOneKilogramPerCubicMeter, SlugsPerCubicCentimeterTolerance), @@ -237,6 +243,7 @@ public abstract partial class DensityTestsBase : QuantityTestsBase new object[] { DensityUnit.KilogramPerLiter }, new object[] { DensityUnit.KilopoundPerCubicFoot }, new object[] { DensityUnit.KilopoundPerCubicInch }, + new object[] { DensityUnit.KilopoundPerCubicYard }, new object[] { DensityUnit.MicrogramPerCubicMeter }, new object[] { DensityUnit.MicrogramPerDeciliter }, new object[] { DensityUnit.MicrogramPerLiter }, @@ -256,6 +263,7 @@ public abstract partial class DensityTestsBase : QuantityTestsBase new object[] { DensityUnit.PoundPerCubicInch }, new object[] { DensityUnit.PoundPerCubicMeter }, new object[] { DensityUnit.PoundPerCubicMillimeter }, + new object[] { DensityUnit.PoundPerCubicYard }, new object[] { DensityUnit.PoundPerImperialGallon }, new object[] { DensityUnit.PoundPerUSGallon }, new object[] { DensityUnit.SlugPerCubicCentimeter }, @@ -353,6 +361,7 @@ public void KilogramPerCubicMeterToDensityUnits() AssertEx.EqualTolerance(KilogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilogramsPerLiter, KilogramsPerLiterTolerance); AssertEx.EqualTolerance(KilopoundsPerCubicFootInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilopoundsPerCubicFoot, KilopoundsPerCubicFootTolerance); AssertEx.EqualTolerance(KilopoundsPerCubicInchInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilopoundsPerCubicInch, KilopoundsPerCubicInchTolerance); + AssertEx.EqualTolerance(KilopoundsPerCubicYardInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilopoundsPerCubicYard, KilopoundsPerCubicYardTolerance); AssertEx.EqualTolerance(MicrogramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MicrogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); AssertEx.EqualTolerance(MicrogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); AssertEx.EqualTolerance(MicrogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MicrogramsPerLiter, MicrogramsPerLiterTolerance); @@ -372,6 +381,7 @@ public void KilogramPerCubicMeterToDensityUnits() AssertEx.EqualTolerance(PoundsPerCubicInchInOneKilogramPerCubicMeter, kilogrampercubicmeter.PoundsPerCubicInch, PoundsPerCubicInchTolerance); AssertEx.EqualTolerance(PoundsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.PoundsPerCubicMeter, PoundsPerCubicMeterTolerance); AssertEx.EqualTolerance(PoundsPerCubicMillimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.PoundsPerCubicMillimeter, PoundsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(PoundsPerCubicYardInOneKilogramPerCubicMeter, kilogrampercubicmeter.PoundsPerCubicYard, PoundsPerCubicYardTolerance); AssertEx.EqualTolerance(PoundsPerImperialGallonInOneKilogramPerCubicMeter, kilogrampercubicmeter.PoundsPerImperialGallon, PoundsPerImperialGallonTolerance); AssertEx.EqualTolerance(PoundsPerUSGallonInOneKilogramPerCubicMeter, kilogrampercubicmeter.PoundsPerUSGallon, PoundsPerUSGallonTolerance); AssertEx.EqualTolerance(SlugsPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.SlugsPerCubicCentimeter, SlugsPerCubicCentimeterTolerance); @@ -481,129 +491,137 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() AssertEx.EqualTolerance(1, quantity22.KilopoundsPerCubicInch, KilopoundsPerCubicInchTolerance); Assert.Equal(DensityUnit.KilopoundPerCubicInch, quantity22.Unit); - var quantity23 = Density.From(1, DensityUnit.MicrogramPerCubicMeter); - AssertEx.EqualTolerance(1, quantity23.MicrogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); - Assert.Equal(DensityUnit.MicrogramPerCubicMeter, quantity23.Unit); + var quantity23 = Density.From(1, DensityUnit.KilopoundPerCubicYard); + AssertEx.EqualTolerance(1, quantity23.KilopoundsPerCubicYard, KilopoundsPerCubicYardTolerance); + Assert.Equal(DensityUnit.KilopoundPerCubicYard, quantity23.Unit); - var quantity24 = Density.From(1, DensityUnit.MicrogramPerDeciliter); - AssertEx.EqualTolerance(1, quantity24.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.MicrogramPerDeciliter, quantity24.Unit); + var quantity24 = Density.From(1, DensityUnit.MicrogramPerCubicMeter); + AssertEx.EqualTolerance(1, quantity24.MicrogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); + Assert.Equal(DensityUnit.MicrogramPerCubicMeter, quantity24.Unit); - var quantity25 = Density.From(1, DensityUnit.MicrogramPerLiter); - AssertEx.EqualTolerance(1, quantity25.MicrogramsPerLiter, MicrogramsPerLiterTolerance); - Assert.Equal(DensityUnit.MicrogramPerLiter, quantity25.Unit); + var quantity25 = Density.From(1, DensityUnit.MicrogramPerDeciliter); + AssertEx.EqualTolerance(1, quantity25.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.MicrogramPerDeciliter, quantity25.Unit); - var quantity26 = Density.From(1, DensityUnit.MicrogramPerMilliliter); - AssertEx.EqualTolerance(1, quantity26.MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.MicrogramPerMilliliter, quantity26.Unit); + var quantity26 = Density.From(1, DensityUnit.MicrogramPerLiter); + AssertEx.EqualTolerance(1, quantity26.MicrogramsPerLiter, MicrogramsPerLiterTolerance); + Assert.Equal(DensityUnit.MicrogramPerLiter, quantity26.Unit); - var quantity27 = Density.From(1, DensityUnit.MilligramPerCubicMeter); - AssertEx.EqualTolerance(1, quantity27.MilligramsPerCubicMeter, MilligramsPerCubicMeterTolerance); - Assert.Equal(DensityUnit.MilligramPerCubicMeter, quantity27.Unit); + var quantity27 = Density.From(1, DensityUnit.MicrogramPerMilliliter); + AssertEx.EqualTolerance(1, quantity27.MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.MicrogramPerMilliliter, quantity27.Unit); - var quantity28 = Density.From(1, DensityUnit.MilligramPerDeciliter); - AssertEx.EqualTolerance(1, quantity28.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.MilligramPerDeciliter, quantity28.Unit); + var quantity28 = Density.From(1, DensityUnit.MilligramPerCubicMeter); + AssertEx.EqualTolerance(1, quantity28.MilligramsPerCubicMeter, MilligramsPerCubicMeterTolerance); + Assert.Equal(DensityUnit.MilligramPerCubicMeter, quantity28.Unit); - var quantity29 = Density.From(1, DensityUnit.MilligramPerLiter); - AssertEx.EqualTolerance(1, quantity29.MilligramsPerLiter, MilligramsPerLiterTolerance); - Assert.Equal(DensityUnit.MilligramPerLiter, quantity29.Unit); + var quantity29 = Density.From(1, DensityUnit.MilligramPerDeciliter); + AssertEx.EqualTolerance(1, quantity29.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.MilligramPerDeciliter, quantity29.Unit); - var quantity30 = Density.From(1, DensityUnit.MilligramPerMilliliter); - AssertEx.EqualTolerance(1, quantity30.MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.MilligramPerMilliliter, quantity30.Unit); + var quantity30 = Density.From(1, DensityUnit.MilligramPerLiter); + AssertEx.EqualTolerance(1, quantity30.MilligramsPerLiter, MilligramsPerLiterTolerance); + Assert.Equal(DensityUnit.MilligramPerLiter, quantity30.Unit); - var quantity31 = Density.From(1, DensityUnit.NanogramPerDeciliter); - AssertEx.EqualTolerance(1, quantity31.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.NanogramPerDeciliter, quantity31.Unit); + var quantity31 = Density.From(1, DensityUnit.MilligramPerMilliliter); + AssertEx.EqualTolerance(1, quantity31.MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.MilligramPerMilliliter, quantity31.Unit); - var quantity32 = Density.From(1, DensityUnit.NanogramPerLiter); - AssertEx.EqualTolerance(1, quantity32.NanogramsPerLiter, NanogramsPerLiterTolerance); - Assert.Equal(DensityUnit.NanogramPerLiter, quantity32.Unit); + var quantity32 = Density.From(1, DensityUnit.NanogramPerDeciliter); + AssertEx.EqualTolerance(1, quantity32.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.NanogramPerDeciliter, quantity32.Unit); - var quantity33 = Density.From(1, DensityUnit.NanogramPerMilliliter); - AssertEx.EqualTolerance(1, quantity33.NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.NanogramPerMilliliter, quantity33.Unit); + var quantity33 = Density.From(1, DensityUnit.NanogramPerLiter); + AssertEx.EqualTolerance(1, quantity33.NanogramsPerLiter, NanogramsPerLiterTolerance); + Assert.Equal(DensityUnit.NanogramPerLiter, quantity33.Unit); - var quantity34 = Density.From(1, DensityUnit.PicogramPerDeciliter); - AssertEx.EqualTolerance(1, quantity34.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.PicogramPerDeciliter, quantity34.Unit); + var quantity34 = Density.From(1, DensityUnit.NanogramPerMilliliter); + AssertEx.EqualTolerance(1, quantity34.NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.NanogramPerMilliliter, quantity34.Unit); - var quantity35 = Density.From(1, DensityUnit.PicogramPerLiter); - AssertEx.EqualTolerance(1, quantity35.PicogramsPerLiter, PicogramsPerLiterTolerance); - Assert.Equal(DensityUnit.PicogramPerLiter, quantity35.Unit); + var quantity35 = Density.From(1, DensityUnit.PicogramPerDeciliter); + AssertEx.EqualTolerance(1, quantity35.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.PicogramPerDeciliter, quantity35.Unit); - var quantity36 = Density.From(1, DensityUnit.PicogramPerMilliliter); - AssertEx.EqualTolerance(1, quantity36.PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.PicogramPerMilliliter, quantity36.Unit); + var quantity36 = Density.From(1, DensityUnit.PicogramPerLiter); + AssertEx.EqualTolerance(1, quantity36.PicogramsPerLiter, PicogramsPerLiterTolerance); + Assert.Equal(DensityUnit.PicogramPerLiter, quantity36.Unit); - var quantity37 = Density.From(1, DensityUnit.PoundPerCubicCentimeter); - AssertEx.EqualTolerance(1, quantity37.PoundsPerCubicCentimeter, PoundsPerCubicCentimeterTolerance); - Assert.Equal(DensityUnit.PoundPerCubicCentimeter, quantity37.Unit); + var quantity37 = Density.From(1, DensityUnit.PicogramPerMilliliter); + AssertEx.EqualTolerance(1, quantity37.PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.PicogramPerMilliliter, quantity37.Unit); - var quantity38 = Density.From(1, DensityUnit.PoundPerCubicFoot); - AssertEx.EqualTolerance(1, quantity38.PoundsPerCubicFoot, PoundsPerCubicFootTolerance); - Assert.Equal(DensityUnit.PoundPerCubicFoot, quantity38.Unit); + var quantity38 = Density.From(1, DensityUnit.PoundPerCubicCentimeter); + AssertEx.EqualTolerance(1, quantity38.PoundsPerCubicCentimeter, PoundsPerCubicCentimeterTolerance); + Assert.Equal(DensityUnit.PoundPerCubicCentimeter, quantity38.Unit); - var quantity39 = Density.From(1, DensityUnit.PoundPerCubicInch); - AssertEx.EqualTolerance(1, quantity39.PoundsPerCubicInch, PoundsPerCubicInchTolerance); - Assert.Equal(DensityUnit.PoundPerCubicInch, quantity39.Unit); + var quantity39 = Density.From(1, DensityUnit.PoundPerCubicFoot); + AssertEx.EqualTolerance(1, quantity39.PoundsPerCubicFoot, PoundsPerCubicFootTolerance); + Assert.Equal(DensityUnit.PoundPerCubicFoot, quantity39.Unit); - var quantity40 = Density.From(1, DensityUnit.PoundPerCubicMeter); - AssertEx.EqualTolerance(1, quantity40.PoundsPerCubicMeter, PoundsPerCubicMeterTolerance); - Assert.Equal(DensityUnit.PoundPerCubicMeter, quantity40.Unit); + var quantity40 = Density.From(1, DensityUnit.PoundPerCubicInch); + AssertEx.EqualTolerance(1, quantity40.PoundsPerCubicInch, PoundsPerCubicInchTolerance); + Assert.Equal(DensityUnit.PoundPerCubicInch, quantity40.Unit); - var quantity41 = Density.From(1, DensityUnit.PoundPerCubicMillimeter); - AssertEx.EqualTolerance(1, quantity41.PoundsPerCubicMillimeter, PoundsPerCubicMillimeterTolerance); - Assert.Equal(DensityUnit.PoundPerCubicMillimeter, quantity41.Unit); + var quantity41 = Density.From(1, DensityUnit.PoundPerCubicMeter); + AssertEx.EqualTolerance(1, quantity41.PoundsPerCubicMeter, PoundsPerCubicMeterTolerance); + Assert.Equal(DensityUnit.PoundPerCubicMeter, quantity41.Unit); - var quantity42 = Density.From(1, DensityUnit.PoundPerImperialGallon); - AssertEx.EqualTolerance(1, quantity42.PoundsPerImperialGallon, PoundsPerImperialGallonTolerance); - Assert.Equal(DensityUnit.PoundPerImperialGallon, quantity42.Unit); + var quantity42 = Density.From(1, DensityUnit.PoundPerCubicMillimeter); + AssertEx.EqualTolerance(1, quantity42.PoundsPerCubicMillimeter, PoundsPerCubicMillimeterTolerance); + Assert.Equal(DensityUnit.PoundPerCubicMillimeter, quantity42.Unit); - var quantity43 = Density.From(1, DensityUnit.PoundPerUSGallon); - AssertEx.EqualTolerance(1, quantity43.PoundsPerUSGallon, PoundsPerUSGallonTolerance); - Assert.Equal(DensityUnit.PoundPerUSGallon, quantity43.Unit); + var quantity43 = Density.From(1, DensityUnit.PoundPerCubicYard); + AssertEx.EqualTolerance(1, quantity43.PoundsPerCubicYard, PoundsPerCubicYardTolerance); + Assert.Equal(DensityUnit.PoundPerCubicYard, quantity43.Unit); - var quantity44 = Density.From(1, DensityUnit.SlugPerCubicCentimeter); - AssertEx.EqualTolerance(1, quantity44.SlugsPerCubicCentimeter, SlugsPerCubicCentimeterTolerance); - Assert.Equal(DensityUnit.SlugPerCubicCentimeter, quantity44.Unit); + var quantity44 = Density.From(1, DensityUnit.PoundPerImperialGallon); + AssertEx.EqualTolerance(1, quantity44.PoundsPerImperialGallon, PoundsPerImperialGallonTolerance); + Assert.Equal(DensityUnit.PoundPerImperialGallon, quantity44.Unit); - var quantity45 = Density.From(1, DensityUnit.SlugPerCubicFoot); - AssertEx.EqualTolerance(1, quantity45.SlugsPerCubicFoot, SlugsPerCubicFootTolerance); - Assert.Equal(DensityUnit.SlugPerCubicFoot, quantity45.Unit); + var quantity45 = Density.From(1, DensityUnit.PoundPerUSGallon); + AssertEx.EqualTolerance(1, quantity45.PoundsPerUSGallon, PoundsPerUSGallonTolerance); + Assert.Equal(DensityUnit.PoundPerUSGallon, quantity45.Unit); - var quantity46 = Density.From(1, DensityUnit.SlugPerCubicInch); - AssertEx.EqualTolerance(1, quantity46.SlugsPerCubicInch, SlugsPerCubicInchTolerance); - Assert.Equal(DensityUnit.SlugPerCubicInch, quantity46.Unit); + var quantity46 = Density.From(1, DensityUnit.SlugPerCubicCentimeter); + AssertEx.EqualTolerance(1, quantity46.SlugsPerCubicCentimeter, SlugsPerCubicCentimeterTolerance); + Assert.Equal(DensityUnit.SlugPerCubicCentimeter, quantity46.Unit); - var quantity47 = Density.From(1, DensityUnit.SlugPerCubicMeter); - AssertEx.EqualTolerance(1, quantity47.SlugsPerCubicMeter, SlugsPerCubicMeterTolerance); - Assert.Equal(DensityUnit.SlugPerCubicMeter, quantity47.Unit); + var quantity47 = Density.From(1, DensityUnit.SlugPerCubicFoot); + AssertEx.EqualTolerance(1, quantity47.SlugsPerCubicFoot, SlugsPerCubicFootTolerance); + Assert.Equal(DensityUnit.SlugPerCubicFoot, quantity47.Unit); - var quantity48 = Density.From(1, DensityUnit.SlugPerCubicMillimeter); - AssertEx.EqualTolerance(1, quantity48.SlugsPerCubicMillimeter, SlugsPerCubicMillimeterTolerance); - Assert.Equal(DensityUnit.SlugPerCubicMillimeter, quantity48.Unit); + var quantity48 = Density.From(1, DensityUnit.SlugPerCubicInch); + AssertEx.EqualTolerance(1, quantity48.SlugsPerCubicInch, SlugsPerCubicInchTolerance); + Assert.Equal(DensityUnit.SlugPerCubicInch, quantity48.Unit); - var quantity49 = Density.From(1, DensityUnit.TonnePerCubicCentimeter); - AssertEx.EqualTolerance(1, quantity49.TonnesPerCubicCentimeter, TonnesPerCubicCentimeterTolerance); - Assert.Equal(DensityUnit.TonnePerCubicCentimeter, quantity49.Unit); + var quantity49 = Density.From(1, DensityUnit.SlugPerCubicMeter); + AssertEx.EqualTolerance(1, quantity49.SlugsPerCubicMeter, SlugsPerCubicMeterTolerance); + Assert.Equal(DensityUnit.SlugPerCubicMeter, quantity49.Unit); - var quantity50 = Density.From(1, DensityUnit.TonnePerCubicFoot); - AssertEx.EqualTolerance(1, quantity50.TonnesPerCubicFoot, TonnesPerCubicFootTolerance); - Assert.Equal(DensityUnit.TonnePerCubicFoot, quantity50.Unit); + var quantity50 = Density.From(1, DensityUnit.SlugPerCubicMillimeter); + AssertEx.EqualTolerance(1, quantity50.SlugsPerCubicMillimeter, SlugsPerCubicMillimeterTolerance); + Assert.Equal(DensityUnit.SlugPerCubicMillimeter, quantity50.Unit); - var quantity51 = Density.From(1, DensityUnit.TonnePerCubicInch); - AssertEx.EqualTolerance(1, quantity51.TonnesPerCubicInch, TonnesPerCubicInchTolerance); - Assert.Equal(DensityUnit.TonnePerCubicInch, quantity51.Unit); + var quantity51 = Density.From(1, DensityUnit.TonnePerCubicCentimeter); + AssertEx.EqualTolerance(1, quantity51.TonnesPerCubicCentimeter, TonnesPerCubicCentimeterTolerance); + Assert.Equal(DensityUnit.TonnePerCubicCentimeter, quantity51.Unit); - var quantity52 = Density.From(1, DensityUnit.TonnePerCubicMeter); - AssertEx.EqualTolerance(1, quantity52.TonnesPerCubicMeter, TonnesPerCubicMeterTolerance); - Assert.Equal(DensityUnit.TonnePerCubicMeter, quantity52.Unit); + var quantity52 = Density.From(1, DensityUnit.TonnePerCubicFoot); + AssertEx.EqualTolerance(1, quantity52.TonnesPerCubicFoot, TonnesPerCubicFootTolerance); + Assert.Equal(DensityUnit.TonnePerCubicFoot, quantity52.Unit); - var quantity53 = Density.From(1, DensityUnit.TonnePerCubicMillimeter); - AssertEx.EqualTolerance(1, quantity53.TonnesPerCubicMillimeter, TonnesPerCubicMillimeterTolerance); - Assert.Equal(DensityUnit.TonnePerCubicMillimeter, quantity53.Unit); + var quantity53 = Density.From(1, DensityUnit.TonnePerCubicInch); + AssertEx.EqualTolerance(1, quantity53.TonnesPerCubicInch, TonnesPerCubicInchTolerance); + Assert.Equal(DensityUnit.TonnePerCubicInch, quantity53.Unit); + + var quantity54 = Density.From(1, DensityUnit.TonnePerCubicMeter); + AssertEx.EqualTolerance(1, quantity54.TonnesPerCubicMeter, TonnesPerCubicMeterTolerance); + Assert.Equal(DensityUnit.TonnePerCubicMeter, quantity54.Unit); + + var quantity55 = Density.From(1, DensityUnit.TonnePerCubicMillimeter); + AssertEx.EqualTolerance(1, quantity55.TonnesPerCubicMillimeter, TonnesPerCubicMillimeterTolerance); + Assert.Equal(DensityUnit.TonnePerCubicMillimeter, quantity55.Unit); } @@ -647,6 +665,7 @@ public void As() AssertEx.EqualTolerance(KilogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilogramPerLiter), KilogramsPerLiterTolerance); AssertEx.EqualTolerance(KilopoundsPerCubicFootInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilopoundPerCubicFoot), KilopoundsPerCubicFootTolerance); AssertEx.EqualTolerance(KilopoundsPerCubicInchInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilopoundPerCubicInch), KilopoundsPerCubicInchTolerance); + AssertEx.EqualTolerance(KilopoundsPerCubicYardInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilopoundPerCubicYard), KilopoundsPerCubicYardTolerance); AssertEx.EqualTolerance(MicrogramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MicrogramPerCubicMeter), MicrogramsPerCubicMeterTolerance); AssertEx.EqualTolerance(MicrogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MicrogramPerDeciliter), MicrogramsPerDeciLiterTolerance); AssertEx.EqualTolerance(MicrogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MicrogramPerLiter), MicrogramsPerLiterTolerance); @@ -666,6 +685,7 @@ public void As() AssertEx.EqualTolerance(PoundsPerCubicInchInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PoundPerCubicInch), PoundsPerCubicInchTolerance); AssertEx.EqualTolerance(PoundsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PoundPerCubicMeter), PoundsPerCubicMeterTolerance); AssertEx.EqualTolerance(PoundsPerCubicMillimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PoundPerCubicMillimeter), PoundsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(PoundsPerCubicYardInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PoundPerCubicYard), PoundsPerCubicYardTolerance); AssertEx.EqualTolerance(PoundsPerImperialGallonInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PoundPerImperialGallon), PoundsPerImperialGallonTolerance); AssertEx.EqualTolerance(PoundsPerUSGallonInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PoundPerUSGallon), PoundsPerUSGallonTolerance); AssertEx.EqualTolerance(SlugsPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.SlugPerCubicCentimeter), SlugsPerCubicCentimeterTolerance); @@ -875,6 +895,13 @@ public void Parse() Assert.Equal(DensityUnit.KilopoundPerCubicInch, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 kip/yd³", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.KilopoundsPerCubicYard, KilopoundsPerCubicYardTolerance); + Assert.Equal(DensityUnit.KilopoundPerCubicYard, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 µg/m³", CultureInfo.GetCultureInfo("en-US")); @@ -1022,6 +1049,13 @@ public void Parse() Assert.Equal(DensityUnit.PoundPerCubicMillimeter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 lb/yd³", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PoundsPerCubicYard, PoundsPerCubicYardTolerance); + Assert.Equal(DensityUnit.PoundPerCubicYard, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 ppg (imp.)", CultureInfo.GetCultureInfo("en-US")); @@ -1261,6 +1295,12 @@ public void TryParse() Assert.Equal(DensityUnit.KilopoundPerCubicInch, parsed.Unit); } + { + Assert.True(Density.TryParse("1 kip/yd³", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.KilopoundsPerCubicYard, KilopoundsPerCubicYardTolerance); + Assert.Equal(DensityUnit.KilopoundPerCubicYard, parsed.Unit); + } + { Assert.True(Density.TryParse("1 µg/m³", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.MicrogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); @@ -1387,6 +1427,12 @@ public void TryParse() Assert.Equal(DensityUnit.PoundPerCubicMillimeter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 lb/yd³", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.PoundsPerCubicYard, PoundsPerCubicYardTolerance); + Assert.Equal(DensityUnit.PoundPerCubicYard, parsed.Unit); + } + { Assert.True(Density.TryParse("1 ppg (imp.)", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.PoundsPerImperialGallon, PoundsPerImperialGallonTolerance); @@ -1614,6 +1660,12 @@ public void ParseUnit() Assert.Equal(DensityUnit.KilopoundPerCubicInch, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Density.ParseUnit("kip/yd³", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.KilopoundPerCubicYard, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Density.ParseUnit("µg/m³", CultureInfo.GetCultureInfo("en-US")); @@ -1740,6 +1792,12 @@ public void ParseUnit() Assert.Equal(DensityUnit.PoundPerCubicMillimeter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Density.ParseUnit("lb/yd³", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.PoundPerCubicYard, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Density.ParseUnit("ppg (imp.)", CultureInfo.GetCultureInfo("en-US")); @@ -1942,6 +2000,11 @@ public void TryParseUnit() Assert.Equal(DensityUnit.KilopoundPerCubicInch, parsedUnit); } + { + Assert.True(Density.TryParseUnit("kip/yd³", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.KilopoundPerCubicYard, parsedUnit); + } + { Assert.True(Density.TryParseUnit("µg/m³", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.MicrogramPerCubicMeter, parsedUnit); @@ -2047,6 +2110,11 @@ public void TryParseUnit() Assert.Equal(DensityUnit.PoundPerCubicMillimeter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("lb/yd³", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.PoundPerCubicYard, parsedUnit); + } + { Assert.True(Density.TryParseUnit("ppg (imp.)", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.PoundPerImperialGallon, parsedUnit); @@ -2178,6 +2246,7 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Density.FromKilogramsPerLiter(kilogrampercubicmeter.KilogramsPerLiter).KilogramsPerCubicMeter, KilogramsPerLiterTolerance); AssertEx.EqualTolerance(1, Density.FromKilopoundsPerCubicFoot(kilogrampercubicmeter.KilopoundsPerCubicFoot).KilogramsPerCubicMeter, KilopoundsPerCubicFootTolerance); AssertEx.EqualTolerance(1, Density.FromKilopoundsPerCubicInch(kilogrampercubicmeter.KilopoundsPerCubicInch).KilogramsPerCubicMeter, KilopoundsPerCubicInchTolerance); + AssertEx.EqualTolerance(1, Density.FromKilopoundsPerCubicYard(kilogrampercubicmeter.KilopoundsPerCubicYard).KilogramsPerCubicMeter, KilopoundsPerCubicYardTolerance); AssertEx.EqualTolerance(1, Density.FromMicrogramsPerCubicMeter(kilogrampercubicmeter.MicrogramsPerCubicMeter).KilogramsPerCubicMeter, MicrogramsPerCubicMeterTolerance); AssertEx.EqualTolerance(1, Density.FromMicrogramsPerDeciLiter(kilogrampercubicmeter.MicrogramsPerDeciLiter).KilogramsPerCubicMeter, MicrogramsPerDeciLiterTolerance); AssertEx.EqualTolerance(1, Density.FromMicrogramsPerLiter(kilogrampercubicmeter.MicrogramsPerLiter).KilogramsPerCubicMeter, MicrogramsPerLiterTolerance); @@ -2197,6 +2266,7 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Density.FromPoundsPerCubicInch(kilogrampercubicmeter.PoundsPerCubicInch).KilogramsPerCubicMeter, PoundsPerCubicInchTolerance); AssertEx.EqualTolerance(1, Density.FromPoundsPerCubicMeter(kilogrampercubicmeter.PoundsPerCubicMeter).KilogramsPerCubicMeter, PoundsPerCubicMeterTolerance); AssertEx.EqualTolerance(1, Density.FromPoundsPerCubicMillimeter(kilogrampercubicmeter.PoundsPerCubicMillimeter).KilogramsPerCubicMeter, PoundsPerCubicMillimeterTolerance); + AssertEx.EqualTolerance(1, Density.FromPoundsPerCubicYard(kilogrampercubicmeter.PoundsPerCubicYard).KilogramsPerCubicMeter, PoundsPerCubicYardTolerance); AssertEx.EqualTolerance(1, Density.FromPoundsPerImperialGallon(kilogrampercubicmeter.PoundsPerImperialGallon).KilogramsPerCubicMeter, PoundsPerImperialGallonTolerance); AssertEx.EqualTolerance(1, Density.FromPoundsPerUSGallon(kilogrampercubicmeter.PoundsPerUSGallon).KilogramsPerCubicMeter, PoundsPerUSGallonTolerance); AssertEx.EqualTolerance(1, Density.FromSlugsPerCubicCentimeter(kilogrampercubicmeter.SlugsPerCubicCentimeter).KilogramsPerCubicMeter, SlugsPerCubicCentimeterTolerance); @@ -2379,6 +2449,7 @@ public void ToString_ReturnsValueAndUnitAbbreviationInCurrentCulture() Assert.Equal("1 kg/l", new Density(1, DensityUnit.KilogramPerLiter).ToString()); Assert.Equal("1 kip/ft³", new Density(1, DensityUnit.KilopoundPerCubicFoot).ToString()); Assert.Equal("1 kip/in³", new Density(1, DensityUnit.KilopoundPerCubicInch).ToString()); + Assert.Equal("1 kip/yd³", new Density(1, DensityUnit.KilopoundPerCubicYard).ToString()); Assert.Equal("1 µg/m³", new Density(1, DensityUnit.MicrogramPerCubicMeter).ToString()); Assert.Equal("1 µg/dl", new Density(1, DensityUnit.MicrogramPerDeciliter).ToString()); Assert.Equal("1 µg/L", new Density(1, DensityUnit.MicrogramPerLiter).ToString()); @@ -2398,6 +2469,7 @@ public void ToString_ReturnsValueAndUnitAbbreviationInCurrentCulture() Assert.Equal("1 lb/in³", new Density(1, DensityUnit.PoundPerCubicInch).ToString()); Assert.Equal("1 lb/m³", new Density(1, DensityUnit.PoundPerCubicMeter).ToString()); Assert.Equal("1 lb/mm³", new Density(1, DensityUnit.PoundPerCubicMillimeter).ToString()); + Assert.Equal("1 lb/yd³", new Density(1, DensityUnit.PoundPerCubicYard).ToString()); Assert.Equal("1 ppg (imp.)", new Density(1, DensityUnit.PoundPerImperialGallon).ToString()); Assert.Equal("1 ppg (U.S.)", new Density(1, DensityUnit.PoundPerUSGallon).ToString()); Assert.Equal("1 slug/cm³", new Density(1, DensityUnit.SlugPerCubicCentimeter).ToString()); @@ -2446,6 +2518,7 @@ public void ToString_WithSwedishCulture_ReturnsUnitAbbreviationForEnglishCulture Assert.Equal("1 kg/l", new Density(1, DensityUnit.KilogramPerLiter).ToString(swedishCulture)); Assert.Equal("1 kip/ft³", new Density(1, DensityUnit.KilopoundPerCubicFoot).ToString(swedishCulture)); Assert.Equal("1 kip/in³", new Density(1, DensityUnit.KilopoundPerCubicInch).ToString(swedishCulture)); + Assert.Equal("1 kip/yd³", new Density(1, DensityUnit.KilopoundPerCubicYard).ToString(swedishCulture)); Assert.Equal("1 µg/m³", new Density(1, DensityUnit.MicrogramPerCubicMeter).ToString(swedishCulture)); Assert.Equal("1 µg/dl", new Density(1, DensityUnit.MicrogramPerDeciliter).ToString(swedishCulture)); Assert.Equal("1 µg/L", new Density(1, DensityUnit.MicrogramPerLiter).ToString(swedishCulture)); @@ -2465,6 +2538,7 @@ public void ToString_WithSwedishCulture_ReturnsUnitAbbreviationForEnglishCulture Assert.Equal("1 lb/in³", new Density(1, DensityUnit.PoundPerCubicInch).ToString(swedishCulture)); Assert.Equal("1 lb/m³", new Density(1, DensityUnit.PoundPerCubicMeter).ToString(swedishCulture)); Assert.Equal("1 lb/mm³", new Density(1, DensityUnit.PoundPerCubicMillimeter).ToString(swedishCulture)); + Assert.Equal("1 lb/yd³", new Density(1, DensityUnit.PoundPerCubicYard).ToString(swedishCulture)); Assert.Equal("1 ppg (imp.)", new Density(1, DensityUnit.PoundPerImperialGallon).ToString(swedishCulture)); Assert.Equal("1 ppg (U.S.)", new Density(1, DensityUnit.PoundPerUSGallon).ToString(swedishCulture)); Assert.Equal("1 slug/cm³", new Density(1, DensityUnit.SlugPerCubicCentimeter).ToString(swedishCulture)); diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index 82c1a71798..c6554be8fb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -91,6 +91,7 @@ static Density() new UnitInfo(DensityUnit.KilogramPerLiter, "KilogramsPerLiter", new BaseUnits(length: LengthUnit.Decimeter, mass: MassUnit.Kilogram), "Density"), new UnitInfo(DensityUnit.KilopoundPerCubicFoot, "KilopoundsPerCubicFoot", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.KilopoundPerCubicInch, "KilopoundsPerCubicInch", BaseUnits.Undefined, "Density"), + new UnitInfo(DensityUnit.KilopoundPerCubicYard, "KilopoundsPerCubicYard", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.MicrogramPerCubicMeter, "MicrogramsPerCubicMeter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.MicrogramPerDeciliter, "MicrogramsPerDeciLiter", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.MicrogramPerLiter, "MicrogramsPerLiter", BaseUnits.Undefined, "Density"), @@ -110,6 +111,7 @@ static Density() new UnitInfo(DensityUnit.PoundPerCubicInch, "PoundsPerCubicInch", new BaseUnits(length: LengthUnit.Inch, mass: MassUnit.Pound), "Density"), new UnitInfo(DensityUnit.PoundPerCubicMeter, "PoundsPerCubicMeter", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Pound), "Density"), new UnitInfo(DensityUnit.PoundPerCubicMillimeter, "PoundsPerCubicMillimeter", new BaseUnits(length: LengthUnit.Millimeter, mass: MassUnit.Pound), "Density"), + new UnitInfo(DensityUnit.PoundPerCubicYard, "PoundsPerCubicYard", new BaseUnits(length: LengthUnit.Yard, mass: MassUnit.Pound), "Density"), new UnitInfo(DensityUnit.PoundPerImperialGallon, "PoundsPerImperialGallon", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.PoundPerUSGallon, "PoundsPerUSGallon", BaseUnits.Undefined, "Density"), new UnitInfo(DensityUnit.SlugPerCubicCentimeter, "SlugsPerCubicCentimeter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Slug), "Density"), @@ -340,6 +342,11 @@ public Density(double value, UnitSystem unitSystem) /// public double KilopoundsPerCubicInch => As(DensityUnit.KilopoundPerCubicInch); + /// + /// Gets a value of this quantity converted into + /// + public double KilopoundsPerCubicYard => As(DensityUnit.KilopoundPerCubicYard); + /// /// Gets a value of this quantity converted into /// @@ -435,6 +442,11 @@ public Density(double value, UnitSystem unitSystem) /// public double PoundsPerCubicMillimeter => As(DensityUnit.PoundPerCubicMillimeter); + /// + /// Gets a value of this quantity converted into + /// + public double PoundsPerCubicYard => As(DensityUnit.PoundPerCubicYard); + /// /// Gets a value of this quantity converted into /// @@ -528,6 +540,7 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(DensityUnit.KilogramPerLiter, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.KilopoundPerCubicFoot, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.KilopoundPerCubicInch, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); + unitConverter.SetConversionFunction(DensityUnit.KilopoundPerCubicYard, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.MicrogramPerCubicMeter, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.MicrogramPerDeciliter, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.MicrogramPerLiter, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); @@ -547,6 +560,7 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(DensityUnit.PoundPerCubicInch, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.PoundPerCubicMeter, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.PoundPerCubicMillimeter, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); + unitConverter.SetConversionFunction(DensityUnit.PoundPerCubicYard, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.PoundPerImperialGallon, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.PoundPerUSGallon, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.SlugPerCubicCentimeter, DensityUnit.KilogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.KilogramPerCubicMeter)); @@ -586,6 +600,7 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.KilogramPerLiter, quantity => quantity.ToUnit(DensityUnit.KilogramPerLiter)); unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.KilopoundPerCubicFoot, quantity => quantity.ToUnit(DensityUnit.KilopoundPerCubicFoot)); unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.KilopoundPerCubicInch, quantity => quantity.ToUnit(DensityUnit.KilopoundPerCubicInch)); + unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.KilopoundPerCubicYard, quantity => quantity.ToUnit(DensityUnit.KilopoundPerCubicYard)); unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.MicrogramPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.MicrogramPerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.MicrogramPerDeciliter, quantity => quantity.ToUnit(DensityUnit.MicrogramPerDeciliter)); unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.MicrogramPerLiter, quantity => quantity.ToUnit(DensityUnit.MicrogramPerLiter)); @@ -605,6 +620,7 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.PoundPerCubicInch, quantity => quantity.ToUnit(DensityUnit.PoundPerCubicInch)); unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.PoundPerCubicMeter, quantity => quantity.ToUnit(DensityUnit.PoundPerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.PoundPerCubicMillimeter, quantity => quantity.ToUnit(DensityUnit.PoundPerCubicMillimeter)); + unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.PoundPerCubicYard, quantity => quantity.ToUnit(DensityUnit.PoundPerCubicYard)); unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.PoundPerImperialGallon, quantity => quantity.ToUnit(DensityUnit.PoundPerImperialGallon)); unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.PoundPerUSGallon, quantity => quantity.ToUnit(DensityUnit.PoundPerUSGallon)); unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.SlugPerCubicCentimeter, quantity => quantity.ToUnit(DensityUnit.SlugPerCubicCentimeter)); @@ -874,6 +890,16 @@ public static Density FromKilopoundsPerCubicInch(QuantityValue kilopoundspercubi return new Density(value, DensityUnit.KilopoundPerCubicInch); } + /// + /// Creates a from . + /// + /// If value is NaN or Infinity. + public static Density FromKilopoundsPerCubicYard(QuantityValue kilopoundspercubicyard) + { + double value = (double) kilopoundspercubicyard; + return new Density(value, DensityUnit.KilopoundPerCubicYard); + } + /// /// Creates a from . /// @@ -1064,6 +1090,16 @@ public static Density FromPoundsPerCubicMillimeter(QuantityValue poundspercubicm return new Density(value, DensityUnit.PoundPerCubicMillimeter); } + /// + /// Creates a from . + /// + /// If value is NaN or Infinity. + public static Density FromPoundsPerCubicYard(QuantityValue poundspercubicyard) + { + double value = (double) poundspercubicyard; + return new Density(value, DensityUnit.PoundPerCubicYard); + } + /// /// Creates a from . /// @@ -1699,6 +1735,7 @@ private bool TryToUnit(DensityUnit unit, [NotNullWhen(true)] out Density? conver (DensityUnit.KilogramPerLiter, DensityUnit.KilogramPerCubicMeter) => new Density(_value * 1e3, DensityUnit.KilogramPerCubicMeter), (DensityUnit.KilopoundPerCubicFoot, DensityUnit.KilogramPerCubicMeter) => new Density((_value / 0.062427961) * 1e3d, DensityUnit.KilogramPerCubicMeter), (DensityUnit.KilopoundPerCubicInch, DensityUnit.KilogramPerCubicMeter) => new Density((_value / 3.6127298147753e-5) * 1e3d, DensityUnit.KilogramPerCubicMeter), + (DensityUnit.KilopoundPerCubicYard, DensityUnit.KilogramPerCubicMeter) => new Density((_value / 1.685554936) * 1e3d, DensityUnit.KilogramPerCubicMeter), (DensityUnit.MicrogramPerCubicMeter, DensityUnit.KilogramPerCubicMeter) => new Density((_value / 1e3) * 1e-6d, DensityUnit.KilogramPerCubicMeter), (DensityUnit.MicrogramPerDeciliter, DensityUnit.KilogramPerCubicMeter) => new Density((_value / 1e-1) * 1e-6d, DensityUnit.KilogramPerCubicMeter), (DensityUnit.MicrogramPerLiter, DensityUnit.KilogramPerCubicMeter) => new Density((_value / 1) * 1e-6d, DensityUnit.KilogramPerCubicMeter), @@ -1718,6 +1755,7 @@ private bool TryToUnit(DensityUnit unit, [NotNullWhen(true)] out Density? conver (DensityUnit.PoundPerCubicInch, DensityUnit.KilogramPerCubicMeter) => new Density(_value / 3.6127298147753e-5, DensityUnit.KilogramPerCubicMeter), (DensityUnit.PoundPerCubicMeter, DensityUnit.KilogramPerCubicMeter) => new Density(_value / 2.204622621848775, DensityUnit.KilogramPerCubicMeter), (DensityUnit.PoundPerCubicMillimeter, DensityUnit.KilogramPerCubicMeter) => new Density(_value / 2.204622621848775e-9, DensityUnit.KilogramPerCubicMeter), + (DensityUnit.PoundPerCubicYard, DensityUnit.KilogramPerCubicMeter) => new Density(_value / 1.685554936, DensityUnit.KilogramPerCubicMeter), (DensityUnit.PoundPerImperialGallon, DensityUnit.KilogramPerCubicMeter) => new Density(_value * 9.9776398e1, DensityUnit.KilogramPerCubicMeter), (DensityUnit.PoundPerUSGallon, DensityUnit.KilogramPerCubicMeter) => new Density(_value * 1.19826427e2, DensityUnit.KilogramPerCubicMeter), (DensityUnit.SlugPerCubicCentimeter, DensityUnit.KilogramPerCubicMeter) => new Density(_value * 14593903, DensityUnit.KilogramPerCubicMeter), @@ -1754,6 +1792,7 @@ private bool TryToUnit(DensityUnit unit, [NotNullWhen(true)] out Density? conver (DensityUnit.KilogramPerCubicMeter, DensityUnit.KilogramPerLiter) => new Density(_value / 1e3, DensityUnit.KilogramPerLiter), (DensityUnit.KilogramPerCubicMeter, DensityUnit.KilopoundPerCubicFoot) => new Density((_value * 0.062427961) / 1e3d, DensityUnit.KilopoundPerCubicFoot), (DensityUnit.KilogramPerCubicMeter, DensityUnit.KilopoundPerCubicInch) => new Density((_value * 3.6127298147753e-5) / 1e3d, DensityUnit.KilopoundPerCubicInch), + (DensityUnit.KilogramPerCubicMeter, DensityUnit.KilopoundPerCubicYard) => new Density((_value * 1.685554936) / 1e3d, DensityUnit.KilopoundPerCubicYard), (DensityUnit.KilogramPerCubicMeter, DensityUnit.MicrogramPerCubicMeter) => new Density((_value * 1e3) / 1e-6d, DensityUnit.MicrogramPerCubicMeter), (DensityUnit.KilogramPerCubicMeter, DensityUnit.MicrogramPerDeciliter) => new Density((_value * 1e-1) / 1e-6d, DensityUnit.MicrogramPerDeciliter), (DensityUnit.KilogramPerCubicMeter, DensityUnit.MicrogramPerLiter) => new Density((_value * 1) / 1e-6d, DensityUnit.MicrogramPerLiter), @@ -1773,6 +1812,7 @@ private bool TryToUnit(DensityUnit unit, [NotNullWhen(true)] out Density? conver (DensityUnit.KilogramPerCubicMeter, DensityUnit.PoundPerCubicInch) => new Density(_value * 3.6127298147753e-5, DensityUnit.PoundPerCubicInch), (DensityUnit.KilogramPerCubicMeter, DensityUnit.PoundPerCubicMeter) => new Density(_value * 2.204622621848775, DensityUnit.PoundPerCubicMeter), (DensityUnit.KilogramPerCubicMeter, DensityUnit.PoundPerCubicMillimeter) => new Density(_value * 2.204622621848775e-9, DensityUnit.PoundPerCubicMillimeter), + (DensityUnit.KilogramPerCubicMeter, DensityUnit.PoundPerCubicYard) => new Density(_value * 1.685554936, DensityUnit.PoundPerCubicYard), (DensityUnit.KilogramPerCubicMeter, DensityUnit.PoundPerImperialGallon) => new Density(_value / 9.9776398e1, DensityUnit.PoundPerImperialGallon), (DensityUnit.KilogramPerCubicMeter, DensityUnit.PoundPerUSGallon) => new Density(_value / 1.19826427e2, DensityUnit.PoundPerUSGallon), (DensityUnit.KilogramPerCubicMeter, DensityUnit.SlugPerCubicCentimeter) => new Density(_value / 14593903, DensityUnit.SlugPerCubicCentimeter), diff --git a/UnitsNet/GeneratedCode/Resources/Density.restext b/UnitsNet/GeneratedCode/Resources/Density.restext index b66ea2f9cc..9f0383bee7 100644 --- a/UnitsNet/GeneratedCode/Resources/Density.restext +++ b/UnitsNet/GeneratedCode/Resources/Density.restext @@ -21,6 +21,7 @@ KilogramsPerCubicMillimeter=kg/mm³ KilogramsPerLiter=kg/l KilopoundsPerCubicFoot=kip/ft³ KilopoundsPerCubicInch=kip/in³ +KilopoundsPerCubicYard=kip/yd³ MicrogramsPerCubicMeter=µg/m³ MicrogramsPerDeciLiter=µg/dl MicrogramsPerLiter=µg/L @@ -40,6 +41,7 @@ PoundsPerCubicFoot=lb/ft³ PoundsPerCubicInch=lb/in³ PoundsPerCubicMeter=lb/m³ PoundsPerCubicMillimeter=lb/mm³ +PoundsPerCubicYard=lb/yd³ PoundsPerImperialGallon=ppg (imp.) PoundsPerUSGallon=ppg (U.S.) SlugsPerCubicCentimeter=slug/cm³ diff --git a/UnitsNet/GeneratedCode/Units/DensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/DensityUnit.g.cs index 5584b0398c..7ddfd3c648 100644 --- a/UnitsNet/GeneratedCode/Units/DensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/DensityUnit.g.cs @@ -48,6 +48,7 @@ public enum DensityUnit KilogramPerLiter = 18, KilopoundPerCubicFoot = 19, KilopoundPerCubicInch = 20, + KilopoundPerCubicYard = 64, MicrogramPerCubicMeter = 21, MicrogramPerDeciliter = 22, MicrogramPerLiter = 23, @@ -67,6 +68,7 @@ public enum DensityUnit PoundPerCubicInch = 37, PoundPerCubicMeter = 38, PoundPerCubicMillimeter = 39, + PoundPerCubicYard = 58, PoundPerImperialGallon = 40, PoundPerUSGallon = 41, SlugPerCubicCentimeter = 42,