diff --git a/Common/UnitDefinitions/Density.json b/Common/UnitDefinitions/Density.json index 29551305fb..04f817f881 100644 --- a/Common/UnitDefinitions/Density.json +++ b/Common/UnitDefinitions/Density.json @@ -170,9 +170,13 @@ "FromBaseToUnitFunc": "{x} * 1", "Prefixes": [ "Pico", "Nano", "Micro", "Milli", "Centi", "Deci" ], "Localization": [ + { + "Culture": "en", + "Abbreviations": [ "g/l" ] + }, { "Culture": "en-US", - "Abbreviations": [ "g/L" ] + "Abbreviations": [ "g/L", "g/l" ] } ] }, @@ -184,8 +188,12 @@ "Prefixes": [ "Pico", "Nano", "Micro", "Milli", "Centi", "Deci" ], "Localization": [ { - "Culture": "en-US", + "Culture": "en", "Abbreviations": [ "g/dl" ] + }, + { + "Culture": "en-US", + "Abbreviations": [ "g/dL", "g/dl" ] } ] }, @@ -197,8 +205,12 @@ "Prefixes": [ "Pico", "Nano", "Micro", "Milli", "Centi", "Deci" ], "Localization": [ { - "Culture": "en-US", + "Culture": "en", "Abbreviations": [ "g/ml" ] + }, + { + "Culture": "en-US", + "Abbreviations": [ "g/mL", "g/ml" ] } ] }, @@ -237,8 +249,12 @@ "FromBaseToUnitFunc": "{x} / 1e3", "Localization": [ { - "Culture": "en-US", + "Culture": "en", "Abbreviations": [ "kg/l" ] + }, + { + "Culture": "en-US", + "Abbreviations": [ "kg/L", "kg/l" ] } ] }, diff --git a/Common/UnitDefinitions/Volume.json b/Common/UnitDefinitions/Volume.json index ce0ba8542b..3528148a59 100644 --- a/Common/UnitDefinitions/Volume.json +++ b/Common/UnitDefinitions/Volume.json @@ -14,9 +14,13 @@ "Prefixes": [ "Nano", "Micro", "Milli", "Centi", "Deci", "Deca", "Hecto", "Kilo", "Mega" ], "Localization": [ { - "Culture": "en-US", + "Culture": "en", "Abbreviations": [ "l" ] }, + { + "Culture": "en-US", + "Abbreviations": [ "L", "l" ] + }, { "Culture": "ru-RU", "Abbreviations": [ "л" ] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs index c42a8926f8..0d2236f41b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs @@ -670,6 +670,20 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported() [Fact] public void Parse() { + try + { + var parsed = Density.Parse("1 cg/dl", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.CentigramPerDeciliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 cg/dL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.CentigramPerDeciliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 cg/dl", CultureInfo.GetCultureInfo("en-US")); @@ -677,6 +691,13 @@ public void Parse() Assert.Equal(DensityUnit.CentigramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 cg/l", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.CentigramsPerLiter, CentigramsPerLiterTolerance); + Assert.Equal(DensityUnit.CentigramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 cg/L", CultureInfo.GetCultureInfo("en-US")); @@ -684,6 +705,27 @@ public void Parse() Assert.Equal(DensityUnit.CentigramPerLiter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 cg/l", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.CentigramsPerLiter, CentigramsPerLiterTolerance); + Assert.Equal(DensityUnit.CentigramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 cg/ml", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.CentigramPerMilliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 cg/mL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.CentigramPerMilliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 cg/ml", CultureInfo.GetCultureInfo("en-US")); @@ -691,6 +733,20 @@ public void Parse() Assert.Equal(DensityUnit.CentigramPerMilliliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 dg/dl", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.DecigramPerDeciliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 dg/dL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.DecigramPerDeciliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 dg/dl", CultureInfo.GetCultureInfo("en-US")); @@ -698,6 +754,13 @@ public void Parse() Assert.Equal(DensityUnit.DecigramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 dg/l", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.DecigramsPerLiter, DecigramsPerLiterTolerance); + Assert.Equal(DensityUnit.DecigramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 dg/L", CultureInfo.GetCultureInfo("en-US")); @@ -705,6 +768,27 @@ public void Parse() Assert.Equal(DensityUnit.DecigramPerLiter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 dg/l", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.DecigramsPerLiter, DecigramsPerLiterTolerance); + Assert.Equal(DensityUnit.DecigramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 dg/ml", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.DecigramsPerMilliliter, DecigramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.DecigramPerMilliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 dg/mL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.DecigramsPerMilliliter, DecigramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.DecigramPerMilliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 dg/ml", CultureInfo.GetCultureInfo("en-US")); @@ -754,6 +838,20 @@ public void Parse() Assert.Equal(DensityUnit.GramPerCubicMillimeter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 g/dl", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.GramsPerDeciLiter, GramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.GramPerDeciliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 g/dL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.GramsPerDeciLiter, GramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.GramPerDeciliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 g/dl", CultureInfo.GetCultureInfo("en-US")); @@ -761,6 +859,13 @@ public void Parse() Assert.Equal(DensityUnit.GramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 g/l", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.GramsPerLiter, GramsPerLiterTolerance); + Assert.Equal(DensityUnit.GramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 g/L", CultureInfo.GetCultureInfo("en-US")); @@ -768,6 +873,27 @@ public void Parse() Assert.Equal(DensityUnit.GramPerLiter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 g/l", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.GramsPerLiter, GramsPerLiterTolerance); + Assert.Equal(DensityUnit.GramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 g/ml", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.GramsPerMilliliter, GramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.GramPerMilliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 g/mL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.GramsPerMilliliter, GramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.GramPerMilliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 g/ml", CultureInfo.GetCultureInfo("en-US")); @@ -803,6 +929,20 @@ public void Parse() Assert.Equal(DensityUnit.KilogramPerCubicMillimeter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 kg/l", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.KilogramsPerLiter, KilogramsPerLiterTolerance); + Assert.Equal(DensityUnit.KilogramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 kg/L", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.KilogramsPerLiter, KilogramsPerLiterTolerance); + Assert.Equal(DensityUnit.KilogramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 kg/l", CultureInfo.GetCultureInfo("en-US")); @@ -838,6 +978,20 @@ public void Parse() Assert.Equal(DensityUnit.MicrogramPerCubicMeter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 µg/dl", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 µg/dL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 µg/dl", CultureInfo.GetCultureInfo("en-US")); @@ -845,6 +999,13 @@ public void Parse() Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 µg/l", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerLiter, MicrogramsPerLiterTolerance); + Assert.Equal(DensityUnit.MicrogramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 µg/L", CultureInfo.GetCultureInfo("en-US")); @@ -852,6 +1013,27 @@ public void Parse() Assert.Equal(DensityUnit.MicrogramPerLiter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Density.Parse("1 µg/l", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerLiter, MicrogramsPerLiterTolerance); + Assert.Equal(DensityUnit.MicrogramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 µg/ml", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.MicrogramPerMilliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 µg/mL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.MicrogramPerMilliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Density.Parse("1 µg/ml", CultureInfo.GetCultureInfo("en-US")); @@ -875,142 +1057,268 @@ public void Parse() try { - var parsed = Density.Parse("1 mg/dl", CultureInfo.GetCultureInfo("en-US")); + var parsed = Density.Parse("1 mg/dl", CultureInfo.GetCultureInfo("en")); AssertEx.EqualTolerance(1, parsed.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); Assert.Equal(DensityUnit.MilligramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 mg/L", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MilligramsPerLiter, MilligramsPerLiterTolerance); - Assert.Equal(DensityUnit.MilligramPerLiter, parsed.Unit); + var parsed = Density.Parse("1 mg/dL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.MilligramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 mg/ml", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.MilligramPerMilliliter, parsed.Unit); + var parsed = Density.Parse("1 mg/dl", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.MilligramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 ng/dl", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.NanogramPerDeciliter, parsed.Unit); + var parsed = Density.Parse("1 mg/l", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.MilligramsPerLiter, MilligramsPerLiterTolerance); + Assert.Equal(DensityUnit.MilligramPerLiter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 ng/L", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.NanogramsPerLiter, NanogramsPerLiterTolerance); - Assert.Equal(DensityUnit.NanogramPerLiter, parsed.Unit); + var parsed = Density.Parse("1 mg/L", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.MilligramsPerLiter, MilligramsPerLiterTolerance); + Assert.Equal(DensityUnit.MilligramPerLiter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 ng/ml", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.NanogramPerMilliliter, parsed.Unit); + var parsed = Density.Parse("1 mg/l", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.MilligramsPerLiter, MilligramsPerLiterTolerance); + Assert.Equal(DensityUnit.MilligramPerLiter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 pg/dl", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.PicogramPerDeciliter, parsed.Unit); + var parsed = Density.Parse("1 mg/ml", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.MilligramPerMilliliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 pg/L", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.PicogramsPerLiter, PicogramsPerLiterTolerance); - Assert.Equal(DensityUnit.PicogramPerLiter, parsed.Unit); + var parsed = Density.Parse("1 mg/mL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.MilligramPerMilliliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 pg/ml", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.PicogramPerMilliliter, parsed.Unit); + var parsed = Density.Parse("1 mg/ml", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.MilligramPerMilliliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 lb/cm³", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.PoundsPerCubicCentimeter, PoundsPerCubicCentimeterTolerance); - Assert.Equal(DensityUnit.PoundPerCubicCentimeter, parsed.Unit); + var parsed = Density.Parse("1 ng/dl", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.NanogramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 lb/ft³", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.PoundsPerCubicFoot, PoundsPerCubicFootTolerance); - Assert.Equal(DensityUnit.PoundPerCubicFoot, parsed.Unit); + var parsed = Density.Parse("1 ng/dL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.NanogramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 lb/in³", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.PoundsPerCubicInch, PoundsPerCubicInchTolerance); - Assert.Equal(DensityUnit.PoundPerCubicInch, parsed.Unit); + var parsed = Density.Parse("1 ng/dl", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.NanogramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 lb/m³", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.PoundsPerCubicMeter, PoundsPerCubicMeterTolerance); - Assert.Equal(DensityUnit.PoundPerCubicMeter, parsed.Unit); + var parsed = Density.Parse("1 ng/l", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.NanogramsPerLiter, NanogramsPerLiterTolerance); + Assert.Equal(DensityUnit.NanogramPerLiter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 lb/mm³", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.PoundsPerCubicMillimeter, PoundsPerCubicMillimeterTolerance); - Assert.Equal(DensityUnit.PoundPerCubicMillimeter, parsed.Unit); + var parsed = Density.Parse("1 ng/L", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.NanogramsPerLiter, NanogramsPerLiterTolerance); + Assert.Equal(DensityUnit.NanogramPerLiter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 ppg (imp.)", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.PoundsPerImperialGallon, PoundsPerImperialGallonTolerance); - Assert.Equal(DensityUnit.PoundPerImperialGallon, parsed.Unit); + var parsed = Density.Parse("1 ng/l", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.NanogramsPerLiter, NanogramsPerLiterTolerance); + Assert.Equal(DensityUnit.NanogramPerLiter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 ppg (U.S.)", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.PoundsPerUSGallon, PoundsPerUSGallonTolerance); - Assert.Equal(DensityUnit.PoundPerUSGallon, parsed.Unit); + var parsed = Density.Parse("1 ng/ml", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.NanogramPerMilliliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 slug/cm³", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.SlugsPerCubicCentimeter, SlugsPerCubicCentimeterTolerance); - Assert.Equal(DensityUnit.SlugPerCubicCentimeter, parsed.Unit); + var parsed = Density.Parse("1 ng/mL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.NanogramPerMilliliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 slug/ft³", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.SlugsPerCubicFoot, SlugsPerCubicFootTolerance); - Assert.Equal(DensityUnit.SlugPerCubicFoot, parsed.Unit); + var parsed = Density.Parse("1 ng/ml", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.NanogramPerMilliliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 slug/in³", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.SlugsPerCubicInch, SlugsPerCubicInchTolerance); - Assert.Equal(DensityUnit.SlugPerCubicInch, parsed.Unit); + var parsed = Density.Parse("1 pg/dl", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.PicogramPerDeciliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsed = Density.Parse("1 slug/m³", CultureInfo.GetCultureInfo("en-US")); - AssertEx.EqualTolerance(1, parsed.SlugsPerCubicMeter, SlugsPerCubicMeterTolerance); - Assert.Equal(DensityUnit.SlugPerCubicMeter, parsed.Unit); + var parsed = Density.Parse("1 pg/dL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.PicogramPerDeciliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 pg/dl", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.PicogramPerDeciliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 pg/l", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.PicogramsPerLiter, PicogramsPerLiterTolerance); + Assert.Equal(DensityUnit.PicogramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 pg/L", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PicogramsPerLiter, PicogramsPerLiterTolerance); + Assert.Equal(DensityUnit.PicogramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 pg/l", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PicogramsPerLiter, PicogramsPerLiterTolerance); + Assert.Equal(DensityUnit.PicogramPerLiter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 pg/ml", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.PicogramPerMilliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 pg/mL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.PicogramPerMilliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 pg/ml", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.PicogramPerMilliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 lb/cm³", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PoundsPerCubicCentimeter, PoundsPerCubicCentimeterTolerance); + Assert.Equal(DensityUnit.PoundPerCubicCentimeter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 lb/ft³", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PoundsPerCubicFoot, PoundsPerCubicFootTolerance); + Assert.Equal(DensityUnit.PoundPerCubicFoot, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 lb/in³", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PoundsPerCubicInch, PoundsPerCubicInchTolerance); + Assert.Equal(DensityUnit.PoundPerCubicInch, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 lb/m³", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PoundsPerCubicMeter, PoundsPerCubicMeterTolerance); + Assert.Equal(DensityUnit.PoundPerCubicMeter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 lb/mm³", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PoundsPerCubicMillimeter, PoundsPerCubicMillimeterTolerance); + Assert.Equal(DensityUnit.PoundPerCubicMillimeter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 ppg (imp.)", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PoundsPerImperialGallon, PoundsPerImperialGallonTolerance); + Assert.Equal(DensityUnit.PoundPerImperialGallon, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 ppg (U.S.)", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.PoundsPerUSGallon, PoundsPerUSGallonTolerance); + Assert.Equal(DensityUnit.PoundPerUSGallon, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 slug/cm³", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.SlugsPerCubicCentimeter, SlugsPerCubicCentimeterTolerance); + Assert.Equal(DensityUnit.SlugPerCubicCentimeter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 slug/ft³", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.SlugsPerCubicFoot, SlugsPerCubicFootTolerance); + Assert.Equal(DensityUnit.SlugPerCubicFoot, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 slug/in³", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.SlugsPerCubicInch, SlugsPerCubicInchTolerance); + Assert.Equal(DensityUnit.SlugPerCubicInch, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Density.Parse("1 slug/m³", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.SlugsPerCubicMeter, SlugsPerCubicMeterTolerance); + Assert.Equal(DensityUnit.SlugPerCubicMeter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try @@ -1060,36 +1368,108 @@ public void Parse() [Fact] public void TryParse() { + { + Assert.True(Density.TryParse("1 cg/dl", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.CentigramPerDeciliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 cg/dL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.CentigramPerDeciliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 cg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); Assert.Equal(DensityUnit.CentigramPerDeciliter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 cg/l", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.CentigramsPerLiter, CentigramsPerLiterTolerance); + Assert.Equal(DensityUnit.CentigramPerLiter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 cg/L", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.CentigramsPerLiter, CentigramsPerLiterTolerance); Assert.Equal(DensityUnit.CentigramPerLiter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 cg/l", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.CentigramsPerLiter, CentigramsPerLiterTolerance); + Assert.Equal(DensityUnit.CentigramPerLiter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 cg/ml", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.CentigramPerMilliliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 cg/mL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.CentigramPerMilliliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 cg/ml", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); Assert.Equal(DensityUnit.CentigramPerMilliliter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 dg/dl", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.DecigramPerDeciliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 dg/dL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.DecigramPerDeciliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 dg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); Assert.Equal(DensityUnit.DecigramPerDeciliter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 dg/l", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.DecigramsPerLiter, DecigramsPerLiterTolerance); + Assert.Equal(DensityUnit.DecigramPerLiter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 dg/L", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.DecigramsPerLiter, DecigramsPerLiterTolerance); Assert.Equal(DensityUnit.DecigramPerLiter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 dg/l", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.DecigramsPerLiter, DecigramsPerLiterTolerance); + Assert.Equal(DensityUnit.DecigramPerLiter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 dg/ml", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.DecigramsPerMilliliter, DecigramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.DecigramPerMilliliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 dg/mL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.DecigramsPerMilliliter, DecigramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.DecigramPerMilliliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 dg/ml", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.DecigramsPerMilliliter, DecigramsPerMilliliterTolerance); @@ -1132,18 +1512,54 @@ public void TryParse() Assert.Equal(DensityUnit.GramPerCubicMillimeter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 g/dl", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.GramsPerDeciLiter, GramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.GramPerDeciliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 g/dL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.GramsPerDeciLiter, GramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.GramPerDeciliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 g/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.GramsPerDeciLiter, GramsPerDeciLiterTolerance); Assert.Equal(DensityUnit.GramPerDeciliter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 g/l", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.GramsPerLiter, GramsPerLiterTolerance); + Assert.Equal(DensityUnit.GramPerLiter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 g/L", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.GramsPerLiter, GramsPerLiterTolerance); Assert.Equal(DensityUnit.GramPerLiter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 g/l", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.GramsPerLiter, GramsPerLiterTolerance); + Assert.Equal(DensityUnit.GramPerLiter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 g/ml", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.GramsPerMilliliter, GramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.GramPerMilliliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 g/mL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.GramsPerMilliliter, GramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.GramPerMilliliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 g/ml", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.GramsPerMilliliter, GramsPerMilliliterTolerance); @@ -1174,6 +1590,18 @@ public void TryParse() Assert.Equal(DensityUnit.KilogramPerCubicMillimeter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 kg/l", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.KilogramsPerLiter, KilogramsPerLiterTolerance); + Assert.Equal(DensityUnit.KilogramPerLiter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 kg/L", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.KilogramsPerLiter, KilogramsPerLiterTolerance); + Assert.Equal(DensityUnit.KilogramPerLiter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 kg/l", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.KilogramsPerLiter, KilogramsPerLiterTolerance); @@ -1204,18 +1632,54 @@ public void TryParse() Assert.Equal(DensityUnit.MicrogramPerCubicMeter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 µg/dl", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 µg/dL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 µg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 µg/l", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerLiter, MicrogramsPerLiterTolerance); + Assert.Equal(DensityUnit.MicrogramPerLiter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 µg/L", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.MicrogramsPerLiter, MicrogramsPerLiterTolerance); Assert.Equal(DensityUnit.MicrogramPerLiter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 µg/l", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerLiter, MicrogramsPerLiterTolerance); + Assert.Equal(DensityUnit.MicrogramPerLiter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 µg/ml", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.MicrogramPerMilliliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 µg/mL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.MicrogramPerMilliliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 µg/ml", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); @@ -1235,53 +1699,161 @@ public void TryParse() } { - Assert.True(Density.TryParse("1 mg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + Assert.True(Density.TryParse("1 mg/dl", CultureInfo.GetCultureInfo("en"), out var parsed)); AssertEx.EqualTolerance(1, parsed.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); Assert.Equal(DensityUnit.MilligramPerDeciliter, parsed.Unit); } { - Assert.True(Density.TryParse("1 mg/L", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + Assert.True(Density.TryParse("1 mg/dL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.MilligramPerDeciliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 mg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.MilligramPerDeciliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 mg/l", CultureInfo.GetCultureInfo("en"), out var parsed)); AssertEx.EqualTolerance(1, parsed.MilligramsPerLiter, MilligramsPerLiterTolerance); Assert.Equal(DensityUnit.MilligramPerLiter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 mg/L", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.MilligramsPerLiter, MilligramsPerLiterTolerance); + Assert.Equal(DensityUnit.MilligramPerLiter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 mg/l", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.MilligramsPerLiter, MilligramsPerLiterTolerance); + Assert.Equal(DensityUnit.MilligramPerLiter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 mg/ml", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.MilligramPerMilliliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 mg/mL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.MilligramPerMilliliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 mg/ml", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); Assert.Equal(DensityUnit.MilligramPerMilliliter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 ng/dl", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.NanogramPerDeciliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 ng/dL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.NanogramPerDeciliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 ng/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); Assert.Equal(DensityUnit.NanogramPerDeciliter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 ng/l", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.NanogramsPerLiter, NanogramsPerLiterTolerance); + Assert.Equal(DensityUnit.NanogramPerLiter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 ng/L", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.NanogramsPerLiter, NanogramsPerLiterTolerance); Assert.Equal(DensityUnit.NanogramPerLiter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 ng/l", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.NanogramsPerLiter, NanogramsPerLiterTolerance); + Assert.Equal(DensityUnit.NanogramPerLiter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 ng/ml", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.NanogramPerMilliliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 ng/mL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.NanogramPerMilliliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 ng/ml", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); Assert.Equal(DensityUnit.NanogramPerMilliliter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 pg/dl", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.PicogramPerDeciliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 pg/dL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); + Assert.Equal(DensityUnit.PicogramPerDeciliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 pg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); Assert.Equal(DensityUnit.PicogramPerDeciliter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 pg/l", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.PicogramsPerLiter, PicogramsPerLiterTolerance); + Assert.Equal(DensityUnit.PicogramPerLiter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 pg/L", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.PicogramsPerLiter, PicogramsPerLiterTolerance); Assert.Equal(DensityUnit.PicogramPerLiter, parsed.Unit); } + { + Assert.True(Density.TryParse("1 pg/l", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.PicogramsPerLiter, PicogramsPerLiterTolerance); + Assert.Equal(DensityUnit.PicogramPerLiter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 pg/ml", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.PicogramPerMilliliter, parsed.Unit); + } + + { + Assert.True(Density.TryParse("1 pg/mL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); + Assert.Equal(DensityUnit.PicogramPerMilliliter, parsed.Unit); + } + { Assert.True(Density.TryParse("1 pg/ml", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); @@ -1395,36 +1967,108 @@ public void TryParse() [Fact] public void ParseUnit() { + try + { + var parsedUnit = Density.ParseUnit("cg/dl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.CentigramPerDeciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("cg/dL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.CentigramPerDeciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Density.ParseUnit("cg/dl", CultureInfo.GetCultureInfo("en-US")); Assert.Equal(DensityUnit.CentigramPerDeciliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Density.ParseUnit("cg/l", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.CentigramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Density.ParseUnit("cg/L", CultureInfo.GetCultureInfo("en-US")); Assert.Equal(DensityUnit.CentigramPerLiter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Density.ParseUnit("cg/l", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.CentigramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("cg/ml", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.CentigramPerMilliliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("cg/mL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.CentigramPerMilliliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Density.ParseUnit("cg/ml", CultureInfo.GetCultureInfo("en-US")); Assert.Equal(DensityUnit.CentigramPerMilliliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Density.ParseUnit("dg/dl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.DecigramPerDeciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("dg/dL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.DecigramPerDeciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Density.ParseUnit("dg/dl", CultureInfo.GetCultureInfo("en-US")); Assert.Equal(DensityUnit.DecigramPerDeciliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Density.ParseUnit("dg/l", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.DecigramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Density.ParseUnit("dg/L", CultureInfo.GetCultureInfo("en-US")); Assert.Equal(DensityUnit.DecigramPerLiter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Density.ParseUnit("dg/l", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.DecigramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("dg/ml", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.DecigramPerMilliliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("dg/mL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.DecigramPerMilliliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Density.ParseUnit("dg/ml", CultureInfo.GetCultureInfo("en-US")); @@ -1467,6 +2111,18 @@ public void ParseUnit() Assert.Equal(DensityUnit.GramPerCubicMillimeter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Density.ParseUnit("g/dl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.GramPerDeciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("g/dL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.GramPerDeciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Density.ParseUnit("g/dl", CultureInfo.GetCultureInfo("en-US")); @@ -1475,146 +2131,326 @@ public void ParseUnit() try { - var parsedUnit = Density.ParseUnit("g/L", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.GramPerLiter, parsedUnit); + var parsedUnit = Density.ParseUnit("g/l", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.GramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("g/L", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.GramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("g/l", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.GramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("g/ml", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.GramPerMilliliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("g/mL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.GramPerMilliliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("g/ml", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.GramPerMilliliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("kg/cm³", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.KilogramPerCubicCentimeter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("kg/m³", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.KilogramPerCubicMeter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("кг/м³", CultureInfo.GetCultureInfo("ru-RU")); + Assert.Equal(DensityUnit.KilogramPerCubicMeter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("kg/mm³", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.KilogramPerCubicMillimeter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("kg/l", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.KilogramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("kg/L", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.KilogramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("kg/l", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.KilogramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("kip/ft³", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.KilopoundPerCubicFoot, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("kip/in³", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.KilopoundPerCubicInch, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("µg/m³", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MicrogramPerCubicMeter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("мкг/м³", CultureInfo.GetCultureInfo("ru-RU")); + Assert.Equal(DensityUnit.MicrogramPerCubicMeter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("µg/dl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("µg/dL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("µg/dl", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("µg/l", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.MicrogramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("µg/L", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MicrogramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("µg/l", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MicrogramPerLiter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("µg/ml", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.MicrogramPerMilliliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("µg/mL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MicrogramPerMilliliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("µg/ml", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MicrogramPerMilliliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("mg/m³", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MilligramPerCubicMeter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("мг/м³", CultureInfo.GetCultureInfo("ru-RU")); + Assert.Equal(DensityUnit.MilligramPerCubicMeter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("mg/dl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.MilligramPerDeciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("mg/dL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MilligramPerDeciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Density.ParseUnit("mg/dl", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MilligramPerDeciliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("g/ml", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.GramPerMilliliter, parsedUnit); + var parsedUnit = Density.ParseUnit("mg/l", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.MilligramPerLiter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("kg/cm³", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.KilogramPerCubicCentimeter, parsedUnit); + var parsedUnit = Density.ParseUnit("mg/L", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MilligramPerLiter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("kg/m³", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.KilogramPerCubicMeter, parsedUnit); + var parsedUnit = Density.ParseUnit("mg/l", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MilligramPerLiter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("кг/м³", CultureInfo.GetCultureInfo("ru-RU")); - Assert.Equal(DensityUnit.KilogramPerCubicMeter, parsedUnit); + var parsedUnit = Density.ParseUnit("mg/ml", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.MilligramPerMilliliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("kg/mm³", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.KilogramPerCubicMillimeter, parsedUnit); + var parsedUnit = Density.ParseUnit("mg/mL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MilligramPerMilliliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("kg/l", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.KilogramPerLiter, parsedUnit); + var parsedUnit = Density.ParseUnit("mg/ml", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.MilligramPerMilliliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("kip/ft³", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.KilopoundPerCubicFoot, parsedUnit); + var parsedUnit = Density.ParseUnit("ng/dl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.NanogramPerDeciliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("kip/in³", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.KilopoundPerCubicInch, parsedUnit); + var parsedUnit = Density.ParseUnit("ng/dL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.NanogramPerDeciliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("µg/m³", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.MicrogramPerCubicMeter, parsedUnit); + var parsedUnit = Density.ParseUnit("ng/dl", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.NanogramPerDeciliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("мкг/м³", CultureInfo.GetCultureInfo("ru-RU")); - Assert.Equal(DensityUnit.MicrogramPerCubicMeter, parsedUnit); + var parsedUnit = Density.ParseUnit("ng/l", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.NanogramPerLiter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("µg/dl", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsedUnit); + var parsedUnit = Density.ParseUnit("ng/L", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.NanogramPerLiter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("µg/L", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.MicrogramPerLiter, parsedUnit); + var parsedUnit = Density.ParseUnit("ng/l", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.NanogramPerLiter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("µg/ml", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.MicrogramPerMilliliter, parsedUnit); + var parsedUnit = Density.ParseUnit("ng/ml", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.NanogramPerMilliliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("mg/m³", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.MilligramPerCubicMeter, parsedUnit); + var parsedUnit = Density.ParseUnit("ng/mL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.NanogramPerMilliliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("мг/м³", CultureInfo.GetCultureInfo("ru-RU")); - Assert.Equal(DensityUnit.MilligramPerCubicMeter, parsedUnit); + var parsedUnit = Density.ParseUnit("ng/ml", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.NanogramPerMilliliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("mg/dl", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.MilligramPerDeciliter, parsedUnit); + var parsedUnit = Density.ParseUnit("pg/dl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.PicogramPerDeciliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("mg/L", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.MilligramPerLiter, parsedUnit); + var parsedUnit = Density.ParseUnit("pg/dL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.PicogramPerDeciliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("mg/ml", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.MilligramPerMilliliter, parsedUnit); + var parsedUnit = Density.ParseUnit("pg/dl", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.PicogramPerDeciliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("ng/dl", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.NanogramPerDeciliter, parsedUnit); + var parsedUnit = Density.ParseUnit("pg/l", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.PicogramPerLiter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("ng/L", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.NanogramPerLiter, parsedUnit); + var parsedUnit = Density.ParseUnit("pg/L", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.PicogramPerLiter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("ng/ml", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.NanogramPerMilliliter, parsedUnit); + var parsedUnit = Density.ParseUnit("pg/l", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.PicogramPerLiter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("pg/dl", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.PicogramPerDeciliter, parsedUnit); + var parsedUnit = Density.ParseUnit("pg/ml", CultureInfo.GetCultureInfo("en")); + Assert.Equal(DensityUnit.PicogramPerMilliliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try { - var parsedUnit = Density.ParseUnit("pg/L", CultureInfo.GetCultureInfo("en-US")); - Assert.Equal(DensityUnit.PicogramPerLiter, parsedUnit); + var parsedUnit = Density.ParseUnit("pg/mL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(DensityUnit.PicogramPerMilliliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } try @@ -1730,31 +2566,91 @@ public void ParseUnit() [Fact] public void TryParseUnit() { + { + Assert.True(Density.TryParseUnit("cg/dl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.CentigramPerDeciliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("cg/dL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.CentigramPerDeciliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("cg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.CentigramPerDeciliter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("cg/l", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.CentigramPerLiter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("cg/L", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.CentigramPerLiter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("cg/l", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.CentigramPerLiter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("cg/ml", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.CentigramPerMilliliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("cg/mL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.CentigramPerMilliliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("cg/ml", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.CentigramPerMilliliter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("dg/dl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.DecigramPerDeciliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("dg/dL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.DecigramPerDeciliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("dg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.DecigramPerDeciliter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("dg/l", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.DecigramPerLiter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("dg/L", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.DecigramPerLiter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("dg/l", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.DecigramPerLiter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("dg/ml", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.DecigramPerMilliliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("dg/mL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.DecigramPerMilliliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("dg/ml", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.DecigramPerMilliliter, parsedUnit); @@ -1790,16 +2686,46 @@ public void TryParseUnit() Assert.Equal(DensityUnit.GramPerCubicMillimeter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("g/dl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.GramPerDeciliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("g/dL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.GramPerDeciliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("g/dl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.GramPerDeciliter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("g/l", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.GramPerLiter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("g/L", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.GramPerLiter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("g/l", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.GramPerLiter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("g/ml", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.GramPerMilliliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("g/mL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.GramPerMilliliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("g/ml", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.GramPerMilliliter, parsedUnit); @@ -1825,6 +2751,16 @@ public void TryParseUnit() Assert.Equal(DensityUnit.KilogramPerCubicMillimeter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("kg/l", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.KilogramPerLiter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("kg/L", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.KilogramPerLiter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("kg/l", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.KilogramPerLiter, parsedUnit); @@ -1850,16 +2786,46 @@ public void TryParseUnit() Assert.Equal(DensityUnit.MicrogramPerCubicMeter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("µg/dl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("µg/dL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("µg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.MicrogramPerDeciliter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("µg/l", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.MicrogramPerLiter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("µg/L", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.MicrogramPerLiter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("µg/l", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.MicrogramPerLiter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("µg/ml", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.MicrogramPerMilliliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("µg/mL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.MicrogramPerMilliliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("µg/ml", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.MicrogramPerMilliliter, parsedUnit); @@ -1875,46 +2841,136 @@ public void TryParseUnit() Assert.Equal(DensityUnit.MilligramPerCubicMeter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("mg/dl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.MilligramPerDeciliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("mg/dL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.MilligramPerDeciliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("mg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.MilligramPerDeciliter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("mg/l", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.MilligramPerLiter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("mg/L", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.MilligramPerLiter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("mg/l", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.MilligramPerLiter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("mg/ml", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.MilligramPerMilliliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("mg/mL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.MilligramPerMilliliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("mg/ml", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.MilligramPerMilliliter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("ng/dl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.NanogramPerDeciliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("ng/dL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.NanogramPerDeciliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("ng/dl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.NanogramPerDeciliter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("ng/l", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.NanogramPerLiter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("ng/L", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.NanogramPerLiter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("ng/l", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.NanogramPerLiter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("ng/ml", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.NanogramPerMilliliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("ng/mL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.NanogramPerMilliliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("ng/ml", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.NanogramPerMilliliter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("pg/dl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.PicogramPerDeciliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("pg/dL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.PicogramPerDeciliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("pg/dl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.PicogramPerDeciliter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("pg/l", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.PicogramPerLiter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("pg/L", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.PicogramPerLiter, parsedUnit); } + { + Assert.True(Density.TryParseUnit("pg/l", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.PicogramPerLiter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("pg/ml", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(DensityUnit.PicogramPerMilliliter, parsedUnit); + } + + { + Assert.True(Density.TryParseUnit("pg/mL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(DensityUnit.PicogramPerMilliliter, parsedUnit); + } + { Assert.True(Density.TryParseUnit("pg/ml", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(DensityUnit.PicogramPerMilliliter, parsedUnit); @@ -2251,40 +3307,40 @@ public void ToString_ReturnsValueAndUnitAbbreviationInCurrentCulture() var prevCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US"); try { - Assert.Equal("1 cg/dl", new Density(1, DensityUnit.CentigramPerDeciliter).ToString()); + Assert.Equal("1 cg/dL", new Density(1, DensityUnit.CentigramPerDeciliter).ToString()); Assert.Equal("1 cg/L", new Density(1, DensityUnit.CentigramPerLiter).ToString()); - Assert.Equal("1 cg/ml", new Density(1, DensityUnit.CentigramPerMilliliter).ToString()); - Assert.Equal("1 dg/dl", new Density(1, DensityUnit.DecigramPerDeciliter).ToString()); + Assert.Equal("1 cg/mL", new Density(1, DensityUnit.CentigramPerMilliliter).ToString()); + Assert.Equal("1 dg/dL", new Density(1, DensityUnit.DecigramPerDeciliter).ToString()); Assert.Equal("1 dg/L", new Density(1, DensityUnit.DecigramPerLiter).ToString()); - Assert.Equal("1 dg/ml", new Density(1, DensityUnit.DecigramPerMilliliter).ToString()); + Assert.Equal("1 dg/mL", new Density(1, DensityUnit.DecigramPerMilliliter).ToString()); Assert.Equal("1 g/cm³", new Density(1, DensityUnit.GramPerCubicCentimeter).ToString()); Assert.Equal("1 g/ft³", new Density(1, DensityUnit.GramPerCubicFoot).ToString()); Assert.Equal("1 g/in³", new Density(1, DensityUnit.GramPerCubicInch).ToString()); Assert.Equal("1 g/m³", new Density(1, DensityUnit.GramPerCubicMeter).ToString()); Assert.Equal("1 g/mm³", new Density(1, DensityUnit.GramPerCubicMillimeter).ToString()); - Assert.Equal("1 g/dl", new Density(1, DensityUnit.GramPerDeciliter).ToString()); + Assert.Equal("1 g/dL", new Density(1, DensityUnit.GramPerDeciliter).ToString()); Assert.Equal("1 g/L", new Density(1, DensityUnit.GramPerLiter).ToString()); - Assert.Equal("1 g/ml", new Density(1, DensityUnit.GramPerMilliliter).ToString()); + Assert.Equal("1 g/mL", new Density(1, DensityUnit.GramPerMilliliter).ToString()); Assert.Equal("1 kg/cm³", new Density(1, DensityUnit.KilogramPerCubicCentimeter).ToString()); Assert.Equal("1 kg/m³", new Density(1, DensityUnit.KilogramPerCubicMeter).ToString()); Assert.Equal("1 kg/mm³", new Density(1, DensityUnit.KilogramPerCubicMillimeter).ToString()); - Assert.Equal("1 kg/l", new Density(1, DensityUnit.KilogramPerLiter).ToString()); + 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 µg/m³", new Density(1, DensityUnit.MicrogramPerCubicMeter).ToString()); - Assert.Equal("1 µg/dl", new Density(1, DensityUnit.MicrogramPerDeciliter).ToString()); + Assert.Equal("1 µg/dL", new Density(1, DensityUnit.MicrogramPerDeciliter).ToString()); Assert.Equal("1 µg/L", new Density(1, DensityUnit.MicrogramPerLiter).ToString()); - Assert.Equal("1 µg/ml", new Density(1, DensityUnit.MicrogramPerMilliliter).ToString()); + Assert.Equal("1 µg/mL", new Density(1, DensityUnit.MicrogramPerMilliliter).ToString()); Assert.Equal("1 mg/m³", new Density(1, DensityUnit.MilligramPerCubicMeter).ToString()); - Assert.Equal("1 mg/dl", new Density(1, DensityUnit.MilligramPerDeciliter).ToString()); + Assert.Equal("1 mg/dL", new Density(1, DensityUnit.MilligramPerDeciliter).ToString()); Assert.Equal("1 mg/L", new Density(1, DensityUnit.MilligramPerLiter).ToString()); - Assert.Equal("1 mg/ml", new Density(1, DensityUnit.MilligramPerMilliliter).ToString()); - Assert.Equal("1 ng/dl", new Density(1, DensityUnit.NanogramPerDeciliter).ToString()); + Assert.Equal("1 mg/mL", new Density(1, DensityUnit.MilligramPerMilliliter).ToString()); + Assert.Equal("1 ng/dL", new Density(1, DensityUnit.NanogramPerDeciliter).ToString()); Assert.Equal("1 ng/L", new Density(1, DensityUnit.NanogramPerLiter).ToString()); - Assert.Equal("1 ng/ml", new Density(1, DensityUnit.NanogramPerMilliliter).ToString()); - Assert.Equal("1 pg/dl", new Density(1, DensityUnit.PicogramPerDeciliter).ToString()); + Assert.Equal("1 ng/mL", new Density(1, DensityUnit.NanogramPerMilliliter).ToString()); + Assert.Equal("1 pg/dL", new Density(1, DensityUnit.PicogramPerDeciliter).ToString()); Assert.Equal("1 pg/L", new Density(1, DensityUnit.PicogramPerLiter).ToString()); - Assert.Equal("1 pg/ml", new Density(1, DensityUnit.PicogramPerMilliliter).ToString()); + Assert.Equal("1 pg/mL", new Density(1, DensityUnit.PicogramPerMilliliter).ToString()); Assert.Equal("1 lb/cm³", new Density(1, DensityUnit.PoundPerCubicCentimeter).ToString()); Assert.Equal("1 lb/ft³", new Density(1, DensityUnit.PoundPerCubicFoot).ToString()); Assert.Equal("1 lb/in³", new Density(1, DensityUnit.PoundPerCubicInch).ToString()); @@ -2315,40 +3371,40 @@ public void ToString_WithSwedishCulture_ReturnsUnitAbbreviationForEnglishCulture // Chose this culture, because we don't currently have any abbreviations mapped for that culture and we expect the en-US to be used as fallback. var swedishCulture = CultureInfo.GetCultureInfo("sv-SE"); - Assert.Equal("1 cg/dl", new Density(1, DensityUnit.CentigramPerDeciliter).ToString(swedishCulture)); + Assert.Equal("1 cg/dL", new Density(1, DensityUnit.CentigramPerDeciliter).ToString(swedishCulture)); Assert.Equal("1 cg/L", new Density(1, DensityUnit.CentigramPerLiter).ToString(swedishCulture)); - Assert.Equal("1 cg/ml", new Density(1, DensityUnit.CentigramPerMilliliter).ToString(swedishCulture)); - Assert.Equal("1 dg/dl", new Density(1, DensityUnit.DecigramPerDeciliter).ToString(swedishCulture)); + Assert.Equal("1 cg/mL", new Density(1, DensityUnit.CentigramPerMilliliter).ToString(swedishCulture)); + Assert.Equal("1 dg/dL", new Density(1, DensityUnit.DecigramPerDeciliter).ToString(swedishCulture)); Assert.Equal("1 dg/L", new Density(1, DensityUnit.DecigramPerLiter).ToString(swedishCulture)); - Assert.Equal("1 dg/ml", new Density(1, DensityUnit.DecigramPerMilliliter).ToString(swedishCulture)); + Assert.Equal("1 dg/mL", new Density(1, DensityUnit.DecigramPerMilliliter).ToString(swedishCulture)); Assert.Equal("1 g/cm³", new Density(1, DensityUnit.GramPerCubicCentimeter).ToString(swedishCulture)); Assert.Equal("1 g/ft³", new Density(1, DensityUnit.GramPerCubicFoot).ToString(swedishCulture)); Assert.Equal("1 g/in³", new Density(1, DensityUnit.GramPerCubicInch).ToString(swedishCulture)); Assert.Equal("1 g/m³", new Density(1, DensityUnit.GramPerCubicMeter).ToString(swedishCulture)); Assert.Equal("1 g/mm³", new Density(1, DensityUnit.GramPerCubicMillimeter).ToString(swedishCulture)); - Assert.Equal("1 g/dl", new Density(1, DensityUnit.GramPerDeciliter).ToString(swedishCulture)); + Assert.Equal("1 g/dL", new Density(1, DensityUnit.GramPerDeciliter).ToString(swedishCulture)); Assert.Equal("1 g/L", new Density(1, DensityUnit.GramPerLiter).ToString(swedishCulture)); - Assert.Equal("1 g/ml", new Density(1, DensityUnit.GramPerMilliliter).ToString(swedishCulture)); + Assert.Equal("1 g/mL", new Density(1, DensityUnit.GramPerMilliliter).ToString(swedishCulture)); Assert.Equal("1 kg/cm³", new Density(1, DensityUnit.KilogramPerCubicCentimeter).ToString(swedishCulture)); Assert.Equal("1 kg/m³", new Density(1, DensityUnit.KilogramPerCubicMeter).ToString(swedishCulture)); Assert.Equal("1 kg/mm³", new Density(1, DensityUnit.KilogramPerCubicMillimeter).ToString(swedishCulture)); - Assert.Equal("1 kg/l", new Density(1, DensityUnit.KilogramPerLiter).ToString(swedishCulture)); + 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 µ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/dL", new Density(1, DensityUnit.MicrogramPerDeciliter).ToString(swedishCulture)); Assert.Equal("1 µg/L", new Density(1, DensityUnit.MicrogramPerLiter).ToString(swedishCulture)); - Assert.Equal("1 µg/ml", new Density(1, DensityUnit.MicrogramPerMilliliter).ToString(swedishCulture)); + Assert.Equal("1 µg/mL", new Density(1, DensityUnit.MicrogramPerMilliliter).ToString(swedishCulture)); Assert.Equal("1 mg/m³", new Density(1, DensityUnit.MilligramPerCubicMeter).ToString(swedishCulture)); - Assert.Equal("1 mg/dl", new Density(1, DensityUnit.MilligramPerDeciliter).ToString(swedishCulture)); + Assert.Equal("1 mg/dL", new Density(1, DensityUnit.MilligramPerDeciliter).ToString(swedishCulture)); Assert.Equal("1 mg/L", new Density(1, DensityUnit.MilligramPerLiter).ToString(swedishCulture)); - Assert.Equal("1 mg/ml", new Density(1, DensityUnit.MilligramPerMilliliter).ToString(swedishCulture)); - Assert.Equal("1 ng/dl", new Density(1, DensityUnit.NanogramPerDeciliter).ToString(swedishCulture)); + Assert.Equal("1 mg/mL", new Density(1, DensityUnit.MilligramPerMilliliter).ToString(swedishCulture)); + Assert.Equal("1 ng/dL", new Density(1, DensityUnit.NanogramPerDeciliter).ToString(swedishCulture)); Assert.Equal("1 ng/L", new Density(1, DensityUnit.NanogramPerLiter).ToString(swedishCulture)); - Assert.Equal("1 ng/ml", new Density(1, DensityUnit.NanogramPerMilliliter).ToString(swedishCulture)); - Assert.Equal("1 pg/dl", new Density(1, DensityUnit.PicogramPerDeciliter).ToString(swedishCulture)); + Assert.Equal("1 ng/mL", new Density(1, DensityUnit.NanogramPerMilliliter).ToString(swedishCulture)); + Assert.Equal("1 pg/dL", new Density(1, DensityUnit.PicogramPerDeciliter).ToString(swedishCulture)); Assert.Equal("1 pg/L", new Density(1, DensityUnit.PicogramPerLiter).ToString(swedishCulture)); - Assert.Equal("1 pg/ml", new Density(1, DensityUnit.PicogramPerMilliliter).ToString(swedishCulture)); + Assert.Equal("1 pg/mL", new Density(1, DensityUnit.PicogramPerMilliliter).ToString(swedishCulture)); Assert.Equal("1 lb/cm³", new Density(1, DensityUnit.PoundPerCubicCentimeter).ToString(swedishCulture)); Assert.Equal("1 lb/ft³", new Density(1, DensityUnit.PoundPerCubicFoot).ToString(swedishCulture)); Assert.Equal("1 lb/in³", new Density(1, DensityUnit.PoundPerCubicInch).ToString(swedishCulture)); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs index ac9688785c..89d1f3b55b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs @@ -753,6 +753,20 @@ public void Parse() Assert.Equal(VolumeUnit.BoardFoot, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Volume.Parse("1 cl", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.Centiliters, CentilitersTolerance); + Assert.Equal(VolumeUnit.Centiliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Volume.Parse("1 cL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.Centiliters, CentilitersTolerance); + Assert.Equal(VolumeUnit.Centiliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Volume.Parse("1 cl", CultureInfo.GetCultureInfo("en-US")); @@ -921,6 +935,20 @@ public void Parse() Assert.Equal(VolumeUnit.CubicYard, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Volume.Parse("1 dal", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.Decaliters, DecalitersTolerance); + Assert.Equal(VolumeUnit.Decaliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Volume.Parse("1 daL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.Decaliters, DecalitersTolerance); + Assert.Equal(VolumeUnit.Decaliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Volume.Parse("1 dal", CultureInfo.GetCultureInfo("en-US")); @@ -949,6 +977,20 @@ public void Parse() Assert.Equal(VolumeUnit.DecausGallon, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Volume.Parse("1 dl", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.Deciliters, DecilitersTolerance); + Assert.Equal(VolumeUnit.Deciliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Volume.Parse("1 dL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.Deciliters, DecilitersTolerance); + Assert.Equal(VolumeUnit.Deciliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Volume.Parse("1 dl", CultureInfo.GetCultureInfo("en-US")); @@ -1005,6 +1047,20 @@ public void Parse() Assert.Equal(VolumeUnit.HectocubicMeter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Volume.Parse("1 hl", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.Hectoliters, HectolitersTolerance); + Assert.Equal(VolumeUnit.Hectoliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Volume.Parse("1 hL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.Hectoliters, HectolitersTolerance); + Assert.Equal(VolumeUnit.Hectoliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Volume.Parse("1 hl", CultureInfo.GetCultureInfo("en-US")); @@ -1138,6 +1194,20 @@ public void Parse() Assert.Equal(VolumeUnit.KiloimperialGallon, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Volume.Parse("1 kl", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.Kiloliters, KilolitersTolerance); + Assert.Equal(VolumeUnit.Kiloliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Volume.Parse("1 kL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.Kiloliters, KilolitersTolerance); + Assert.Equal(VolumeUnit.Kiloliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Volume.Parse("1 kl", CultureInfo.GetCultureInfo("en-US")); @@ -1166,6 +1236,20 @@ public void Parse() Assert.Equal(VolumeUnit.KilousGallon, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Volume.Parse("1 l", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.Liters, LitersTolerance); + Assert.Equal(VolumeUnit.Liter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Volume.Parse("1 L", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.Liters, LitersTolerance); + Assert.Equal(VolumeUnit.Liter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Volume.Parse("1 l", CultureInfo.GetCultureInfo("en-US")); @@ -1208,6 +1292,20 @@ public void Parse() Assert.Equal(VolumeUnit.MegaimperialGallon, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Volume.Parse("1 Ml", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.Megaliters, MegalitersTolerance); + Assert.Equal(VolumeUnit.Megaliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Volume.Parse("1 ML", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.Megaliters, MegalitersTolerance); + Assert.Equal(VolumeUnit.Megaliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Volume.Parse("1 Ml", CultureInfo.GetCultureInfo("en-US")); @@ -1299,6 +1397,20 @@ public void Parse() Assert.Equal(VolumeUnit.MetricTeaspoon, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Volume.Parse("1 µl", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.Microliters, MicrolitersTolerance); + Assert.Equal(VolumeUnit.Microliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Volume.Parse("1 µL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.Microliters, MicrolitersTolerance); + Assert.Equal(VolumeUnit.Microliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Volume.Parse("1 µl", CultureInfo.GetCultureInfo("en-US")); @@ -1313,6 +1425,20 @@ public void Parse() Assert.Equal(VolumeUnit.Microliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Volume.Parse("1 ml", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.Milliliters, MillilitersTolerance); + Assert.Equal(VolumeUnit.Milliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Volume.Parse("1 mL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.Milliliters, MillilitersTolerance); + Assert.Equal(VolumeUnit.Milliliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Volume.Parse("1 ml", CultureInfo.GetCultureInfo("en-US")); @@ -1327,6 +1453,20 @@ public void Parse() Assert.Equal(VolumeUnit.Milliliter, parsed.Unit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsed = Volume.Parse("1 nl", CultureInfo.GetCultureInfo("en")); + AssertEx.EqualTolerance(1, parsed.Nanoliters, NanolitersTolerance); + Assert.Equal(VolumeUnit.Nanoliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsed = Volume.Parse("1 nL", CultureInfo.GetCultureInfo("en-US")); + AssertEx.EqualTolerance(1, parsed.Nanoliters, NanolitersTolerance); + Assert.Equal(VolumeUnit.Nanoliter, parsed.Unit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsed = Volume.Parse("1 nl", CultureInfo.GetCultureInfo("en-US")); @@ -1456,6 +1596,18 @@ public void TryParse() Assert.Equal(VolumeUnit.BoardFoot, parsed.Unit); } + { + Assert.True(Volume.TryParse("1 cl", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Centiliters, CentilitersTolerance); + Assert.Equal(VolumeUnit.Centiliter, parsed.Unit); + } + + { + Assert.True(Volume.TryParse("1 cL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Centiliters, CentilitersTolerance); + Assert.Equal(VolumeUnit.Centiliter, parsed.Unit); + } + { Assert.True(Volume.TryParse("1 cl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.Centiliters, CentilitersTolerance); @@ -1576,6 +1728,18 @@ public void TryParse() Assert.Equal(VolumeUnit.CubicYard, parsed.Unit); } + { + Assert.True(Volume.TryParse("1 dal", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Decaliters, DecalitersTolerance); + Assert.Equal(VolumeUnit.Decaliter, parsed.Unit); + } + + { + Assert.True(Volume.TryParse("1 daL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Decaliters, DecalitersTolerance); + Assert.Equal(VolumeUnit.Decaliter, parsed.Unit); + } + { Assert.True(Volume.TryParse("1 dal", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.Decaliters, DecalitersTolerance); @@ -1600,6 +1764,18 @@ public void TryParse() Assert.Equal(VolumeUnit.DecausGallon, parsed.Unit); } + { + Assert.True(Volume.TryParse("1 dl", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Deciliters, DecilitersTolerance); + Assert.Equal(VolumeUnit.Deciliter, parsed.Unit); + } + + { + Assert.True(Volume.TryParse("1 dL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Deciliters, DecilitersTolerance); + Assert.Equal(VolumeUnit.Deciliter, parsed.Unit); + } + { Assert.True(Volume.TryParse("1 dl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.Deciliters, DecilitersTolerance); @@ -1636,6 +1812,18 @@ public void TryParse() Assert.Equal(VolumeUnit.HectocubicFoot, parsed.Unit); } + { + Assert.True(Volume.TryParse("1 hl", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Hectoliters, HectolitersTolerance); + Assert.Equal(VolumeUnit.Hectoliter, parsed.Unit); + } + + { + Assert.True(Volume.TryParse("1 hL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Hectoliters, HectolitersTolerance); + Assert.Equal(VolumeUnit.Hectoliter, parsed.Unit); + } + { Assert.True(Volume.TryParse("1 hl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.Hectoliters, HectolitersTolerance); @@ -1738,6 +1926,18 @@ public void TryParse() Assert.Equal(VolumeUnit.KiloimperialGallon, parsed.Unit); } + { + Assert.True(Volume.TryParse("1 kl", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Kiloliters, KilolitersTolerance); + Assert.Equal(VolumeUnit.Kiloliter, parsed.Unit); + } + + { + Assert.True(Volume.TryParse("1 kL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Kiloliters, KilolitersTolerance); + Assert.Equal(VolumeUnit.Kiloliter, parsed.Unit); + } + { Assert.True(Volume.TryParse("1 kl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.Kiloliters, KilolitersTolerance); @@ -1762,6 +1962,18 @@ public void TryParse() Assert.Equal(VolumeUnit.KilousGallon, parsed.Unit); } + { + Assert.True(Volume.TryParse("1 l", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Liters, LitersTolerance); + Assert.Equal(VolumeUnit.Liter, parsed.Unit); + } + + { + Assert.True(Volume.TryParse("1 L", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Liters, LitersTolerance); + Assert.Equal(VolumeUnit.Liter, parsed.Unit); + } + { Assert.True(Volume.TryParse("1 l", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.Liters, LitersTolerance); @@ -1864,6 +2076,18 @@ public void TryParse() Assert.Equal(VolumeUnit.MetricTeaspoon, parsed.Unit); } + { + Assert.True(Volume.TryParse("1 µl", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Microliters, MicrolitersTolerance); + Assert.Equal(VolumeUnit.Microliter, parsed.Unit); + } + + { + Assert.True(Volume.TryParse("1 µL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Microliters, MicrolitersTolerance); + Assert.Equal(VolumeUnit.Microliter, parsed.Unit); + } + { Assert.True(Volume.TryParse("1 µl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.Microliters, MicrolitersTolerance); @@ -1876,6 +2100,18 @@ public void TryParse() Assert.Equal(VolumeUnit.Microliter, parsed.Unit); } + { + Assert.True(Volume.TryParse("1 nl", CultureInfo.GetCultureInfo("en"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Nanoliters, NanolitersTolerance); + Assert.Equal(VolumeUnit.Nanoliter, parsed.Unit); + } + + { + Assert.True(Volume.TryParse("1 nL", CultureInfo.GetCultureInfo("en-US"), out var parsed)); + AssertEx.EqualTolerance(1, parsed.Nanoliters, NanolitersTolerance); + Assert.Equal(VolumeUnit.Nanoliter, parsed.Unit); + } + { Assert.True(Volume.TryParse("1 nl", CultureInfo.GetCultureInfo("en-US"), out var parsed)); AssertEx.EqualTolerance(1, parsed.Nanoliters, NanolitersTolerance); @@ -1995,6 +2231,18 @@ public void ParseUnit() Assert.Equal(VolumeUnit.BoardFoot, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Volume.ParseUnit("cl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(VolumeUnit.Centiliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Volume.ParseUnit("cL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(VolumeUnit.Centiliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Volume.ParseUnit("cl", CultureInfo.GetCultureInfo("en-US")); @@ -2139,6 +2387,18 @@ public void ParseUnit() Assert.Equal(VolumeUnit.CubicYard, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Volume.ParseUnit("dal", CultureInfo.GetCultureInfo("en")); + Assert.Equal(VolumeUnit.Decaliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Volume.ParseUnit("daL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(VolumeUnit.Decaliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Volume.ParseUnit("dal", CultureInfo.GetCultureInfo("en-US")); @@ -2163,6 +2423,18 @@ public void ParseUnit() Assert.Equal(VolumeUnit.DecausGallon, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Volume.ParseUnit("dl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(VolumeUnit.Deciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Volume.ParseUnit("dL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(VolumeUnit.Deciliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Volume.ParseUnit("dl", CultureInfo.GetCultureInfo("en-US")); @@ -2211,6 +2483,18 @@ public void ParseUnit() Assert.Equal(VolumeUnit.HectocubicMeter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Volume.ParseUnit("hl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(VolumeUnit.Hectoliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Volume.ParseUnit("hL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(VolumeUnit.Hectoliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Volume.ParseUnit("hl", CultureInfo.GetCultureInfo("en-US")); @@ -2325,6 +2609,18 @@ public void ParseUnit() Assert.Equal(VolumeUnit.KiloimperialGallon, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Volume.ParseUnit("kl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(VolumeUnit.Kiloliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Volume.ParseUnit("kL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(VolumeUnit.Kiloliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Volume.ParseUnit("kl", CultureInfo.GetCultureInfo("en-US")); @@ -2349,6 +2645,18 @@ public void ParseUnit() Assert.Equal(VolumeUnit.KilousGallon, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Volume.ParseUnit("l", CultureInfo.GetCultureInfo("en")); + Assert.Equal(VolumeUnit.Liter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Volume.ParseUnit("L", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(VolumeUnit.Liter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Volume.ParseUnit("l", CultureInfo.GetCultureInfo("en-US")); @@ -2385,6 +2693,18 @@ public void ParseUnit() Assert.Equal(VolumeUnit.MegaimperialGallon, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Volume.ParseUnit("Ml", CultureInfo.GetCultureInfo("en")); + Assert.Equal(VolumeUnit.Megaliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Volume.ParseUnit("ML", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(VolumeUnit.Megaliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Volume.ParseUnit("Ml", CultureInfo.GetCultureInfo("en-US")); @@ -2463,6 +2783,18 @@ public void ParseUnit() Assert.Equal(VolumeUnit.MetricTeaspoon, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Volume.ParseUnit("µl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(VolumeUnit.Microliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Volume.ParseUnit("µL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(VolumeUnit.Microliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Volume.ParseUnit("µl", CultureInfo.GetCultureInfo("en-US")); @@ -2475,6 +2807,18 @@ public void ParseUnit() Assert.Equal(VolumeUnit.Microliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Volume.ParseUnit("ml", CultureInfo.GetCultureInfo("en")); + Assert.Equal(VolumeUnit.Milliliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Volume.ParseUnit("mL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(VolumeUnit.Milliliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Volume.ParseUnit("ml", CultureInfo.GetCultureInfo("en-US")); @@ -2487,6 +2831,18 @@ public void ParseUnit() Assert.Equal(VolumeUnit.Milliliter, parsedUnit); } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try + { + var parsedUnit = Volume.ParseUnit("nl", CultureInfo.GetCultureInfo("en")); + Assert.Equal(VolumeUnit.Nanoliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + + try + { + var parsedUnit = Volume.ParseUnit("nL", CultureInfo.GetCultureInfo("en-US")); + Assert.Equal(VolumeUnit.Nanoliter, parsedUnit); + } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ } + try { var parsedUnit = Volume.ParseUnit("nl", CultureInfo.GetCultureInfo("en-US")); @@ -2597,6 +2953,16 @@ public void TryParseUnit() Assert.Equal(VolumeUnit.BoardFoot, parsedUnit); } + { + Assert.True(Volume.TryParseUnit("cl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Centiliter, parsedUnit); + } + + { + Assert.True(Volume.TryParseUnit("cL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Centiliter, parsedUnit); + } + { Assert.True(Volume.TryParseUnit("cl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(VolumeUnit.Centiliter, parsedUnit); @@ -2697,6 +3063,16 @@ public void TryParseUnit() Assert.Equal(VolumeUnit.CubicYard, parsedUnit); } + { + Assert.True(Volume.TryParseUnit("dal", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Decaliter, parsedUnit); + } + + { + Assert.True(Volume.TryParseUnit("daL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Decaliter, parsedUnit); + } + { Assert.True(Volume.TryParseUnit("dal", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(VolumeUnit.Decaliter, parsedUnit); @@ -2717,6 +3093,16 @@ public void TryParseUnit() Assert.Equal(VolumeUnit.DecausGallon, parsedUnit); } + { + Assert.True(Volume.TryParseUnit("dl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Deciliter, parsedUnit); + } + + { + Assert.True(Volume.TryParseUnit("dL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Deciliter, parsedUnit); + } + { Assert.True(Volume.TryParseUnit("dl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(VolumeUnit.Deciliter, parsedUnit); @@ -2747,6 +3133,16 @@ public void TryParseUnit() Assert.Equal(VolumeUnit.HectocubicFoot, parsedUnit); } + { + Assert.True(Volume.TryParseUnit("hl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Hectoliter, parsedUnit); + } + + { + Assert.True(Volume.TryParseUnit("hL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Hectoliter, parsedUnit); + } + { Assert.True(Volume.TryParseUnit("hl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(VolumeUnit.Hectoliter, parsedUnit); @@ -2832,6 +3228,16 @@ public void TryParseUnit() Assert.Equal(VolumeUnit.KiloimperialGallon, parsedUnit); } + { + Assert.True(Volume.TryParseUnit("kl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Kiloliter, parsedUnit); + } + + { + Assert.True(Volume.TryParseUnit("kL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Kiloliter, parsedUnit); + } + { Assert.True(Volume.TryParseUnit("kl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(VolumeUnit.Kiloliter, parsedUnit); @@ -2852,6 +3258,16 @@ public void TryParseUnit() Assert.Equal(VolumeUnit.KilousGallon, parsedUnit); } + { + Assert.True(Volume.TryParseUnit("l", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Liter, parsedUnit); + } + + { + Assert.True(Volume.TryParseUnit("L", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Liter, parsedUnit); + } + { Assert.True(Volume.TryParseUnit("l", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(VolumeUnit.Liter, parsedUnit); @@ -2937,6 +3353,16 @@ public void TryParseUnit() Assert.Equal(VolumeUnit.MetricTeaspoon, parsedUnit); } + { + Assert.True(Volume.TryParseUnit("µl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Microliter, parsedUnit); + } + + { + Assert.True(Volume.TryParseUnit("µL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Microliter, parsedUnit); + } + { Assert.True(Volume.TryParseUnit("µl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(VolumeUnit.Microliter, parsedUnit); @@ -2947,6 +3373,16 @@ public void TryParseUnit() Assert.Equal(VolumeUnit.Microliter, parsedUnit); } + { + Assert.True(Volume.TryParseUnit("nl", CultureInfo.GetCultureInfo("en"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Nanoliter, parsedUnit); + } + + { + Assert.True(Volume.TryParseUnit("nL", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); + Assert.Equal(VolumeUnit.Nanoliter, parsedUnit); + } + { Assert.True(Volume.TryParseUnit("nl", CultureInfo.GetCultureInfo("en-US"), out var parsedUnit)); Assert.Equal(VolumeUnit.Nanoliter, parsedUnit); @@ -3248,7 +3684,7 @@ public void ToString_ReturnsValueAndUnitAbbreviationInCurrentCulture() Assert.Equal("1 ac-ft", new Volume(1, VolumeUnit.AcreFoot).ToString()); Assert.Equal("1", new Volume(1, VolumeUnit.AuTablespoon).ToString()); Assert.Equal("1 bf", new Volume(1, VolumeUnit.BoardFoot).ToString()); - Assert.Equal("1 cl", new Volume(1, VolumeUnit.Centiliter).ToString()); + Assert.Equal("1 cL", new Volume(1, VolumeUnit.Centiliter).ToString()); Assert.Equal("1 cm³", new Volume(1, VolumeUnit.CubicCentimeter).ToString()); Assert.Equal("1 dm³", new Volume(1, VolumeUnit.CubicDecimeter).ToString()); Assert.Equal("1 ft³", new Volume(1, VolumeUnit.CubicFoot).ToString()); @@ -3260,13 +3696,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 dal", new Volume(1, VolumeUnit.Decaliter).ToString()); + Assert.Equal("1 daL", new Volume(1, VolumeUnit.Decaliter).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 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 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()); @@ -3275,18 +3711,18 @@ public void ToString_ReturnsValueAndUnitAbbreviationInCurrentCulture() Assert.Equal("1 kft³", new Volume(1, VolumeUnit.KilocubicFoot).ToString()); Assert.Equal("1 km³", new Volume(1, VolumeUnit.KilocubicMeter).ToString()); Assert.Equal("1 kgal (imp.)", new Volume(1, VolumeUnit.KiloimperialGallon).ToString()); - Assert.Equal("1 kl", new Volume(1, VolumeUnit.Kiloliter).ToString()); + Assert.Equal("1 kL", new Volume(1, VolumeUnit.Kiloliter).ToString()); Assert.Equal("1 kgal (U.S.)", new Volume(1, VolumeUnit.KilousGallon).ToString()); - Assert.Equal("1 l", new Volume(1, VolumeUnit.Liter).ToString()); + Assert.Equal("1 L", new Volume(1, VolumeUnit.Liter).ToString()); Assert.Equal("1 Mft³", new Volume(1, VolumeUnit.MegacubicFoot).ToString()); Assert.Equal("1 Mgal (imp.)", new Volume(1, VolumeUnit.MegaimperialGallon).ToString()); - Assert.Equal("1 Ml", new Volume(1, VolumeUnit.Megaliter).ToString()); + Assert.Equal("1 ML", new Volume(1, VolumeUnit.Megaliter).ToString()); Assert.Equal("1 Mgal (U.S.)", new Volume(1, VolumeUnit.MegausGallon).ToString()); Assert.Equal("1", new Volume(1, VolumeUnit.MetricCup).ToString()); Assert.Equal("1 tsp", new Volume(1, VolumeUnit.MetricTeaspoon).ToString()); - Assert.Equal("1 µl", new Volume(1, VolumeUnit.Microliter).ToString()); - Assert.Equal("1 ml", new Volume(1, VolumeUnit.Milliliter).ToString()); - Assert.Equal("1 nl", new Volume(1, VolumeUnit.Nanoliter).ToString()); + Assert.Equal("1 µL", new Volume(1, VolumeUnit.Microliter).ToString()); + Assert.Equal("1 mL", new Volume(1, VolumeUnit.Milliliter).ToString()); + Assert.Equal("1 nL", new Volume(1, VolumeUnit.Nanoliter).ToString()); Assert.Equal("1 bbl", new Volume(1, VolumeUnit.OilBarrel).ToString()); Assert.Equal("1", new Volume(1, VolumeUnit.UkTablespoon).ToString()); Assert.Equal("1 bl (U.S.)", new Volume(1, VolumeUnit.UsBeerBarrel).ToString()); @@ -3314,7 +3750,7 @@ public void ToString_WithSwedishCulture_ReturnsUnitAbbreviationForEnglishCulture Assert.Equal("1 ac-ft", new Volume(1, VolumeUnit.AcreFoot).ToString(swedishCulture)); Assert.Equal("1", new Volume(1, VolumeUnit.AuTablespoon).ToString(swedishCulture)); Assert.Equal("1 bf", new Volume(1, VolumeUnit.BoardFoot).ToString(swedishCulture)); - Assert.Equal("1 cl", new Volume(1, VolumeUnit.Centiliter).ToString(swedishCulture)); + Assert.Equal("1 cL", new Volume(1, VolumeUnit.Centiliter).ToString(swedishCulture)); Assert.Equal("1 cm³", new Volume(1, VolumeUnit.CubicCentimeter).ToString(swedishCulture)); Assert.Equal("1 dm³", new Volume(1, VolumeUnit.CubicDecimeter).ToString(swedishCulture)); Assert.Equal("1 ft³", new Volume(1, VolumeUnit.CubicFoot).ToString(swedishCulture)); @@ -3326,13 +3762,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 dal", new Volume(1, VolumeUnit.Decaliter).ToString(swedishCulture)); + Assert.Equal("1 daL", new Volume(1, VolumeUnit.Decaliter).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 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 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)); @@ -3341,18 +3777,18 @@ public void ToString_WithSwedishCulture_ReturnsUnitAbbreviationForEnglishCulture Assert.Equal("1 kft³", new Volume(1, VolumeUnit.KilocubicFoot).ToString(swedishCulture)); Assert.Equal("1 km³", new Volume(1, VolumeUnit.KilocubicMeter).ToString(swedishCulture)); Assert.Equal("1 kgal (imp.)", new Volume(1, VolumeUnit.KiloimperialGallon).ToString(swedishCulture)); - Assert.Equal("1 kl", new Volume(1, VolumeUnit.Kiloliter).ToString(swedishCulture)); + Assert.Equal("1 kL", new Volume(1, VolumeUnit.Kiloliter).ToString(swedishCulture)); Assert.Equal("1 kgal (U.S.)", new Volume(1, VolumeUnit.KilousGallon).ToString(swedishCulture)); - Assert.Equal("1 l", new Volume(1, VolumeUnit.Liter).ToString(swedishCulture)); + Assert.Equal("1 L", new Volume(1, VolumeUnit.Liter).ToString(swedishCulture)); Assert.Equal("1 Mft³", new Volume(1, VolumeUnit.MegacubicFoot).ToString(swedishCulture)); Assert.Equal("1 Mgal (imp.)", new Volume(1, VolumeUnit.MegaimperialGallon).ToString(swedishCulture)); - Assert.Equal("1 Ml", new Volume(1, VolumeUnit.Megaliter).ToString(swedishCulture)); + Assert.Equal("1 ML", new Volume(1, VolumeUnit.Megaliter).ToString(swedishCulture)); Assert.Equal("1 Mgal (U.S.)", new Volume(1, VolumeUnit.MegausGallon).ToString(swedishCulture)); Assert.Equal("1", new Volume(1, VolumeUnit.MetricCup).ToString(swedishCulture)); Assert.Equal("1 tsp", new Volume(1, VolumeUnit.MetricTeaspoon).ToString(swedishCulture)); - Assert.Equal("1 µl", new Volume(1, VolumeUnit.Microliter).ToString(swedishCulture)); - Assert.Equal("1 ml", new Volume(1, VolumeUnit.Milliliter).ToString(swedishCulture)); - Assert.Equal("1 nl", new Volume(1, VolumeUnit.Nanoliter).ToString(swedishCulture)); + Assert.Equal("1 µL", new Volume(1, VolumeUnit.Microliter).ToString(swedishCulture)); + Assert.Equal("1 mL", new Volume(1, VolumeUnit.Milliliter).ToString(swedishCulture)); + Assert.Equal("1 nL", new Volume(1, VolumeUnit.Nanoliter).ToString(swedishCulture)); Assert.Equal("1 bbl", new Volume(1, VolumeUnit.OilBarrel).ToString(swedishCulture)); Assert.Equal("1", new Volume(1, VolumeUnit.UkTablespoon).ToString(swedishCulture)); Assert.Equal("1 bl (U.S.)", new Volume(1, VolumeUnit.UsBeerBarrel).ToString(swedishCulture)); diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index 2490c40964..1e6a0baae7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -591,44 +591,66 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbreviationsCache) { - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.CentigramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"cg/dl"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.CentigramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"cg/L"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.CentigramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"cg/ml"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.DecigramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"dg/dl"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.DecigramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"dg/L"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.DecigramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"dg/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.CentigramPerDeciliter, new CultureInfo("en"), false, true, new string[]{"cg/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.CentigramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"cg/dL", "cg/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.CentigramPerLiter, new CultureInfo("en"), false, true, new string[]{"cg/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.CentigramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"cg/L", "cg/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.CentigramPerMilliliter, new CultureInfo("en"), false, true, new string[]{"cg/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.CentigramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"cg/mL", "cg/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.DecigramPerDeciliter, new CultureInfo("en"), false, true, new string[]{"dg/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.DecigramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"dg/dL", "dg/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.DecigramPerLiter, new CultureInfo("en"), false, true, new string[]{"dg/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.DecigramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"dg/L", "dg/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.DecigramPerMilliliter, new CultureInfo("en"), false, true, new string[]{"dg/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.DecigramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"dg/mL", "dg/ml"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerCubicCentimeter, new CultureInfo("en-US"), false, true, new string[]{"g/cm³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerCubicFoot, new CultureInfo("en-US"), false, true, new string[]{"g/ft³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerCubicInch, new CultureInfo("en-US"), false, true, new string[]{"g/in³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerCubicMeter, new CultureInfo("en-US"), false, true, new string[]{"g/m³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerCubicMeter, new CultureInfo("ru-RU"), false, true, new string[]{"г/м³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerCubicMillimeter, new CultureInfo("en-US"), false, true, new string[]{"g/mm³"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"g/dl"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"g/L"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"g/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerDeciliter, new CultureInfo("en"), false, true, new string[]{"g/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"g/dL", "g/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerLiter, new CultureInfo("en"), false, true, new string[]{"g/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"g/L", "g/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerMilliliter, new CultureInfo("en"), false, true, new string[]{"g/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.GramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"g/mL", "g/ml"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.KilogramPerCubicCentimeter, new CultureInfo("en-US"), false, true, new string[]{"kg/cm³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.KilogramPerCubicMeter, new CultureInfo("en-US"), false, true, new string[]{"kg/m³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.KilogramPerCubicMeter, new CultureInfo("ru-RU"), false, true, new string[]{"кг/м³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.KilogramPerCubicMillimeter, new CultureInfo("en-US"), false, true, new string[]{"kg/mm³"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.KilogramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"kg/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.KilogramPerLiter, new CultureInfo("en"), false, true, new string[]{"kg/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.KilogramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"kg/L", "kg/l"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.KilopoundPerCubicFoot, new CultureInfo("en-US"), false, true, new string[]{"kip/ft³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.KilopoundPerCubicInch, new CultureInfo("en-US"), false, true, new string[]{"kip/in³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MicrogramPerCubicMeter, new CultureInfo("en-US"), false, true, new string[]{"µg/m³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MicrogramPerCubicMeter, new CultureInfo("ru-RU"), false, true, new string[]{"мкг/м³"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MicrogramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"µg/dl"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MicrogramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"µg/L"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MicrogramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"µg/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MicrogramPerDeciliter, new CultureInfo("en"), false, true, new string[]{"µg/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MicrogramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"µg/dL", "µg/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MicrogramPerLiter, new CultureInfo("en"), false, true, new string[]{"µg/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MicrogramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"µg/L", "µg/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MicrogramPerMilliliter, new CultureInfo("en"), false, true, new string[]{"µg/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MicrogramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"µg/mL", "µg/ml"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MilligramPerCubicMeter, new CultureInfo("en-US"), false, true, new string[]{"mg/m³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MilligramPerCubicMeter, new CultureInfo("ru-RU"), false, true, new string[]{"мг/м³"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MilligramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"mg/dl"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MilligramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"mg/L"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MilligramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"mg/ml"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.NanogramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"ng/dl"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.NanogramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"ng/L"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.NanogramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"ng/ml"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.PicogramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"pg/dl"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.PicogramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"pg/L"}); - unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.PicogramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"pg/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MilligramPerDeciliter, new CultureInfo("en"), false, true, new string[]{"mg/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MilligramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"mg/dL", "mg/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MilligramPerLiter, new CultureInfo("en"), false, true, new string[]{"mg/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MilligramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"mg/L", "mg/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MilligramPerMilliliter, new CultureInfo("en"), false, true, new string[]{"mg/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.MilligramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"mg/mL", "mg/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.NanogramPerDeciliter, new CultureInfo("en"), false, true, new string[]{"ng/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.NanogramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"ng/dL", "ng/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.NanogramPerLiter, new CultureInfo("en"), false, true, new string[]{"ng/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.NanogramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"ng/L", "ng/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.NanogramPerMilliliter, new CultureInfo("en"), false, true, new string[]{"ng/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.NanogramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"ng/mL", "ng/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.PicogramPerDeciliter, new CultureInfo("en"), false, true, new string[]{"pg/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.PicogramPerDeciliter, new CultureInfo("en-US"), false, true, new string[]{"pg/dL", "pg/dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.PicogramPerLiter, new CultureInfo("en"), false, true, new string[]{"pg/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.PicogramPerLiter, new CultureInfo("en-US"), false, true, new string[]{"pg/L", "pg/l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.PicogramPerMilliliter, new CultureInfo("en"), false, true, new string[]{"pg/ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.PicogramPerMilliliter, new CultureInfo("en-US"), false, true, new string[]{"pg/mL", "pg/ml"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.PoundPerCubicCentimeter, new CultureInfo("en-US"), false, true, new string[]{"lb/cm³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.PoundPerCubicFoot, new CultureInfo("en-US"), false, true, new string[]{"lb/ft³"}); unitAbbreviationsCache.PerformAbbreviationMapping(DensityUnit.PoundPerCubicInch, new CultureInfo("en-US"), false, true, new string[]{"lb/in³"}); diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index cd6c51293b..c923de4b39 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -610,7 +610,8 @@ internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbrev unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.AuTablespoon, new CultureInfo("nb-NO"), false, true, new string[]{""}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.BoardFoot, new CultureInfo("en-US"), false, true, new string[]{"bf", "board foot", "board feet"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.BoardFoot, new CultureInfo("fr-CA"), false, true, new string[]{"pmp", "pied-planche", "pied de planche"}); - unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Centiliter, new CultureInfo("en-US"), false, true, new string[]{"cl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Centiliter, new CultureInfo("en"), false, true, new string[]{"cl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Centiliter, new CultureInfo("en-US"), false, true, new string[]{"cL", "cl"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Centiliter, new CultureInfo("ru-RU"), false, true, new string[]{"сл"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.CubicCentimeter, new CultureInfo("en-US"), false, true, new string[]{"cm³"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.CubicCentimeter, new CultureInfo("ru-RU"), false, true, new string[]{"см³"}); @@ -634,11 +635,13 @@ internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbrev unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.CubicMillimeter, new CultureInfo("ru-RU"), false, true, new string[]{"мм³"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.CubicYard, new CultureInfo("en-US"), false, true, new string[]{"yd³"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.CubicYard, new CultureInfo("ru-RU"), false, true, new string[]{"ярд³"}); - unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Decaliter, new CultureInfo("en-US"), false, true, new string[]{"dal"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Decaliter, new CultureInfo("en"), false, true, new string[]{"dal"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Decaliter, new CultureInfo("en-US"), false, true, new string[]{"daL", "dal"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Decaliter, new CultureInfo("ru-RU"), false, true, new string[]{"дал"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.DecausGallon, new CultureInfo("en-US"), false, true, new string[]{"dagal (U.S.)"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.DecausGallon, new CultureInfo("ru-RU"), false, true, new string[]{"даАмериканский галлон"}); - unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Deciliter, new CultureInfo("en-US"), false, true, new string[]{"dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Deciliter, new CultureInfo("en"), false, true, new string[]{"dl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Deciliter, new CultureInfo("en-US"), false, true, new string[]{"dL", "dl"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Deciliter, new CultureInfo("ru-RU"), false, true, new string[]{"дл"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.DeciusGallon, new CultureInfo("en-US"), false, true, new string[]{"dgal (U.S.)"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.DeciusGallon, new CultureInfo("ru-RU"), false, true, new string[]{"дАмериканский галлон"}); @@ -646,7 +649,8 @@ internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbrev unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.HectocubicFoot, new CultureInfo("ru-RU"), false, true, new string[]{"гфут³"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.HectocubicMeter, new CultureInfo("en-US"), false, true, new string[]{"hm³"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.HectocubicMeter, new CultureInfo("ru-RU"), false, true, new string[]{"гм³"}); - unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Hectoliter, new CultureInfo("en-US"), false, true, new string[]{"hl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Hectoliter, new CultureInfo("en"), false, true, new string[]{"hl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Hectoliter, new CultureInfo("en-US"), false, true, new string[]{"hL", "hl"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Hectoliter, new CultureInfo("ru-RU"), false, true, new string[]{"гл"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.HectousGallon, new CultureInfo("en-US"), false, true, new string[]{"hgal (U.S.)"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.HectousGallon, new CultureInfo("ru-RU"), false, true, new string[]{"гАмериканский галлон"}); @@ -662,17 +666,20 @@ internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbrev unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.KilocubicMeter, new CultureInfo("ru-RU"), false, true, new string[]{"км³"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.KiloimperialGallon, new CultureInfo("en-US"), false, true, new string[]{"kgal (imp.)"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.KiloimperialGallon, new CultureInfo("ru-RU"), false, true, new string[]{"кАнглийский галлон"}); - unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Kiloliter, new CultureInfo("en-US"), false, true, new string[]{"kl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Kiloliter, new CultureInfo("en"), false, true, new string[]{"kl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Kiloliter, new CultureInfo("en-US"), false, true, new string[]{"kL", "kl"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Kiloliter, new CultureInfo("ru-RU"), false, true, new string[]{"кл"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.KilousGallon, new CultureInfo("en-US"), false, true, new string[]{"kgal (U.S.)"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.KilousGallon, new CultureInfo("ru-RU"), false, true, new string[]{"кАмериканский галлон"}); - unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Liter, new CultureInfo("en-US"), false, true, new string[]{"l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Liter, new CultureInfo("en"), false, true, new string[]{"l"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Liter, new CultureInfo("en-US"), false, true, new string[]{"L", "l"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Liter, new CultureInfo("ru-RU"), false, true, new string[]{"л"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.MegacubicFoot, new CultureInfo("en-US"), false, true, new string[]{"Mft³"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.MegacubicFoot, new CultureInfo("ru-RU"), false, true, new string[]{"Мфут³"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.MegaimperialGallon, new CultureInfo("en-US"), false, true, new string[]{"Mgal (imp.)"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.MegaimperialGallon, new CultureInfo("ru-RU"), false, true, new string[]{"МАнглийский галлон"}); - unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Megaliter, new CultureInfo("en-US"), false, true, new string[]{"Ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Megaliter, new CultureInfo("en"), false, true, new string[]{"Ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Megaliter, new CultureInfo("en-US"), false, true, new string[]{"ML", "Ml"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Megaliter, new CultureInfo("ru-RU"), false, true, new string[]{"Мл"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.MegausGallon, new CultureInfo("en-US"), false, true, new string[]{"Mgal (U.S.)"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.MegausGallon, new CultureInfo("ru-RU"), false, true, new string[]{"МАмериканский галлон"}); @@ -680,11 +687,14 @@ internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbrev unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.MetricTeaspoon, new CultureInfo("en-US"), false, true, new string[]{"tsp", "t", "ts", "tspn", "t.", "ts.", "tsp.", "tspn.", "teaspoon"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.MetricTeaspoon, new CultureInfo("ru-RU"), false, true, new string[]{""}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.MetricTeaspoon, new CultureInfo("nb-NO"), false, true, new string[]{""}); - unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Microliter, new CultureInfo("en-US"), false, true, new string[]{"µl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Microliter, new CultureInfo("en"), false, true, new string[]{"µl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Microliter, new CultureInfo("en-US"), false, true, new string[]{"µL", "µl"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Microliter, new CultureInfo("ru-RU"), false, true, new string[]{"мкл"}); - unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Milliliter, new CultureInfo("en-US"), false, true, new string[]{"ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Milliliter, new CultureInfo("en"), false, true, new string[]{"ml"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Milliliter, new CultureInfo("en-US"), false, true, new string[]{"mL", "ml"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Milliliter, new CultureInfo("ru-RU"), false, true, new string[]{"мл"}); - unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Nanoliter, new CultureInfo("en-US"), false, true, new string[]{"nl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Nanoliter, new CultureInfo("en"), false, true, new string[]{"nl"}); + unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Nanoliter, new CultureInfo("en-US"), false, true, new string[]{"nL", "nl"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.Nanoliter, new CultureInfo("ru-RU"), false, true, new string[]{"нл"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.OilBarrel, new CultureInfo("en-US"), false, true, new string[]{"bbl"}); unitAbbreviationsCache.PerformAbbreviationMapping(VolumeUnit.UkTablespoon, new CultureInfo("en-US"), false, true, new string[]{""});