Skip to content

Commit

Permalink
Added MassFlowUnit.KilogramPerHour
Browse files Browse the repository at this point in the history
  • Loading branch information
enterprisebug committed Jun 2, 2016
1 parent 38792c3 commit ac3e270
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 1 deletion.
1 change: 1 addition & 0 deletions UnitsNet.Tests/CustomCode/MassFlowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class MassFlowTests : MassFlowTestsBase
protected override double DecagramsPerSecondInOneGramPerSecond => 1E-1;

protected override double HectogramsPerSecondInOneGramPerSecond => 1E-2;
protected override double KilogramsPerHourInOneGramPerSecond => 3.6;

protected override double KilogramsPerSecondInOneGramPerSecond => 1E-3;

Expand Down
6 changes: 6 additions & 0 deletions UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public abstract partial class MassFlowTestsBase
protected abstract double DecigramsPerSecondInOneGramPerSecond { get; }
protected abstract double GramsPerSecondInOneGramPerSecond { get; }
protected abstract double HectogramsPerSecondInOneGramPerSecond { get; }
protected abstract double KilogramsPerHourInOneGramPerSecond { get; }
protected abstract double KilogramsPerSecondInOneGramPerSecond { get; }
protected abstract double MicrogramsPerSecondInOneGramPerSecond { get; }
protected abstract double MilligramsPerSecondInOneGramPerSecond { get; }
Expand All @@ -53,6 +54,7 @@ public abstract partial class MassFlowTestsBase
protected virtual double DecigramsPerSecondTolerance { get { return 1e-5; } }
protected virtual double GramsPerSecondTolerance { get { return 1e-5; } }
protected virtual double HectogramsPerSecondTolerance { get { return 1e-5; } }
protected virtual double KilogramsPerHourTolerance { get { return 1e-5; } }
protected virtual double KilogramsPerSecondTolerance { get { return 1e-5; } }
protected virtual double MicrogramsPerSecondTolerance { get { return 1e-5; } }
protected virtual double MilligramsPerSecondTolerance { get { return 1e-5; } }
Expand All @@ -69,6 +71,7 @@ public void GramPerSecondToMassFlowUnits()
Assert.AreEqual(DecigramsPerSecondInOneGramPerSecond, grampersecond.DecigramsPerSecond, DecigramsPerSecondTolerance);
Assert.AreEqual(GramsPerSecondInOneGramPerSecond, grampersecond.GramsPerSecond, GramsPerSecondTolerance);
Assert.AreEqual(HectogramsPerSecondInOneGramPerSecond, grampersecond.HectogramsPerSecond, HectogramsPerSecondTolerance);
Assert.AreEqual(KilogramsPerHourInOneGramPerSecond, grampersecond.KilogramsPerHour, KilogramsPerHourTolerance);
Assert.AreEqual(KilogramsPerSecondInOneGramPerSecond, grampersecond.KilogramsPerSecond, KilogramsPerSecondTolerance);
Assert.AreEqual(MicrogramsPerSecondInOneGramPerSecond, grampersecond.MicrogramsPerSecond, MicrogramsPerSecondTolerance);
Assert.AreEqual(MilligramsPerSecondInOneGramPerSecond, grampersecond.MilligramsPerSecond, MilligramsPerSecondTolerance);
Expand All @@ -84,6 +87,7 @@ public void FromValueAndUnit()
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.DecigramPerSecond).DecigramsPerSecond, DecigramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.GramPerSecond).GramsPerSecond, GramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.HectogramPerSecond).HectogramsPerSecond, HectogramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.KilogramPerHour).KilogramsPerHour, KilogramsPerHourTolerance);
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.KilogramPerSecond).KilogramsPerSecond, KilogramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.MicrogramPerSecond).MicrogramsPerSecond, MicrogramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.From(1, MassFlowUnit.MilligramPerSecond).MilligramsPerSecond, MilligramsPerSecondTolerance);
Expand All @@ -100,6 +104,7 @@ public void As()
Assert.AreEqual(DecigramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.DecigramPerSecond), DecigramsPerSecondTolerance);
Assert.AreEqual(GramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.GramPerSecond), GramsPerSecondTolerance);
Assert.AreEqual(HectogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.HectogramPerSecond), HectogramsPerSecondTolerance);
Assert.AreEqual(KilogramsPerHourInOneGramPerSecond, grampersecond.As(MassFlowUnit.KilogramPerHour), KilogramsPerHourTolerance);
Assert.AreEqual(KilogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.KilogramPerSecond), KilogramsPerSecondTolerance);
Assert.AreEqual(MicrogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.MicrogramPerSecond), MicrogramsPerSecondTolerance);
Assert.AreEqual(MilligramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.MilligramPerSecond), MilligramsPerSecondTolerance);
Expand All @@ -116,6 +121,7 @@ public void ConversionRoundTrip()
Assert.AreEqual(1, MassFlow.FromDecigramsPerSecond(grampersecond.DecigramsPerSecond).GramsPerSecond, DecigramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.FromGramsPerSecond(grampersecond.GramsPerSecond).GramsPerSecond, GramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.FromHectogramsPerSecond(grampersecond.HectogramsPerSecond).GramsPerSecond, HectogramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.FromKilogramsPerHour(grampersecond.KilogramsPerHour).GramsPerSecond, KilogramsPerHourTolerance);
Assert.AreEqual(1, MassFlow.FromKilogramsPerSecond(grampersecond.KilogramsPerSecond).GramsPerSecond, KilogramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.FromMicrogramsPerSecond(grampersecond.MicrogramsPerSecond).GramsPerSecond, MicrogramsPerSecondTolerance);
Assert.AreEqual(1, MassFlow.FromMilligramsPerSecond(grampersecond.MilligramsPerSecond).GramsPerSecond, MilligramsPerSecondTolerance);
Expand Down
1 change: 1 addition & 0 deletions UnitsNet/GeneratedCode/Enums/MassFlowUnit.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public enum MassFlowUnit
DecigramPerSecond,
GramPerSecond,
HectogramPerSecond,
KilogramPerHour,
KilogramPerSecond,
MicrogramPerSecond,
MilligramPerSecond,
Expand Down
37 changes: 37 additions & 0 deletions UnitsNet/GeneratedCode/UnitClasses/MassFlow.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ public double HectogramsPerSecond
get { return (_gramsPerSecond) / 1e2d; }
}

/// <summary>
/// Get MassFlow in KilogramsPerHour.
/// </summary>
public double KilogramsPerHour
{
get { return _gramsPerSecond/0.277778; }
}

/// <summary>
/// Get MassFlow in KilogramsPerSecond.
/// </summary>
Expand Down Expand Up @@ -222,6 +230,14 @@ public static MassFlow FromHectogramsPerSecond(double hectogramspersecond)
return new MassFlow((hectogramspersecond) * 1e2d);
}

/// <summary>
/// Get MassFlow from KilogramsPerHour.
/// </summary>
public static MassFlow FromKilogramsPerHour(double kilogramsperhour)
{
return new MassFlow(kilogramsperhour*0.277778);
}

/// <summary>
/// Get MassFlow from KilogramsPerSecond.
/// </summary>
Expand Down Expand Up @@ -338,6 +354,21 @@ public static MassFlow FromTonnesPerDay(double tonnesperday)
}
}

/// <summary>
/// Get nullable MassFlow from nullable KilogramsPerHour.
/// </summary>
public static MassFlow? FromKilogramsPerHour(double? kilogramsperhour)
{
if (kilogramsperhour.HasValue)
{
return FromKilogramsPerHour(kilogramsperhour.Value);
}
else
{
return null;
}
}

/// <summary>
/// Get nullable MassFlow from nullable KilogramsPerSecond.
/// </summary>
Expand Down Expand Up @@ -435,6 +466,8 @@ public static MassFlow From(double val, MassFlowUnit fromUnit)
return FromGramsPerSecond(val);
case MassFlowUnit.HectogramPerSecond:
return FromHectogramsPerSecond(val);
case MassFlowUnit.KilogramPerHour:
return FromKilogramsPerHour(val);
case MassFlowUnit.KilogramPerSecond:
return FromKilogramsPerSecond(val);
case MassFlowUnit.MicrogramPerSecond:
Expand Down Expand Up @@ -476,6 +509,8 @@ public static MassFlow From(double val, MassFlowUnit fromUnit)
return FromGramsPerSecond(value.Value);
case MassFlowUnit.HectogramPerSecond:
return FromHectogramsPerSecond(value.Value);
case MassFlowUnit.KilogramPerHour:
return FromKilogramsPerHour(value.Value);
case MassFlowUnit.KilogramPerSecond:
return FromKilogramsPerSecond(value.Value);
case MassFlowUnit.MicrogramPerSecond:
Expand Down Expand Up @@ -650,6 +685,8 @@ public double As(MassFlowUnit unit)
return GramsPerSecond;
case MassFlowUnit.HectogramPerSecond:
return HectogramsPerSecond;
case MassFlowUnit.KilogramPerHour:
return KilogramsPerHour;
case MassFlowUnit.KilogramPerSecond:
return KilogramsPerSecond;
case MassFlowUnit.MicrogramPerSecond:
Expand Down
6 changes: 6 additions & 0 deletions UnitsNet/GeneratedCode/UnitSystem.Default.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,12 @@ private static readonly ReadOnlyCollection<UnitLocalization> DefaultLocalization
{
new AbbreviationsForCulture("en-US", "hg/S"),
}),
new CulturesForEnumValue((int) MassFlowUnit.KilogramPerHour,
new[]
{
new AbbreviationsForCulture("en-US", "kg/h"),
new AbbreviationsForCulture("ru-RU", "кг/ч"),
}),
new CulturesForEnumValue((int) MassFlowUnit.KilogramPerSecond,
new[]
{
Expand Down
18 changes: 17 additions & 1 deletion UnitsNet/Scripts/UnitDefinitions/MassFlow.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"Name": "MassFlow",
"BaseUnit": "GramPerSecond",
"XmlDoc": "Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time).",
Expand All @@ -16,6 +16,22 @@
}
]
},
{
"SingularName": "KilogramPerHour",
"PluralName": "KilogramsPerHour",
"FromUnitToBaseFunc": "x*0.277778",
"FromBaseToUnitFunc": "x/0.277778",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "kg/h" ]
},
{
"Culture": "ru-RU",
"Abbreviations": [ "кг/ч" ]
}
]
},
{
"SingularName": "TonnePerDay",
"PluralName": "TonnesPerDay",
Expand Down

2 comments on commit ac3e270

@angularsen
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Units.NET :: CI Build 102 is now running

@angularsen
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Units.NET :: CI Build 102 outcome was SUCCESS
Summary: Tests passed: 803 Build time: 0:0:36

Please sign in to comment.