Skip to content

Commit bf87f92

Browse files
authored
Merge pull request #595 from tongbong/features/add-GramsPerHour
Add unit GramsPerHour
2 parents 02098b2 + ee040c0 commit bf87f92

File tree

7 files changed

+67
-6
lines changed

7 files changed

+67
-6
lines changed

Common/UnitDefinitions/MassFlow.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@
3333
}
3434
]
3535
},
36+
{
37+
"SingularName": "GramPerHour",
38+
"PluralName": "GramsPerHour",
39+
"FromUnitToBaseFunc": "x/3600",
40+
"FromBaseToUnitFunc": "x*3600",
41+
"Localization": [
42+
{
43+
"Culture": "en-US",
44+
"Abbreviations": [ "g/h" ]
45+
}
46+
]
47+
},
3648
{
3749
"SingularName": "KilogramPerHour",
3850
"PluralName": "KilogramsPerHour",
@@ -104,7 +116,7 @@
104116
}
105117
]
106118
},
107-
{
119+
{
108120
"SingularName": "PoundPerMinute",
109121
"PluralName": "PoundsPerMinute",
110122
"FromUnitToBaseFunc": "x/0.132277",

UnitsNet.Tests/CustomCode/MassFlowTests.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ namespace UnitsNet.Tests.CustomCode
2626
{
2727
public class MassFlowTests : MassFlowTestsBase
2828
{
29+
/// <inheritdoc />
2930
protected override double GramsPerSecondInOneGramPerSecond => 1;
3031

3132
protected override double DecagramsPerSecondInOneGramPerSecond => 1E-1;
@@ -52,7 +53,7 @@ public class MassFlowTests : MassFlowTestsBase
5253

5354
protected override double ShortTonsPerHourInOneGramPerSecond => 3.96832e-3;
5455

55-
protected override double TonnesPerDayInOneGramPerSecond => 60.0*60*24/1E6;
56+
protected override double TonnesPerDayInOneGramPerSecond => 60.0 * 60 * 24 / 1E6;
5657

5758
protected override double PoundsPerHourInOneGramPerSecond => 7.93664;
5859

@@ -86,31 +87,34 @@ public class MassFlowTests : MassFlowTestsBase
8687

8788
protected override double PoundsPerDayInOneGramPerSecond => 1.9047936e2;
8889

90+
protected override double GramsPerHourInOneGramPerSecond => 3600;
91+
92+
8993
[Fact]
9094
public void DurationTimesMassFlowEqualsMass()
9195
{
92-
Mass mass = Duration.FromSeconds(4.0)*MassFlow.FromKilogramsPerSecond(20.0);
96+
Mass mass = Duration.FromSeconds(4.0) * MassFlow.FromKilogramsPerSecond(20.0);
9397
Assert.Equal(mass, Mass.FromKilograms(80.0));
9498
}
9599

96100
[Fact]
97101
public void MassFlowTimesDurationEqualsMass()
98102
{
99-
Mass mass = MassFlow.FromKilogramsPerSecond(20.0)*Duration.FromSeconds(4.0);
103+
Mass mass = MassFlow.FromKilogramsPerSecond(20.0) * Duration.FromSeconds(4.0);
100104
Assert.Equal(mass, Mass.FromKilograms(80.0));
101105
}
102106

103107
[Fact]
104108
public void MassFlowTimesTimeSpanEqualsMass()
105109
{
106-
Mass mass = MassFlow.FromKilogramsPerSecond(20.0)*TimeSpan.FromSeconds(4.0);
110+
Mass mass = MassFlow.FromKilogramsPerSecond(20.0) * TimeSpan.FromSeconds(4.0);
107111
Assert.Equal(mass, Mass.FromKilograms(80.0));
108112
}
109113

110114
[Fact]
111115
public void TimeSpanTimesMassFlowEqualsMass()
112116
{
113-
Mass mass = TimeSpan.FromSeconds(4.0)*MassFlow.FromKilogramsPerSecond(20.0);
117+
Mass mass = TimeSpan.FromSeconds(4.0) * MassFlow.FromKilogramsPerSecond(20.0);
114118
Assert.Equal(mass, Mass.FromKilograms(80.0));
115119
}
116120

UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)