Skip to content

Commit 87a1505

Browse files
author
Erik Ovegard
committed
Merge branch 'master' into feature/operator-overloading
2 parents 8f98287 + 93d7fdb commit 87a1505

24 files changed

+944
-47
lines changed

Build/UnitsNet.nuspec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>UnitsNet</id>
5-
<version>3.19.2</version>
5+
<version>3.22.0</version>
66
<title>Units.NET</title>
77
<authors>Andreas Gullberg Larsen</authors>
88
<owners>Andreas Gullberg Larsen</owners>
@@ -13,7 +13,13 @@
1313
<summary>Simplifies working with units of measurement.</summary>
1414
<iconUrl>https://raw.githubusercontent.com/anjdreas/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png</iconUrl>
1515
<releaseNotes>
16-
* Make UnitSystem thread-safe (@istanishev)
16+
* Add MassFlow units: KilogramPerSecond, TonnePerDay (@eriove)
17+
* Add 8 SpecificEnergy units (@eriove)
18+
* Add Angle units: Arcminute, ArcSecond (@eriove)
19+
* Add Frequency units: RadianPerSecond (@eriove)
20+
* Add Length units: NauticalMile (@eriove)
21+
* Add RotationalSpeed units: RadianPerSecond (@eriove)
22+
* Add Speed units: MeterPerHour (@eriove)
1723
</releaseNotes>
1824
<copyright>Copyright © 2015 Andreas Gullberg Larsen</copyright>
1925
<language>en-US</language>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,6 @@ Continuous Integration
144144
===
145145
A [TeamCity build server](http://dev.swingcatalyst.com/TeamCity/viewType.html?buildTypeId=UnitsNet&guest=1) performs the following:
146146
* Build and test pull requests. Notifies on success or error.
147-
* Build, test and publish nuget on commits to **stable** branch.
147+
* Build and test master branch.
148148

149149
[Contact me](https://github.com/anjdreas) if you have any questions.

UnitsNet.Tests/CustomCode/AngleTests.cs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ public void AngleDividedByTimeEqualsRotationalSpeed()
3333
Assert.AreEqual(rotationalSpeed, RotationalSpeed.FromRadiansPerSecond(2));
3434
}
3535

36+
protected override double DegreesInOneDegree
37+
{
38+
get { return 1; }
39+
}
40+
41+
protected override double GradiansInOneDegree
42+
{
43+
get { return 400 / 360.0; }
44+
}
45+
3646
protected override double ArcminutesInOneDegree
3747
{
3848
get
@@ -41,6 +51,11 @@ protected override double ArcminutesInOneDegree
4151
}
4252
}
4353

54+
protected override double RadiansInOneDegree
55+
{
56+
get { return Math.PI / 2 / 90; }
57+
}
58+
4459
protected override double ArcsecondsInOneDegree
4560
{
4661
get
@@ -49,21 +64,5 @@ protected override double ArcsecondsInOneDegree
4964
}
5065
}
5166

52-
protected override double DegreesInOneDegree
53-
{
54-
get { return 1; }
55-
}
56-
57-
protected override double GradiansInOneDegree
58-
{
59-
get { return 400/360.0; }
60-
}
61-
62-
63-
protected override double RadiansInOneDegree
64-
{
65-
get { return Math.PI/2/90; }
66-
}
67-
6867
}
6968
}

UnitsNet.Tests/CustomCode/FlowTests.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,33 @@ public class FlowTests : FlowTestsBase
2525
{
2626
protected override double CubicMetersPerHourInOneCubicMeterPerSecond
2727
{
28-
get { return 1*3600.0; }
28+
get { return 3600.0; }
2929
}
3030

3131
protected override double CubicFeetPerSecondInOneCubicMeterPerSecond
3232
{
33-
get { return 1*35.314666213; }
33+
get { return 35.314666213; }
3434
}
3535

3636
protected override double MillionUsGallonsPerDayInOneCubicMeterPerSecond
3737
{
38-
get { return 1*22.824465227; }
38+
get { return 22.824465227; }
3939
}
4040

4141
protected override double CubicMetersPerSecondInOneCubicMeterPerSecond
4242
{
4343
get { return 1; }
4444
}
4545

46-
46+
protected override double UsGallonsPerMinuteInOneCubicMeterPerSecond
47+
{
48+
get { return 15850.323141489; }
49+
}
50+
51+
protected override double LitersPerMinuteInOneCubicMeterPerSecond
52+
{
53+
get { return 60000.00000; }
54+
}
55+
4756
}
4857
}

UnitsNet.Tests/CustomCode/LengthTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ protected override double YardsInOneMeter
122122
protected override double NauticalMilesInOneMeter
123123
{
124124
get
125-
{ return 5.3996E-04; }
125+
{ return 1.0/1852.0; }
126126
}
127127

128128
}

UnitsNet.Tests/CustomCode/MassFlowTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected override double TonnesPerDayInOneKilogramPerSecond
5454
{
5555
get
5656
{
57-
return 1.0 / (60.0 * 60 * 24 / 1000);
57+
return (60.0 * 60 * 24 / 1000);
5858
}
5959
}
6060
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright © 2007 by Initial Force AS. All rights reserved.
2+
// https://github.com/InitialForce/UnitsNet
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in
12+
// all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
// THE SOFTWARE.
21+
22+
23+
using System;
24+
25+
namespace UnitsNet.Tests.CustomCode
26+
{
27+
public class PressureChangeRateTests : PressureChangeRateTestsBase
28+
{
29+
protected override double AtmospheresPerSecondInOnePascalPerSecond
30+
{
31+
get { return 9.8692 * 1E-6; }
32+
}
33+
34+
protected override double KilopascalsPerSecondInOnePascalPerSecond
35+
{
36+
get { return 1e-3; }
37+
}
38+
39+
protected override double MegapascalsPerSecondInOnePascalPerSecond
40+
{
41+
get { return 1E-6; }
42+
}
43+
44+
protected override double PascalsPerSecondInOnePascalPerSecond
45+
{
46+
get { return 1; }
47+
}
48+
}
49+
}

UnitsNet.Tests/CustomCode/SpecificEnergyTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace UnitsNet.Tests.CustomCode
2727
{
2828
public class SpecificEnergyTests : SpecificEnergyTestsBase
2929
{
30+
3031
[Test]
3132
public void SpecificEnergyTimesMassEqualsEnergy()
3233
{
@@ -41,7 +42,6 @@ public void MassTimesSpecificEnergyEqualsEnergy()
4142
}
4243

4344

44-
// TODO Override properties in base class here
4545
protected override double JoulesPerKilogramInOneJoulePerKilogram
4646
{
4747
get
@@ -57,6 +57,7 @@ protected override double CaloriesPerGramInOneJoulePerKilogram
5757
return 1.0 / (4.184E3);
5858
}
5959
}
60+
6061
protected override double KilocaloriesPerGramInOneJoulePerKilogram
6162
{
6263
get
@@ -65,6 +66,7 @@ protected override double KilocaloriesPerGramInOneJoulePerKilogram
6566
}
6667
}
6768

69+
6870
protected override double KilojoulesPerKilogramInOneJoulePerKilogram
6971
{
7072
get

UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,17 @@ public abstract partial class FlowTestsBase
3939
protected abstract double CubicFeetPerSecondInOneCubicMeterPerSecond { get; }
4040
protected abstract double CubicMetersPerHourInOneCubicMeterPerSecond { get; }
4141
protected abstract double CubicMetersPerSecondInOneCubicMeterPerSecond { get; }
42+
protected abstract double LitersPerMinuteInOneCubicMeterPerSecond { get; }
4243
protected abstract double MillionUsGallonsPerDayInOneCubicMeterPerSecond { get; }
44+
protected abstract double UsGallonsPerMinuteInOneCubicMeterPerSecond { get; }
4345

4446
// ReSharper disable VirtualMemberNeverOverriden.Global
4547
protected virtual double CubicFeetPerSecondTolerance { get { return 1e-5; } }
4648
protected virtual double CubicMetersPerHourTolerance { get { return 1e-5; } }
4749
protected virtual double CubicMetersPerSecondTolerance { get { return 1e-5; } }
50+
protected virtual double LitersPerMinuteTolerance { get { return 1e-5; } }
4851
protected virtual double MillionUsGallonsPerDayTolerance { get { return 1e-5; } }
52+
protected virtual double UsGallonsPerMinuteTolerance { get { return 1e-5; } }
4953
// ReSharper restore VirtualMemberNeverOverriden.Global
5054

5155
[Test]
@@ -55,7 +59,9 @@ public void CubicMeterPerSecondToFlowUnits()
5559
Assert.AreEqual(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerSecond, CubicFeetPerSecondTolerance);
5660
Assert.AreEqual(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerHour, CubicMetersPerHourTolerance);
5761
Assert.AreEqual(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerSecond, CubicMetersPerSecondTolerance);
62+
Assert.AreEqual(LitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.LitersPerMinute, LitersPerMinuteTolerance);
5863
Assert.AreEqual(MillionUsGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance);
64+
Assert.AreEqual(UsGallonsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.UsGallonsPerMinute, UsGallonsPerMinuteTolerance);
5965
}
6066

6167
[Test]
@@ -64,7 +70,9 @@ public void FromValueAndUnit()
6470
Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicFootPerSecond).CubicFeetPerSecond, CubicFeetPerSecondTolerance);
6571
Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicMeterPerHour).CubicMetersPerHour, CubicMetersPerHourTolerance);
6672
Assert.AreEqual(1, Flow.From(1, FlowUnit.CubicMeterPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance);
73+
Assert.AreEqual(1, Flow.From(1, FlowUnit.LitersPerMinute).LitersPerMinute, LitersPerMinuteTolerance);
6774
Assert.AreEqual(1, Flow.From(1, FlowUnit.MillionUsGallonsPerDay).MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance);
75+
Assert.AreEqual(1, Flow.From(1, FlowUnit.UsGallonsPerMinute).UsGallonsPerMinute, UsGallonsPerMinuteTolerance);
6876
}
6977

7078
[Test]
@@ -74,7 +82,9 @@ public void As()
7482
Assert.AreEqual(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicFootPerSecond), CubicFeetPerSecondTolerance);
7583
Assert.AreEqual(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerHour), CubicMetersPerHourTolerance);
7684
Assert.AreEqual(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerSecond), CubicMetersPerSecondTolerance);
85+
Assert.AreEqual(LitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.LitersPerMinute), LitersPerMinuteTolerance);
7786
Assert.AreEqual(MillionUsGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.MillionUsGallonsPerDay), MillionUsGallonsPerDayTolerance);
87+
Assert.AreEqual(UsGallonsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.UsGallonsPerMinute), UsGallonsPerMinuteTolerance);
7888
}
7989

8090
[Test]
@@ -84,7 +94,9 @@ public void ConversionRoundTrip()
8494
Assert.AreEqual(1, Flow.FromCubicFeetPerSecond(cubicmeterpersecond.CubicFeetPerSecond).CubicMetersPerSecond, CubicFeetPerSecondTolerance);
8595
Assert.AreEqual(1, Flow.FromCubicMetersPerHour(cubicmeterpersecond.CubicMetersPerHour).CubicMetersPerSecond, CubicMetersPerHourTolerance);
8696
Assert.AreEqual(1, Flow.FromCubicMetersPerSecond(cubicmeterpersecond.CubicMetersPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance);
97+
Assert.AreEqual(1, Flow.FromLitersPerMinute(cubicmeterpersecond.LitersPerMinute).CubicMetersPerSecond, LitersPerMinuteTolerance);
8798
Assert.AreEqual(1, Flow.FromMillionUsGallonsPerDay(cubicmeterpersecond.MillionUsGallonsPerDay).CubicMetersPerSecond, MillionUsGallonsPerDayTolerance);
99+
Assert.AreEqual(1, Flow.FromUsGallonsPerMinute(cubicmeterpersecond.UsGallonsPerMinute).CubicMetersPerSecond, UsGallonsPerMinuteTolerance);
88100
}
89101

90102
[Test]

UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,5 @@ public void EqualsReturnsFalseOnNull()
241241
Length meter = Length.FromMeters(1);
242242
Assert.IsFalse(meter.Equals(null));
243243
}
244-
245244
}
246245
}

0 commit comments

Comments
 (0)