diff --git a/UnitsNet.Tests/CustomCode/ForceChangeRateTests.cs b/UnitsNet.Tests/CustomCode/ForceChangeRateTests.cs new file mode 100644 index 0000000000..d58c88e188 --- /dev/null +++ b/UnitsNet.Tests/CustomCode/ForceChangeRateTests.cs @@ -0,0 +1,35 @@ +// Copyright © 2007 by Initial Force AS. All rights reserved. +// https://github.com/InitialForce/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +using System; + +namespace UnitsNet.Tests.CustomCode +{ + public class ForceChangeRateTests : ForceChangeRateTestsBase + { + // TODO Override properties in base class here + protected override double NewtonsPerSecondInOneNewtonPerSecond + { + get { return 1; } + } + } +} diff --git a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs new file mode 100644 index 0000000000..897d508b44 --- /dev/null +++ b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs @@ -0,0 +1,167 @@ +// Copyright © 2007 by Initial Force AS. All rights reserved. +// https://github.com/InitialForce/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using NUnit.Framework; +using UnitsNet.Units; + +// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? +#pragma warning disable 1718 + +// ReSharper disable once CheckNamespace +namespace UnitsNet.Tests +{ + /// + /// Test of ForceChangeRate. + /// + [TestFixture] +// ReSharper disable once PartialTypeWithSinglePart + public abstract partial class ForceChangeRateTestsBase + { + protected abstract double NewtonsPerSecondInOneNewtonPerSecond { get; } + +// ReSharper disable VirtualMemberNeverOverriden.Global + protected virtual double NewtonsPerSecondTolerance { get { return 1e-5; } } +// ReSharper restore VirtualMemberNeverOverriden.Global + + [Test] + public void NewtonPerSecondToForceChangeRateUnits() + { + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + Assert.AreEqual(NewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.NewtonsPerSecond, NewtonsPerSecondTolerance); + } + + [Test] + public void FromValueAndUnit() + { + Assert.AreEqual(1, ForceChangeRate.From(1, ForceChangeRateUnit.NewtonPerSecond).NewtonsPerSecond, NewtonsPerSecondTolerance); + } + + [Test] + public void As() + { + var newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + Assert.AreEqual(NewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.NewtonPerSecond), NewtonsPerSecondTolerance); + } + + [Test] + public void ConversionRoundTrip() + { + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + Assert.AreEqual(1, ForceChangeRate.FromNewtonsPerSecond(newtonpersecond.NewtonsPerSecond).NewtonsPerSecond, NewtonsPerSecondTolerance); + } + + [Test] + public void ArithmeticOperators() + { + ForceChangeRate v = ForceChangeRate.FromNewtonsPerSecond(1); + Assert.AreEqual(-1, -v.NewtonsPerSecond, NewtonsPerSecondTolerance); + Assert.AreEqual(2, (ForceChangeRate.FromNewtonsPerSecond(3)-v).NewtonsPerSecond, NewtonsPerSecondTolerance); + Assert.AreEqual(2, (v + v).NewtonsPerSecond, NewtonsPerSecondTolerance); + Assert.AreEqual(10, (v*10).NewtonsPerSecond, NewtonsPerSecondTolerance); + Assert.AreEqual(10, (10*v).NewtonsPerSecond, NewtonsPerSecondTolerance); + Assert.AreEqual(2, (ForceChangeRate.FromNewtonsPerSecond(10)/5).NewtonsPerSecond, NewtonsPerSecondTolerance); + Assert.AreEqual(2, ForceChangeRate.FromNewtonsPerSecond(10)/ForceChangeRate.FromNewtonsPerSecond(5), NewtonsPerSecondTolerance); + } + + [Test] + public void ComparisonOperators() + { + ForceChangeRate oneNewtonPerSecond = ForceChangeRate.FromNewtonsPerSecond(1); + ForceChangeRate twoNewtonsPerSecond = ForceChangeRate.FromNewtonsPerSecond(2); + + Assert.True(oneNewtonPerSecond < twoNewtonsPerSecond); + Assert.True(oneNewtonPerSecond <= twoNewtonsPerSecond); + Assert.True(twoNewtonsPerSecond > oneNewtonPerSecond); + Assert.True(twoNewtonsPerSecond >= oneNewtonPerSecond); + + Assert.False(oneNewtonPerSecond > twoNewtonsPerSecond); + Assert.False(oneNewtonPerSecond >= twoNewtonsPerSecond); + Assert.False(twoNewtonsPerSecond < oneNewtonPerSecond); + Assert.False(twoNewtonsPerSecond <= oneNewtonPerSecond); + } + + [Test] + public void CompareToIsImplemented() + { + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + Assert.AreEqual(0, newtonpersecond.CompareTo(newtonpersecond)); + Assert.Greater(newtonpersecond.CompareTo(ForceChangeRate.Zero), 0); + Assert.Less(ForceChangeRate.Zero.CompareTo(newtonpersecond), 0); + } + + [Test] + [ExpectedException(typeof(ArgumentException))] + public void CompareToThrowsOnTypeMismatch() + { + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); +// ReSharper disable once ReturnValueOfPureMethodIsNotUsed + newtonpersecond.CompareTo(new object()); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void CompareToThrowsOnNull() + { + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); +// ReSharper disable once ReturnValueOfPureMethodIsNotUsed + newtonpersecond.CompareTo(null); + } + + + [Test] + public void EqualityOperators() + { + ForceChangeRate a = ForceChangeRate.FromNewtonsPerSecond(1); + ForceChangeRate b = ForceChangeRate.FromNewtonsPerSecond(2); + +// ReSharper disable EqualExpressionComparison + Assert.True(a == a); + Assert.True(a != b); + + Assert.False(a == b); + Assert.False(a != a); +// ReSharper restore EqualExpressionComparison + } + + [Test] + public void EqualsIsImplemented() + { + ForceChangeRate v = ForceChangeRate.FromNewtonsPerSecond(1); + Assert.IsTrue(v.Equals(ForceChangeRate.FromNewtonsPerSecond(1))); + Assert.IsFalse(v.Equals(ForceChangeRate.Zero)); + } + + [Test] + public void EqualsReturnsFalseOnTypeMismatch() + { + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + Assert.IsFalse(newtonpersecond.Equals(new object())); + } + + [Test] + public void EqualsReturnsFalseOnNull() + { + ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); + Assert.IsFalse(newtonpersecond.Equals(null)); + } + } +} diff --git a/UnitsNet/GeneratedCode/Enums/ForceChangeRateUnit.g.cs b/UnitsNet/GeneratedCode/Enums/ForceChangeRateUnit.g.cs new file mode 100644 index 0000000000..b2bb2df95d --- /dev/null +++ b/UnitsNet/GeneratedCode/Enums/ForceChangeRateUnit.g.cs @@ -0,0 +1,30 @@ +// Copyright © 2007 by Initial Force AS. All rights reserved. +// https://github.com/InitialForce/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// ReSharper disable once CheckNamespace +namespace UnitsNet.Units +{ + public enum ForceChangeRateUnit + { + Undefined = 0, + NewtonPerSecond, + } +} diff --git a/UnitsNet/GeneratedCode/UnitClasses/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/UnitClasses/ForceChangeRate.g.cs new file mode 100644 index 0000000000..141bf22dcd --- /dev/null +++ b/UnitsNet/GeneratedCode/UnitClasses/ForceChangeRate.g.cs @@ -0,0 +1,392 @@ +// Copyright © 2007 by Initial Force AS. All rights reserved. +// https://github.com/InitialForce/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text.RegularExpressions; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time). + /// + // ReSharper disable once PartialTypeWithSinglePart + public partial struct ForceChangeRate : IComparable, IComparable + { + /// + /// Base unit of ForceChangeRate. + /// + private readonly double _newtonsPerSecond; + + public ForceChangeRate(double newtonspersecond) : this() + { + _newtonsPerSecond = newtonspersecond; + } + + #region Properties + + public static ForceChangeRateUnit BaseUnit + { + get { return ForceChangeRateUnit.NewtonPerSecond; } + } + + /// + /// Get ForceChangeRate in NewtonsPerSecond. + /// + public double NewtonsPerSecond + { + get { return _newtonsPerSecond; } + } + + #endregion + + #region Static + + public static ForceChangeRate Zero + { + get { return new ForceChangeRate(); } + } + + /// + /// Get ForceChangeRate from NewtonsPerSecond. + /// + public static ForceChangeRate FromNewtonsPerSecond(double newtonspersecond) + { + return new ForceChangeRate(newtonspersecond); + } + + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ForceChangeRate unit value. + public static ForceChangeRate From(double value, ForceChangeRateUnit fromUnit) + { + switch (fromUnit) + { + case ForceChangeRateUnit.NewtonPerSecond: + return FromNewtonsPerSecond(value); + + default: + throw new NotImplementedException("fromUnit: " + fromUnit); + } + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Culture to use for localization. Defaults to Thread.CurrentUICulture. + /// Unit abbreviation string. + [UsedImplicitly] + public static string GetAbbreviation(ForceChangeRateUnit unit, CultureInfo culture = null) + { + return UnitSystem.GetCached(culture).GetDefaultAbbreviation(unit); + } + + #endregion + + #region Arithmetic Operators + + public static ForceChangeRate operator -(ForceChangeRate right) + { + return new ForceChangeRate(-right._newtonsPerSecond); + } + + public static ForceChangeRate operator +(ForceChangeRate left, ForceChangeRate right) + { + return new ForceChangeRate(left._newtonsPerSecond + right._newtonsPerSecond); + } + + public static ForceChangeRate operator -(ForceChangeRate left, ForceChangeRate right) + { + return new ForceChangeRate(left._newtonsPerSecond - right._newtonsPerSecond); + } + + public static ForceChangeRate operator *(double left, ForceChangeRate right) + { + return new ForceChangeRate(left*right._newtonsPerSecond); + } + + public static ForceChangeRate operator *(ForceChangeRate left, double right) + { + return new ForceChangeRate(left._newtonsPerSecond*(double)right); + } + + public static ForceChangeRate operator /(ForceChangeRate left, double right) + { + return new ForceChangeRate(left._newtonsPerSecond/(double)right); + } + + public static double operator /(ForceChangeRate left, ForceChangeRate right) + { + return Convert.ToDouble(left._newtonsPerSecond/right._newtonsPerSecond); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if (obj == null) throw new ArgumentNullException("obj"); + if (!(obj is ForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", "obj"); + return CompareTo((ForceChangeRate) obj); + } + + public int CompareTo(ForceChangeRate other) + { + return _newtonsPerSecond.CompareTo(other._newtonsPerSecond); + } + + public static bool operator <=(ForceChangeRate left, ForceChangeRate right) + { + return left._newtonsPerSecond <= right._newtonsPerSecond; + } + + public static bool operator >=(ForceChangeRate left, ForceChangeRate right) + { + return left._newtonsPerSecond >= right._newtonsPerSecond; + } + + public static bool operator <(ForceChangeRate left, ForceChangeRate right) + { + return left._newtonsPerSecond < right._newtonsPerSecond; + } + + public static bool operator >(ForceChangeRate left, ForceChangeRate right) + { + return left._newtonsPerSecond > right._newtonsPerSecond; + } + + public static bool operator ==(ForceChangeRate left, ForceChangeRate right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left._newtonsPerSecond == right._newtonsPerSecond; + } + + public static bool operator !=(ForceChangeRate left, ForceChangeRate right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left._newtonsPerSecond != right._newtonsPerSecond; + } + + public override bool Equals(object obj) + { + if (obj == null || GetType() != obj.GetType()) + { + return false; + } + + return _newtonsPerSecond.Equals(((ForceChangeRate) obj)._newtonsPerSecond); + } + + public override int GetHashCode() + { + return _newtonsPerSecond.GetHashCode(); + } + + #endregion + + #region Conversion + + /// + /// Convert to the unit representation . + /// + /// Value in new unit if successful, exception otherwise. + /// If conversion was not successful. + public double As(ForceChangeRateUnit unit) + { + switch (unit) + { + case ForceChangeRateUnit.NewtonPerSecond: + return NewtonsPerSecond; + + default: + throw new NotImplementedException("unit: " + unit); + } + } + + #endregion + + #region Parsing + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + public static ForceChangeRate Parse(string str, IFormatProvider formatProvider = null) + { + if (str == null) throw new ArgumentNullException("str"); + + var numFormat = formatProvider != null ? + (NumberFormatInfo) formatProvider.GetFormat(typeof (NumberFormatInfo)) : + NumberFormatInfo.CurrentInfo; + + var numRegex = string.Format(@"[\d., {0}{1}]*\d", // allows digits, dots, commas, and spaces in the quantity (must end in digit) + numFormat.NumberGroupSeparator, // adds provided (or current) culture's group separator + numFormat.NumberDecimalSeparator); // adds provided (or current) culture's decimal separator + var exponentialRegex = @"(?:[eE][-+]?\d+)?)"; + var regexString = string.Format(@"(?:\s*(?[-+]?{0}{1}{2}{3})?{4}{5}", + numRegex, // capture base (integral) Quantity value + exponentialRegex, // capture exponential (if any), end of Quantity capturing + @"\s?", // ignore whitespace (allows both "1kg", "1 kg") + @"(?[^\s\d,]+)", // capture Unit (non-whitespace) input + @"(and)?,?", // allow "and" & "," separators between quantities + @"(?[a-z]*)?"); // capture invalid input + + var quantities = ParseWithRegex(regexString, str, formatProvider); + if (quantities.Count == 0) + { + throw new ArgumentException( + "Expected string to have at least one pair of quantity and unit in the format" + + " \"<quantity> <unit>\". Eg. \"5.5 m\" or \"1ft 2in\""); + } + return quantities.Aggregate((x, y) => x + y); + } + + /// + /// Parse a string given a particular regular expression. + /// + /// Error parsing string. + private static List ParseWithRegex(string regexString, string str, IFormatProvider formatProvider = null) + { + var regex = new Regex(regexString); + MatchCollection matches = regex.Matches(str.Trim()); + var converted = new List(); + + foreach (Match match in matches) + { + GroupCollection groups = match.Groups; + + var valueString = groups["value"].Value; + var unitString = groups["unit"].Value; + if (groups["invalid"].Value != "") + { + var newEx = new UnitsNetException("Invalid string detected: " + groups["invalid"].Value); + newEx.Data["input"] = str; + newEx.Data["matched value"] = valueString; + newEx.Data["matched unit"] = unitString; + newEx.Data["formatprovider"] = formatProvider == null ? null : formatProvider.ToString(); + throw newEx; + } + if (valueString == "" && unitString == "") continue; + + try + { + ForceChangeRateUnit unit = ParseUnit(unitString, formatProvider); + double value = double.Parse(valueString, formatProvider); + + converted.Add(From(value, unit)); + } + catch (Exception ex) + { + var newEx = new UnitsNetException("Error parsing string.", ex); + newEx.Data["input"] = str; + newEx.Data["matched value"] = valueString; + newEx.Data["matched unit"] = unitString; + newEx.Data["formatprovider"] = formatProvider == null ? null : formatProvider.ToString(); + throw newEx; + } + } + return converted; + } + + /// + /// Parse a unit string. + /// + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ForceChangeRateUnit ParseUnit(string str, IFormatProvider formatProvider = null) + { + if (str == null) throw new ArgumentNullException("str"); + var unitSystem = UnitSystem.GetCached(formatProvider); + + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ForceChangeRateUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForceChangeRateUnit."); + newEx.Data["input"] = str; + newEx.Data["formatprovider"] = formatProvider == null ? null : formatProvider.ToString(); + throw newEx; + } + + return unit; + } + + #endregion + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(ForceChangeRateUnit.NewtonPerSecond); + } + + /// + /// Get string representation of value and unit. + /// + /// Unit representation to use. + /// Culture to use for localization and number formatting. + /// The number of significant digits after the radix point. + /// String representation. + [UsedImplicitly] + public string ToString(ForceChangeRateUnit unit, CultureInfo culture = null, int significantDigitsAfterRadix = 2) + { + return ToString(unit, culture, UnitFormatter.GetFormat(As(unit), significantDigitsAfterRadix)); + } + + /// + /// Get string representation of value and unit. + /// + /// Culture to use for localization and number formatting. + /// Unit representation to use. + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + [UsedImplicitly] + public string ToString(ForceChangeRateUnit unit, CultureInfo culture, string format, params object[] args) + { + return string.Format(culture, format, UnitFormatter.GetFormatArgs(unit, As(unit), culture, args)); + } + } +} diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index 84de974690..8e0bf9a871 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -545,6 +545,15 @@ private static readonly ReadOnlyCollection DefaultLocalization new AbbreviationsForCulture("ru-RU", "тс"), }), }), + new UnitLocalization(typeof (ForceChangeRateUnit), + new[] + { + new CulturesForEnumValue((int) ForceChangeRateUnit.NewtonPerSecond, + new[] + { + new AbbreviationsForCulture("en-US", "N/s"), + }), + }), new UnitLocalization(typeof (FrequencyUnit), new[] { diff --git a/UnitsNet/Scripts/UnitDefinitions/ForceChangeRate.json b/UnitsNet/Scripts/UnitDefinitions/ForceChangeRate.json new file mode 100644 index 0000000000..7d6d131eee --- /dev/null +++ b/UnitsNet/Scripts/UnitDefinitions/ForceChangeRate.json @@ -0,0 +1,19 @@ +{ + "Name": "ForceChangeRate", + "BaseUnit": "NewtonPerSecond", + "XmlDoc": "Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time).", + "Units": [ + { + "SingularName": "NewtonPerSecond", + "PluralName": "NewtonsPerSecond", + "FromUnitToBaseFunc": "x", + "FromBaseToUnitFunc": "x", + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "N/s" ] + } + ] + } + ] +} \ No newline at end of file