From fce7eadfcaebf134fa38c6b6cf9694c82d9c4a89 Mon Sep 17 00:00:00 2001 From: Daniel Sirz Date: Fri, 3 Jun 2016 17:58:47 +0200 Subject: [PATCH] Added Flow.CubicDecimeterPerMinute --- UnitsNet.Tests/CustomCode/FlowTests.cs | 2 + .../GeneratedCode/FlowTestsBase.g.cs | 6 +++ UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs | 1 + UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs | 37 +++++++++++++++++++ .../GeneratedCode/UnitSystem.Default.g.cs | 6 +++ UnitsNet/Scripts/UnitDefinitions/Flow.json | 20 +++++++++- 6 files changed, 70 insertions(+), 2 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/FlowTests.cs b/UnitsNet.Tests/CustomCode/FlowTests.cs index de7424e14e..d7768e6f82 100644 --- a/UnitsNet.Tests/CustomCode/FlowTests.cs +++ b/UnitsNet.Tests/CustomCode/FlowTests.cs @@ -25,6 +25,8 @@ public class FlowTests : FlowTestsBase { protected override double CubicMetersPerHourInOneCubicMeterPerSecond => 3600.0; + protected override double CubicDecimetersPerMinuteInOneCubicMeterPerSecond => 60000.00000; + protected override double CubicFeetPerSecondInOneCubicMeterPerSecond => 35.314666213; protected override double MillionUsGallonsPerDayInOneCubicMeterPerSecond => 22.824465227; diff --git a/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs index b588d865db..7388305f34 100644 --- a/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs @@ -37,6 +37,7 @@ namespace UnitsNet.Tests public abstract partial class FlowTestsBase { protected abstract double CentilitersPerMinuteInOneCubicMeterPerSecond { get; } + protected abstract double CubicDecimetersPerMinuteInOneCubicMeterPerSecond { get; } protected abstract double CubicFeetPerSecondInOneCubicMeterPerSecond { get; } protected abstract double CubicMetersPerHourInOneCubicMeterPerSecond { get; } protected abstract double CubicMetersPerSecondInOneCubicMeterPerSecond { get; } @@ -51,6 +52,7 @@ public abstract partial class FlowTestsBase // ReSharper disable VirtualMemberNeverOverriden.Global protected virtual double CentilitersPerMinuteTolerance { get { return 1e-5; } } + protected virtual double CubicDecimetersPerMinuteTolerance { get { return 1e-5; } } protected virtual double CubicFeetPerSecondTolerance { get { return 1e-5; } } protected virtual double CubicMetersPerHourTolerance { get { return 1e-5; } } protected virtual double CubicMetersPerSecondTolerance { get { return 1e-5; } } @@ -69,6 +71,7 @@ public void CubicMeterPerSecondToFlowUnits() { Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); Assert.AreEqual(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CentilitersPerMinute, CentilitersPerMinuteTolerance); + Assert.AreEqual(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance); Assert.AreEqual(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerSecond, CubicFeetPerSecondTolerance); Assert.AreEqual(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerHour, CubicMetersPerHourTolerance); Assert.AreEqual(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerSecond, CubicMetersPerSecondTolerance); @@ -86,6 +89,7 @@ public void CubicMeterPerSecondToFlowUnits() public void FromValueAndUnit() { Assert.AreEqual(1, Flow.From(1, FlowUnit.CentilitersPerMinute).CentilitersPerMinute, CentilitersPerMinuteTolerance); + Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicDecimeterPerMinute).CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance); Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicFootPerSecond).CubicFeetPerSecond, CubicFeetPerSecondTolerance); Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicMeterPerHour).CubicMetersPerHour, CubicMetersPerHourTolerance); Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicMeterPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance); @@ -104,6 +108,7 @@ public void As() { var cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); Assert.AreEqual(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CentilitersPerMinute), CentilitersPerMinuteTolerance); + Assert.AreEqual(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicDecimeterPerMinute), CubicDecimetersPerMinuteTolerance); Assert.AreEqual(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicFootPerSecond), CubicFeetPerSecondTolerance); Assert.AreEqual(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerHour), CubicMetersPerHourTolerance); Assert.AreEqual(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerSecond), CubicMetersPerSecondTolerance); @@ -122,6 +127,7 @@ public void ConversionRoundTrip() { Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); Assert.AreEqual(1, Flow.FromCentilitersPerMinute(cubicmeterpersecond.CentilitersPerMinute).CubicMetersPerSecond, CentilitersPerMinuteTolerance); + Assert.AreEqual(1, Flow.FromCubicDecimetersPerMinute(cubicmeterpersecond.CubicDecimetersPerMinute).CubicMetersPerSecond, CubicDecimetersPerMinuteTolerance); Assert.AreEqual(1, Flow.FromCubicFeetPerSecond(cubicmeterpersecond.CubicFeetPerSecond).CubicMetersPerSecond, CubicFeetPerSecondTolerance); Assert.AreEqual(1, Flow.FromCubicMetersPerHour(cubicmeterpersecond.CubicMetersPerHour).CubicMetersPerSecond, CubicMetersPerHourTolerance); Assert.AreEqual(1, Flow.FromCubicMetersPerSecond(cubicmeterpersecond.CubicMetersPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance); diff --git a/UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs b/UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs index 642a735303..fa7870e81e 100644 --- a/UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs +++ b/UnitsNet/GeneratedCode/Enums/FlowUnit.g.cs @@ -26,6 +26,7 @@ public enum FlowUnit { Undefined = 0, CentilitersPerMinute, + CubicDecimeterPerMinute, CubicFootPerSecond, CubicMeterPerHour, CubicMeterPerSecond, diff --git a/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs b/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs index 1971620ec1..b43467592a 100644 --- a/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs +++ b/UnitsNet/GeneratedCode/UnitClasses/Flow.g.cs @@ -101,6 +101,14 @@ public double CentilitersPerMinute get { return (_cubicMetersPerSecond*60000.00000) / 1e-2d; } } + /// + /// Get Flow in CubicDecimetersPerMinute. + /// + public double CubicDecimetersPerMinute + { + get { return _cubicMetersPerSecond*60000.00000; } + } + /// /// Get Flow in CubicFeetPerSecond. /// @@ -206,6 +214,14 @@ public static Flow FromCentilitersPerMinute(double centilitersperminute) return new Flow((centilitersperminute/60000.00000) * 1e-2d); } + /// + /// Get Flow from CubicDecimetersPerMinute. + /// + public static Flow FromCubicDecimetersPerMinute(double cubicdecimetersperminute) + { + return new Flow(cubicdecimetersperminute/60000.00000); + } + /// /// Get Flow from CubicFeetPerSecond. /// @@ -310,6 +326,21 @@ public static Flow FromUsGallonsPerMinute(double usgallonsperminute) } } + /// + /// Get nullable Flow from nullable CubicDecimetersPerMinute. + /// + public static Flow? FromCubicDecimetersPerMinute(double? cubicdecimetersperminute) + { + if (cubicdecimetersperminute.HasValue) + { + return FromCubicDecimetersPerMinute(cubicdecimetersperminute.Value); + } + else + { + return null; + } + } + /// /// Get nullable Flow from nullable CubicFeetPerSecond. /// @@ -489,6 +520,8 @@ public static Flow From(double val, FlowUnit fromUnit) { case FlowUnit.CentilitersPerMinute: return FromCentilitersPerMinute(val); + case FlowUnit.CubicDecimeterPerMinute: + return FromCubicDecimetersPerMinute(val); case FlowUnit.CubicFootPerSecond: return FromCubicFeetPerSecond(val); case FlowUnit.CubicMeterPerHour: @@ -534,6 +567,8 @@ public static Flow From(double val, FlowUnit fromUnit) { case FlowUnit.CentilitersPerMinute: return FromCentilitersPerMinute(value.Value); + case FlowUnit.CubicDecimeterPerMinute: + return FromCubicDecimetersPerMinute(value.Value); case FlowUnit.CubicFootPerSecond: return FromCubicFeetPerSecond(value.Value); case FlowUnit.CubicMeterPerHour: @@ -712,6 +747,8 @@ public double As(FlowUnit unit) { case FlowUnit.CentilitersPerMinute: return CentilitersPerMinute; + case FlowUnit.CubicDecimeterPerMinute: + return CubicDecimetersPerMinute; case FlowUnit.CubicFootPerSecond: return CubicFeetPerSecond; case FlowUnit.CubicMeterPerHour: diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index 9e6815f862..9f74331518 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -567,6 +567,12 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "cLPM"), }), + new CulturesForEnumValue((int) FlowUnit.CubicDecimeterPerMinute, + new[] + { + new AbbreviationsForCulture("en-US", "dm³/min"), + new AbbreviationsForCulture("ru-RU", "дм³/мин"), + }), new CulturesForEnumValue((int) FlowUnit.CubicFootPerSecond, new[] { diff --git a/UnitsNet/Scripts/UnitDefinitions/Flow.json b/UnitsNet/Scripts/UnitDefinitions/Flow.json index f30e9b948c..d4936ed565 100644 --- a/UnitsNet/Scripts/UnitDefinitions/Flow.json +++ b/UnitsNet/Scripts/UnitDefinitions/Flow.json @@ -64,12 +64,12 @@ "PluralName": "LitersPerMinute", "FromUnitToBaseFunc": "x/60000.00000", "FromBaseToUnitFunc": "x*60000.00000", - "Prefixes": [ "Nano", "Micro", "Milli", "Centi", "Deci", "Kilo"], + "Prefixes": [ "Nano", "Micro", "Milli", "Centi", "Deci", "Kilo" ], "Localization": [ { "Culture": "en-US", "Abbreviations": [ "LPM" ], - "AbbreviationsWithPrefixes": ["nLPM", "μLPM", "mLPM", "cLPM", "dLPM", "kLPM"] + "AbbreviationsWithPrefixes": [ "nLPM", "μLPM", "mLPM", "cLPM", "dLPM", "kLPM" ] } ] }, @@ -84,6 +84,22 @@ "Abbreviations": [ "GPM" ] } ] + }, + { + "SingularName": "CubicDecimeterPerMinute", + "PluralName": "CubicDecimetersPerMinute", + "FromUnitToBaseFunc": "x/60000.00000", + "FromBaseToUnitFunc": "x*60000.00000", + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "dm³/min" ] + }, + { + "Culture": "ru-RU", + "Abbreviations": [ "дм³/мин" ] + } + ] } ] }