From 8b7009e57e46e30acde83605cddaf746bc3532ba Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Mon, 29 Oct 2018 11:44:25 -0400 Subject: [PATCH 1/2] Adding support for micro/milli newtons, as well as ounce force --- .../Quantities/Force.Common.g.cs | 63 +++++++++++++++++++ Common/UnitDefinitions/Force.json | 14 ++++- UnitsNet.Tests/CustomCode/ForceTests.cs | 6 ++ .../GeneratedCode/ForceTestsBase.g.cs | 30 +++++++++ .../Number/NumberToForceExtensions.g.cs | 33 ++++++++++ .../Quantities/Force.NetFramework.g.cs | 27 ++++++++ .../GeneratedCode/UnitSystem.Default.g.cs | 21 ++++++- UnitsNet/GeneratedCode/Units/ForceUnit.g.cs | 3 + 8 files changed, 194 insertions(+), 3 deletions(-) diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 0f3f1abca3..b606c2a5ba 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -191,11 +191,26 @@ public static BaseDimensions BaseDimensions /// public double Meganewtons => As(ForceUnit.Meganewton); + /// + /// Get Force in Micronewtons. + /// + public double Micronewtons => As(ForceUnit.Micronewton); + + /// + /// Get Force in Millinewtons. + /// + public double Millinewtons => As(ForceUnit.Millinewton); + /// /// Get Force in Newtons. /// public double Newtons => As(ForceUnit.Newton); + /// + /// Get Force in OuncesForce. + /// + public double OuncesForce => As(ForceUnit.OunceForce); + /// /// Get Force in Poundals. /// @@ -304,6 +319,34 @@ public static Force FromMeganewtons(QuantityValue meganewtons) return new Force(value, ForceUnit.Meganewton); } + /// + /// Get Force from Micronewtons. + /// +#if WINDOWS_UWP + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromMicronewtons(double micronewtons) +#else + public static Force FromMicronewtons(QuantityValue micronewtons) +#endif + { + double value = (double) micronewtons; + return new Force(value, ForceUnit.Micronewton); + } + + /// + /// Get Force from Millinewtons. + /// +#if WINDOWS_UWP + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromMillinewtons(double millinewtons) +#else + public static Force FromMillinewtons(QuantityValue millinewtons) +#endif + { + double value = (double) millinewtons; + return new Force(value, ForceUnit.Millinewton); + } + /// /// Get Force from Newtons. /// @@ -318,6 +361,20 @@ public static Force FromNewtons(QuantityValue newtons) return new Force(value, ForceUnit.Newton); } + /// + /// Get Force from OuncesForce. + /// +#if WINDOWS_UWP + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromOuncesForce(double ouncesforce) +#else + public static Force FromOuncesForce(QuantityValue ouncesforce) +#endif + { + double value = (double) ouncesforce; + return new Force(value, ForceUnit.OunceForce); + } + /// /// Get Force from Poundals. /// @@ -538,7 +595,10 @@ private double AsBaseUnit() case ForceUnit.Kilonewton: return (_value) * 1e3d; case ForceUnit.KiloPond: return _value*9.80665002864; case ForceUnit.Meganewton: return (_value) * 1e6d; + case ForceUnit.Micronewton: return (_value) * 1e-6d; + case ForceUnit.Millinewton: return (_value) * 1e-3d; case ForceUnit.Newton: return _value; + case ForceUnit.OunceForce: return _value*2.780138509537812e-1; case ForceUnit.Poundal: return _value*0.13825502798973041652092282466083; case ForceUnit.PoundForce: return _value*4.4482216152605095551842641431421; case ForceUnit.TonneForce: return _value*9.80665002864e3; @@ -562,7 +622,10 @@ private double AsBaseNumericType(ForceUnit unit) case ForceUnit.Kilonewton: return (baseUnitValue) / 1e3d; case ForceUnit.KiloPond: return baseUnitValue/9.80665002864; case ForceUnit.Meganewton: return (baseUnitValue) / 1e6d; + case ForceUnit.Micronewton: return (baseUnitValue) / 1e-6d; + case ForceUnit.Millinewton: return (baseUnitValue) / 1e-3d; case ForceUnit.Newton: return baseUnitValue; + case ForceUnit.OunceForce: return baseUnitValue/2.780138509537812e-1; case ForceUnit.Poundal: return baseUnitValue/0.13825502798973041652092282466083; case ForceUnit.PoundForce: return baseUnitValue/4.4482216152605095551842641431421; case ForceUnit.TonneForce: return baseUnitValue/9.80665002864e3; diff --git a/Common/UnitDefinitions/Force.json b/Common/UnitDefinitions/Force.json index f0886176d1..b9a59b40e9 100644 --- a/Common/UnitDefinitions/Force.json +++ b/Common/UnitDefinitions/Force.json @@ -61,7 +61,7 @@ "PluralName": "Newtons", "FromUnitToBaseFunc": "x", "FromBaseToUnitFunc": "x", - "Prefixes": [ "Deca", "Kilo", "Mega" ], + "Prefixes": [ "Micro", "Milli", "Deca", "Kilo", "Mega" ], "Localization": [ { "Culture": "en-US", @@ -121,6 +121,18 @@ "Abbreviations": [ "фунт-сила" ] } ] + }, + { + "SingularName": "OunceForce", + "PluralName": "OuncesForce", + "FromUnitToBaseFunc": "x*2.780138509537812e-1", + "FromBaseToUnitFunc": "x/2.780138509537812e-1", + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "oz·f", "ozf" ] + } + ] } ] } \ No newline at end of file diff --git a/UnitsNet.Tests/CustomCode/ForceTests.cs b/UnitsNet.Tests/CustomCode/ForceTests.cs index fb348634a8..244d4796f0 100644 --- a/UnitsNet.Tests/CustomCode/ForceTests.cs +++ b/UnitsNet.Tests/CustomCode/ForceTests.cs @@ -43,6 +43,12 @@ public class ForceTests : ForceTestsBase protected override double TonnesForceInOneNewton => 1.019716212977928e-4; + protected override double MillinewtonsInOneNewton => 1.0e3; + + protected override double MicronewtonsInOneNewton => 1.0e6; + + protected override double OuncesForceInOneNewton => 3.596943089595368; + [Fact] public void ForceDividedByAreaEqualsPressure() { diff --git a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs index 72f36a6078..415b985417 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs @@ -59,7 +59,10 @@ public abstract partial class ForceTestsBase protected abstract double KilonewtonsInOneNewton { get; } protected abstract double KiloPondsInOneNewton { get; } protected abstract double MeganewtonsInOneNewton { get; } + protected abstract double MicronewtonsInOneNewton { get; } + protected abstract double MillinewtonsInOneNewton { get; } protected abstract double NewtonsInOneNewton { get; } + protected abstract double OuncesForceInOneNewton { get; } protected abstract double PoundalsInOneNewton { get; } protected abstract double PoundsForceInOneNewton { get; } protected abstract double TonnesForceInOneNewton { get; } @@ -71,7 +74,10 @@ public abstract partial class ForceTestsBase protected virtual double KilonewtonsTolerance { get { return 1e-5; } } protected virtual double KiloPondsTolerance { get { return 1e-5; } } protected virtual double MeganewtonsTolerance { get { return 1e-5; } } + protected virtual double MicronewtonsTolerance { get { return 1e-5; } } + protected virtual double MillinewtonsTolerance { get { return 1e-5; } } protected virtual double NewtonsTolerance { get { return 1e-5; } } + protected virtual double OuncesForceTolerance { get { return 1e-5; } } protected virtual double PoundalsTolerance { get { return 1e-5; } } protected virtual double PoundsForceTolerance { get { return 1e-5; } } protected virtual double TonnesForceTolerance { get { return 1e-5; } } @@ -87,7 +93,10 @@ public void NewtonToForceUnits() AssertEx.EqualTolerance(KilonewtonsInOneNewton, newton.Kilonewtons, KilonewtonsTolerance); AssertEx.EqualTolerance(KiloPondsInOneNewton, newton.KiloPonds, KiloPondsTolerance); AssertEx.EqualTolerance(MeganewtonsInOneNewton, newton.Meganewtons, MeganewtonsTolerance); + AssertEx.EqualTolerance(MicronewtonsInOneNewton, newton.Micronewtons, MicronewtonsTolerance); + AssertEx.EqualTolerance(MillinewtonsInOneNewton, newton.Millinewtons, MillinewtonsTolerance); AssertEx.EqualTolerance(NewtonsInOneNewton, newton.Newtons, NewtonsTolerance); + AssertEx.EqualTolerance(OuncesForceInOneNewton, newton.OuncesForce, OuncesForceTolerance); AssertEx.EqualTolerance(PoundalsInOneNewton, newton.Poundals, PoundalsTolerance); AssertEx.EqualTolerance(PoundsForceInOneNewton, newton.PoundsForce, PoundsForceTolerance); AssertEx.EqualTolerance(TonnesForceInOneNewton, newton.TonnesForce, TonnesForceTolerance); @@ -102,7 +111,10 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Kilonewton).Kilonewtons, KilonewtonsTolerance); AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.KiloPond).KiloPonds, KiloPondsTolerance); AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Meganewton).Meganewtons, MeganewtonsTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Micronewton).Micronewtons, MicronewtonsTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Millinewton).Millinewtons, MillinewtonsTolerance); AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Newton).Newtons, NewtonsTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.OunceForce).OuncesForce, OuncesForceTolerance); AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Poundal).Poundals, PoundalsTolerance); AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.PoundForce).PoundsForce, PoundsForceTolerance); AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.TonneForce).TonnesForce, TonnesForceTolerance); @@ -118,7 +130,10 @@ public void As() AssertEx.EqualTolerance(KilonewtonsInOneNewton, newton.As(ForceUnit.Kilonewton), KilonewtonsTolerance); AssertEx.EqualTolerance(KiloPondsInOneNewton, newton.As(ForceUnit.KiloPond), KiloPondsTolerance); AssertEx.EqualTolerance(MeganewtonsInOneNewton, newton.As(ForceUnit.Meganewton), MeganewtonsTolerance); + AssertEx.EqualTolerance(MicronewtonsInOneNewton, newton.As(ForceUnit.Micronewton), MicronewtonsTolerance); + AssertEx.EqualTolerance(MillinewtonsInOneNewton, newton.As(ForceUnit.Millinewton), MillinewtonsTolerance); AssertEx.EqualTolerance(NewtonsInOneNewton, newton.As(ForceUnit.Newton), NewtonsTolerance); + AssertEx.EqualTolerance(OuncesForceInOneNewton, newton.As(ForceUnit.OunceForce), OuncesForceTolerance); AssertEx.EqualTolerance(PoundalsInOneNewton, newton.As(ForceUnit.Poundal), PoundalsTolerance); AssertEx.EqualTolerance(PoundsForceInOneNewton, newton.As(ForceUnit.PoundForce), PoundsForceTolerance); AssertEx.EqualTolerance(TonnesForceInOneNewton, newton.As(ForceUnit.TonneForce), TonnesForceTolerance); @@ -153,10 +168,22 @@ public void ToUnit() AssertEx.EqualTolerance(MeganewtonsInOneNewton, (double)meganewtonQuantity.Value, MeganewtonsTolerance); Assert.Equal(ForceUnit.Meganewton, meganewtonQuantity.Unit); + var micronewtonQuantity = newton.ToUnit(ForceUnit.Micronewton); + AssertEx.EqualTolerance(MicronewtonsInOneNewton, (double)micronewtonQuantity.Value, MicronewtonsTolerance); + Assert.Equal(ForceUnit.Micronewton, micronewtonQuantity.Unit); + + var millinewtonQuantity = newton.ToUnit(ForceUnit.Millinewton); + AssertEx.EqualTolerance(MillinewtonsInOneNewton, (double)millinewtonQuantity.Value, MillinewtonsTolerance); + Assert.Equal(ForceUnit.Millinewton, millinewtonQuantity.Unit); + var newtonQuantity = newton.ToUnit(ForceUnit.Newton); AssertEx.EqualTolerance(NewtonsInOneNewton, (double)newtonQuantity.Value, NewtonsTolerance); Assert.Equal(ForceUnit.Newton, newtonQuantity.Unit); + var ounceforceQuantity = newton.ToUnit(ForceUnit.OunceForce); + AssertEx.EqualTolerance(OuncesForceInOneNewton, (double)ounceforceQuantity.Value, OuncesForceTolerance); + Assert.Equal(ForceUnit.OunceForce, ounceforceQuantity.Unit); + var poundalQuantity = newton.ToUnit(ForceUnit.Poundal); AssertEx.EqualTolerance(PoundalsInOneNewton, (double)poundalQuantity.Value, PoundalsTolerance); Assert.Equal(ForceUnit.Poundal, poundalQuantity.Unit); @@ -180,7 +207,10 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Force.FromKilonewtons(newton.Kilonewtons).Newtons, KilonewtonsTolerance); AssertEx.EqualTolerance(1, Force.FromKiloPonds(newton.KiloPonds).Newtons, KiloPondsTolerance); AssertEx.EqualTolerance(1, Force.FromMeganewtons(newton.Meganewtons).Newtons, MeganewtonsTolerance); + AssertEx.EqualTolerance(1, Force.FromMicronewtons(newton.Micronewtons).Newtons, MicronewtonsTolerance); + AssertEx.EqualTolerance(1, Force.FromMillinewtons(newton.Millinewtons).Newtons, MillinewtonsTolerance); AssertEx.EqualTolerance(1, Force.FromNewtons(newton.Newtons).Newtons, NewtonsTolerance); + AssertEx.EqualTolerance(1, Force.FromOuncesForce(newton.OuncesForce).Newtons, OuncesForceTolerance); AssertEx.EqualTolerance(1, Force.FromPoundals(newton.Poundals).Newtons, PoundalsTolerance); AssertEx.EqualTolerance(1, Force.FromPoundsForce(newton.PoundsForce).Newtons, PoundsForceTolerance); AssertEx.EqualTolerance(1, Force.FromTonnesForce(newton.TonnesForce).Newtons, TonnesForceTolerance); diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs index da7ac9dba4..728272ab01 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs @@ -110,6 +110,28 @@ public static class NumberToForceExtensions #endregion + #region Micronewton + + /// + public static Force Micronewtons(this T value) => Force.FromMicronewtons(Convert.ToDouble(value)); + + /// + [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] + public static Force? Micronewtons(this T? value) where T : struct => Force.FromMicronewtons(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + + #region Millinewton + + /// + public static Force Millinewtons(this T value) => Force.FromMillinewtons(Convert.ToDouble(value)); + + /// + [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] + public static Force? Millinewtons(this T? value) where T : struct => Force.FromMillinewtons(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region Newton /// @@ -121,6 +143,17 @@ public static class NumberToForceExtensions #endregion + #region OunceForce + + /// + public static Force OuncesForce(this T value) => Force.FromOuncesForce(Convert.ToDouble(value)); + + /// + [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] + public static Force? OuncesForce(this T? value) where T : struct => Force.FromOuncesForce(value == null ? (double?)null : Convert.ToDouble(value.Value)); + + #endregion + #region Poundal /// diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index 0c4f5a070b..a58d5dcf1b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -116,6 +116,24 @@ public partial struct Force : IComparable, IComparable return meganewtons.HasValue ? FromMeganewtons(meganewtons.Value) : default(Force?); } + /// + /// Get nullable Force from nullable Micronewtons. + /// + [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] + public static Force? FromMicronewtons(QuantityValue? micronewtons) + { + return micronewtons.HasValue ? FromMicronewtons(micronewtons.Value) : default(Force?); + } + + /// + /// Get nullable Force from nullable Millinewtons. + /// + [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] + public static Force? FromMillinewtons(QuantityValue? millinewtons) + { + return millinewtons.HasValue ? FromMillinewtons(millinewtons.Value) : default(Force?); + } + /// /// Get nullable Force from nullable Newtons. /// @@ -125,6 +143,15 @@ public partial struct Force : IComparable, IComparable return newtons.HasValue ? FromNewtons(newtons.Value) : default(Force?); } + /// + /// Get nullable Force from nullable OuncesForce. + /// + [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] + public static Force? FromOuncesForce(QuantityValue? ouncesforce) + { + return ouncesforce.HasValue ? FromOuncesForce(ouncesforce.Value) : default(Force?); + } + /// /// Get nullable Force from nullable Poundals. /// diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index ff638eec87..6a95b5a942 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -1526,7 +1526,7 @@ private static readonly ReadOnlyCollection DefaultLocalization new[] { new AbbreviationsForCulture("en-US", "daN"), - new AbbreviationsForCulture("ru-RU", "даН"), + new AbbreviationsForCulture("ru-RU", ""), }), new CulturesForEnumValue((int) ForceUnit.Dyn, new[] @@ -1544,7 +1544,7 @@ private static readonly ReadOnlyCollection DefaultLocalization new[] { new AbbreviationsForCulture("en-US", "kN"), - new AbbreviationsForCulture("ru-RU", "кН"), + new AbbreviationsForCulture("ru-RU", ""), }), new CulturesForEnumValue((int) ForceUnit.KiloPond, new[] @@ -1558,12 +1558,29 @@ private static readonly ReadOnlyCollection DefaultLocalization new AbbreviationsForCulture("en-US", "MN"), new AbbreviationsForCulture("ru-RU", ""), }), + new CulturesForEnumValue((int) ForceUnit.Micronewton, + new[] + { + new AbbreviationsForCulture("en-US", "µN"), + new AbbreviationsForCulture("ru-RU", "даН"), + }), + new CulturesForEnumValue((int) ForceUnit.Millinewton, + new[] + { + new AbbreviationsForCulture("en-US", "mN"), + new AbbreviationsForCulture("ru-RU", "кН"), + }), new CulturesForEnumValue((int) ForceUnit.Newton, new[] { new AbbreviationsForCulture("en-US", "N"), new AbbreviationsForCulture("ru-RU", "Н"), }), + new CulturesForEnumValue((int) ForceUnit.OunceForce, + new[] + { + new AbbreviationsForCulture("en-US", "oz·f", "ozf"), + }), new CulturesForEnumValue((int) ForceUnit.Poundal, new[] { diff --git a/UnitsNet/GeneratedCode/Units/ForceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ForceUnit.g.cs index d8984dc616..d3d1d901f0 100644 --- a/UnitsNet/GeneratedCode/Units/ForceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ForceUnit.g.cs @@ -51,7 +51,10 @@ public enum ForceUnit Kilonewton, KiloPond, Meganewton, + Micronewton, + Millinewton, Newton, + OunceForce, Poundal, PoundForce, TonneForce, From 5dd52eea73c8aacc46b0093c10df21ead6db71b0 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Mon, 29 Oct 2018 14:12:24 -0400 Subject: [PATCH 2/2] Fix for plural name and abbreviations for ounce force. --- Common/GeneratedCode/Quantities/Force.Common.g.cs | 12 ++++++------ Common/UnitDefinitions/Force.json | 4 ++-- UnitsNet.Tests/CustomCode/ForceTests.cs | 2 +- UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs | 14 +++++++------- .../Extensions/Number/NumberToForceExtensions.g.cs | 8 ++++---- .../Quantities/Force.NetFramework.g.cs | 6 +++--- UnitsNet/GeneratedCode/UnitSystem.Default.g.cs | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index b606c2a5ba..e6b543bf20 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -207,9 +207,9 @@ public static BaseDimensions BaseDimensions public double Newtons => As(ForceUnit.Newton); /// - /// Get Force in OuncesForce. + /// Get Force in OunceForce. /// - public double OuncesForce => As(ForceUnit.OunceForce); + public double OunceForce => As(ForceUnit.OunceForce); /// /// Get Force in Poundals. @@ -362,16 +362,16 @@ public static Force FromNewtons(QuantityValue newtons) } /// - /// Get Force from OuncesForce. + /// Get Force from OunceForce. /// #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] - public static Force FromOuncesForce(double ouncesforce) + public static Force FromOunceForce(double ounceforce) #else - public static Force FromOuncesForce(QuantityValue ouncesforce) + public static Force FromOunceForce(QuantityValue ounceforce) #endif { - double value = (double) ouncesforce; + double value = (double) ounceforce; return new Force(value, ForceUnit.OunceForce); } diff --git a/Common/UnitDefinitions/Force.json b/Common/UnitDefinitions/Force.json index b9a59b40e9..792461c8cb 100644 --- a/Common/UnitDefinitions/Force.json +++ b/Common/UnitDefinitions/Force.json @@ -124,13 +124,13 @@ }, { "SingularName": "OunceForce", - "PluralName": "OuncesForce", + "PluralName": "OunceForce", "FromUnitToBaseFunc": "x*2.780138509537812e-1", "FromBaseToUnitFunc": "x/2.780138509537812e-1", "Localization": [ { "Culture": "en-US", - "Abbreviations": [ "oz·f", "ozf" ] + "Abbreviations": [ "ozf" ] } ] } diff --git a/UnitsNet.Tests/CustomCode/ForceTests.cs b/UnitsNet.Tests/CustomCode/ForceTests.cs index 244d4796f0..1e157075fb 100644 --- a/UnitsNet.Tests/CustomCode/ForceTests.cs +++ b/UnitsNet.Tests/CustomCode/ForceTests.cs @@ -47,7 +47,7 @@ public class ForceTests : ForceTestsBase protected override double MicronewtonsInOneNewton => 1.0e6; - protected override double OuncesForceInOneNewton => 3.596943089595368; + protected override double OunceForceInOneNewton => 3.596943089595368; [Fact] public void ForceDividedByAreaEqualsPressure() diff --git a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs index 415b985417..ea45f8121a 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs @@ -62,7 +62,7 @@ public abstract partial class ForceTestsBase protected abstract double MicronewtonsInOneNewton { get; } protected abstract double MillinewtonsInOneNewton { get; } protected abstract double NewtonsInOneNewton { get; } - protected abstract double OuncesForceInOneNewton { get; } + protected abstract double OunceForceInOneNewton { get; } protected abstract double PoundalsInOneNewton { get; } protected abstract double PoundsForceInOneNewton { get; } protected abstract double TonnesForceInOneNewton { get; } @@ -77,7 +77,7 @@ public abstract partial class ForceTestsBase protected virtual double MicronewtonsTolerance { get { return 1e-5; } } protected virtual double MillinewtonsTolerance { get { return 1e-5; } } protected virtual double NewtonsTolerance { get { return 1e-5; } } - protected virtual double OuncesForceTolerance { get { return 1e-5; } } + protected virtual double OunceForceTolerance { get { return 1e-5; } } protected virtual double PoundalsTolerance { get { return 1e-5; } } protected virtual double PoundsForceTolerance { get { return 1e-5; } } protected virtual double TonnesForceTolerance { get { return 1e-5; } } @@ -96,7 +96,7 @@ public void NewtonToForceUnits() AssertEx.EqualTolerance(MicronewtonsInOneNewton, newton.Micronewtons, MicronewtonsTolerance); AssertEx.EqualTolerance(MillinewtonsInOneNewton, newton.Millinewtons, MillinewtonsTolerance); AssertEx.EqualTolerance(NewtonsInOneNewton, newton.Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(OuncesForceInOneNewton, newton.OuncesForce, OuncesForceTolerance); + AssertEx.EqualTolerance(OunceForceInOneNewton, newton.OunceForce, OunceForceTolerance); AssertEx.EqualTolerance(PoundalsInOneNewton, newton.Poundals, PoundalsTolerance); AssertEx.EqualTolerance(PoundsForceInOneNewton, newton.PoundsForce, PoundsForceTolerance); AssertEx.EqualTolerance(TonnesForceInOneNewton, newton.TonnesForce, TonnesForceTolerance); @@ -114,7 +114,7 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Micronewton).Micronewtons, MicronewtonsTolerance); AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Millinewton).Millinewtons, MillinewtonsTolerance); AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Newton).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.OunceForce).OuncesForce, OuncesForceTolerance); + AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.OunceForce).OunceForce, OunceForceTolerance); AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Poundal).Poundals, PoundalsTolerance); AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.PoundForce).PoundsForce, PoundsForceTolerance); AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.TonneForce).TonnesForce, TonnesForceTolerance); @@ -133,7 +133,7 @@ public void As() AssertEx.EqualTolerance(MicronewtonsInOneNewton, newton.As(ForceUnit.Micronewton), MicronewtonsTolerance); AssertEx.EqualTolerance(MillinewtonsInOneNewton, newton.As(ForceUnit.Millinewton), MillinewtonsTolerance); AssertEx.EqualTolerance(NewtonsInOneNewton, newton.As(ForceUnit.Newton), NewtonsTolerance); - AssertEx.EqualTolerance(OuncesForceInOneNewton, newton.As(ForceUnit.OunceForce), OuncesForceTolerance); + AssertEx.EqualTolerance(OunceForceInOneNewton, newton.As(ForceUnit.OunceForce), OunceForceTolerance); AssertEx.EqualTolerance(PoundalsInOneNewton, newton.As(ForceUnit.Poundal), PoundalsTolerance); AssertEx.EqualTolerance(PoundsForceInOneNewton, newton.As(ForceUnit.PoundForce), PoundsForceTolerance); AssertEx.EqualTolerance(TonnesForceInOneNewton, newton.As(ForceUnit.TonneForce), TonnesForceTolerance); @@ -181,7 +181,7 @@ public void ToUnit() Assert.Equal(ForceUnit.Newton, newtonQuantity.Unit); var ounceforceQuantity = newton.ToUnit(ForceUnit.OunceForce); - AssertEx.EqualTolerance(OuncesForceInOneNewton, (double)ounceforceQuantity.Value, OuncesForceTolerance); + AssertEx.EqualTolerance(OunceForceInOneNewton, (double)ounceforceQuantity.Value, OunceForceTolerance); Assert.Equal(ForceUnit.OunceForce, ounceforceQuantity.Unit); var poundalQuantity = newton.ToUnit(ForceUnit.Poundal); @@ -210,7 +210,7 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Force.FromMicronewtons(newton.Micronewtons).Newtons, MicronewtonsTolerance); AssertEx.EqualTolerance(1, Force.FromMillinewtons(newton.Millinewtons).Newtons, MillinewtonsTolerance); AssertEx.EqualTolerance(1, Force.FromNewtons(newton.Newtons).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(1, Force.FromOuncesForce(newton.OuncesForce).Newtons, OuncesForceTolerance); + AssertEx.EqualTolerance(1, Force.FromOunceForce(newton.OunceForce).Newtons, OunceForceTolerance); AssertEx.EqualTolerance(1, Force.FromPoundals(newton.Poundals).Newtons, PoundalsTolerance); AssertEx.EqualTolerance(1, Force.FromPoundsForce(newton.PoundsForce).Newtons, PoundsForceTolerance); AssertEx.EqualTolerance(1, Force.FromTonnesForce(newton.TonnesForce).Newtons, TonnesForceTolerance); diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs index 728272ab01..bbb2e5b140 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs @@ -145,12 +145,12 @@ public static class NumberToForceExtensions #region OunceForce - /// - public static Force OuncesForce(this T value) => Force.FromOuncesForce(Convert.ToDouble(value)); + /// + public static Force OunceForce(this T value) => Force.FromOunceForce(Convert.ToDouble(value)); - /// + /// [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Force? OuncesForce(this T? value) where T : struct => Force.FromOuncesForce(value == null ? (double?)null : Convert.ToDouble(value.Value)); + public static Force? OunceForce(this T? value) where T : struct => Force.FromOunceForce(value == null ? (double?)null : Convert.ToDouble(value.Value)); #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index a58d5dcf1b..795ae79c9a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -144,12 +144,12 @@ public partial struct Force : IComparable, IComparable } /// - /// Get nullable Force from nullable OuncesForce. + /// Get nullable Force from nullable OunceForce. /// [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Force? FromOuncesForce(QuantityValue? ouncesforce) + public static Force? FromOunceForce(QuantityValue? ounceforce) { - return ouncesforce.HasValue ? FromOuncesForce(ouncesforce.Value) : default(Force?); + return ounceforce.HasValue ? FromOunceForce(ounceforce.Value) : default(Force?); } /// diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index 6a95b5a942..c75e6a3189 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -1579,7 +1579,7 @@ private static readonly ReadOnlyCollection DefaultLocalization new CulturesForEnumValue((int) ForceUnit.OunceForce, new[] { - new AbbreviationsForCulture("en-US", "oz·f", "ozf"), + new AbbreviationsForCulture("en-US", "ozf"), }), new CulturesForEnumValue((int) ForceUnit.Poundal, new[]