Skip to content

Commit cdd3173

Browse files
committed
Merge branch 'feature/bijan86-units' into develop
Breaking changes: * Torque: Rename Newtonmeter to NewtonMeter * Torque: Change "Nm" abbreviation to "N·m" * Force: Rename PoundForces to PoundsForce Add units --- SpecificWeight * KilogramForcePerCubicCentimeter * KilogramForcePerCubicMeter * KilogramForcePerCubicMillimeter * KilonewtonPerCubicCentimeter * KilonewtonPerCubicMeter * KilonewtonPerCubicMillimeter * KilopoundForcePerCubicFoot * KilopoundForcePerCubicInch * NewtonPerCubicCentimeter * NewtonPerCubicMeter * NewtonPerCubicMillimeter * PoundForcePerCubicFoot * PoundForcePerCubicInch * TonneForcePerCubicCentimeter * TonneForcePerCubicMeter * TonneForcePerCubicMillimeter Update units --- Density: * KilogramPerCubicCentimeter * KilogramPerCubicMillimeter * KilopoundPerCubicFoot * KilopoundPerCubicInch * PoundPerCubicFoot * PoundPerCubicInch * TonnePerCubicCentimeter * TonnePerCubicMeter * TonnePerCubicMillimeter Force: * Add TonneForce Pressure: * KilogramForcePerSquareMeter * KilogramForcePerSquareMillimeter * KilonewtonPerSquareCentimeter * KilonewtonPerSquareMeter * KilonewtonPerSquareMillimeter * KilopoundForcePerSquareFoot * KilopoundForcePerSquareInch * PoundForcePerSquareFoot * PoundForcePerSquareInch * TonneForcePerSquareCentimeter * TonneForcePerSquareMeter * TonneForcePerSquareMillimeter * Torque: * KilogramForceCentimeter * KilogramForceMeter * KilogramForceMillimeter * KilonewtonCentimeter * KilonewtonMeter * KilonewtonMillimeter * KilopoundForceFoot * KilopoundForceInch * NewtonCentimeter * NewtonMeter * NewtonMillimeter * PoundForceFoot * PoundForceInch * TonneForceCentimeter * TonneForceMeter * TonneForceMillimeter
2 parents 7c8d269 + 46a21e5 commit cdd3173

28 files changed

+3184
-189
lines changed

UnitsNet.Tests/CustomCode/DensityTests.cs

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,58 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2020
// THE SOFTWARE.
2121

22-
23-
using System;
24-
2522
namespace UnitsNet.Tests.CustomCode
2623
{
2724
public class DensityTests : DensityTestsBase
2825
{
29-
#region Overrides of DensityTestsBase
26+
protected override double KilogramsPerCubicCentimeterInOneKilogramPerCubicMeter
27+
{
28+
get { return 1e-6; }
29+
}
3030

31-
protected override double KilogramPerCubicMeterInOneKilogramPerCubicMeter
31+
protected override double KilogramsPerCubicMeterInOneKilogramPerCubicMeter
3232
{
3333
get { return 1; }
3434
}
3535

36-
#endregion
36+
protected override double KilogramsPerCubicMillimeterInOneKilogramPerCubicMeter
37+
{
38+
get { return 1e-9; }
39+
}
40+
41+
protected override double KilopoundsPerCubicFootInOneKilogramPerCubicMeter
42+
{
43+
get { return 6.242796e-5; }
44+
}
45+
46+
protected override double KilopoundsPerCubicInchInOneKilogramPerCubicMeter
47+
{
48+
get { return 3.6127292e-8; }
49+
}
50+
51+
protected override double PoundsPerCubicFootInOneKilogramPerCubicMeter
52+
{
53+
get { return 6.242796e-2; }
54+
}
55+
56+
protected override double PoundsPerCubicInchInOneKilogramPerCubicMeter
57+
{
58+
get { return 3.61272923e-5; }
59+
}
60+
61+
protected override double TonnesPerCubicCentimeterInOneKilogramPerCubicMeter
62+
{
63+
get { return 1e-9; }
64+
}
65+
66+
protected override double TonnesPerCubicMeterInOneKilogramPerCubicMeter
67+
{
68+
get { return 1e-3; }
69+
}
70+
71+
protected override double TonnesPerCubicMillimeterInOneKilogramPerCubicMeter
72+
{
73+
get { return 1e-12; }
74+
}
3775
}
38-
}
76+
}

UnitsNet.Tests/CustomCode/ForceTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ protected override double PoundalsInOneNewton
5353
get { return 7.23301; }
5454
}
5555

56-
protected override double PoundForcesInOneNewton
56+
protected override double PoundsForceInOneNewton
5757
{
5858
get { return 0.22481; }
5959
}
60+
61+
protected override double TonnesForceInOneNewton
62+
{
63+
get { return 1.02e-4; }
64+
}
6065
}
6166
}

UnitsNet.Tests/CustomCode/PressureTests.cs

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,47 @@ protected override double BarsInOnePascal
3535

3636
protected override double KilogramsForcePerSquareCentimeterInOnePascal
3737
{
38-
get { return 1/98066.5; }
38+
get { return 0.101971621e-5; }
39+
}
40+
41+
protected override double KilogramsForcePerSquareMeterInOnePascal
42+
{
43+
get { return 0.101971621; }
44+
}
45+
46+
protected override double KilogramsForcePerSquareMillimeterInOnePascal
47+
{
48+
get { return 0.101971621e-7; }
49+
}
50+
51+
protected override double KilonewtonsPerSquareCentimeterInOnePascal
52+
{
53+
get { return 1e-7; }
54+
}
55+
56+
protected override double KilonewtonsPerSquareMeterInOnePascal
57+
{
58+
get { return 0.001; }
59+
}
60+
61+
protected override double KilonewtonsPerSquareMillimeterInOnePascal
62+
{
63+
get { return 1e-9; }
3964
}
4065

4166
protected override double KilopascalsInOnePascal
4267
{
43-
get { return 1E-3; }
68+
get { return 1e-3; }
69+
}
70+
71+
protected override double KilopoundsForcePerSquareFootInOnePascal
72+
{
73+
get { return 2.089e-5; }
74+
}
75+
76+
protected override double KilopoundsForcePerSquareInchInOnePascal
77+
{
78+
get { return 1.45e-7; }
4479
}
4580

4681
protected override double MegapascalsInOnePascal
@@ -68,6 +103,16 @@ protected override double PascalsInOnePascal
68103
get { return 1; }
69104
}
70105

106+
protected override double PoundsForcePerSquareFootInOnePascal
107+
{
108+
get { return 0.0208854342; }
109+
}
110+
111+
protected override double PoundsForcePerSquareInchInOnePascal
112+
{
113+
get { return 0.000145037738; }
114+
}
115+
71116
protected override double PsiInOnePascal
72117
{
73118
get { return 1.450377*1E-4; }
@@ -78,6 +123,21 @@ protected override double TechnicalAtmospheresInOnePascal
78123
get { return 1.0197*1E-5; }
79124
}
80125

126+
protected override double TonnesForcePerSquareCentimeterInOnePascal
127+
{
128+
get { return 1e-8; }
129+
}
130+
131+
protected override double TonnesForcePerSquareMeterInOnePascal
132+
{
133+
get { return 1e-4; }
134+
}
135+
136+
protected override double TonnesForcePerSquareMillimeterInOnePascal
137+
{
138+
get { return 1e-10; }
139+
}
140+
81141
protected override double TorrsInOnePascal
82142
{
83143
get { return 7.5006*1E-3; }
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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+
namespace UnitsNet.Tests.CustomCode
23+
{
24+
public class SpecificWeightTests : SpecificWeightTestsBase
25+
{
26+
protected override double KilogramsForcePerCubicCentimeterInOneNewtonPerCubicMeter
27+
{
28+
get { return 0.101971621e-7; }
29+
}
30+
31+
protected override double KilogramsForcePerCubicMeterInOneNewtonPerCubicMeter
32+
{
33+
get { return 0.101971621; }
34+
}
35+
36+
protected override double KilogramsForcePerCubicMillimeterInOneNewtonPerCubicMeter
37+
{
38+
get { return 0.101971621e-10; }
39+
}
40+
41+
protected override double KilonewtonsPerCubicCentimeterInOneNewtonPerCubicMeter
42+
{
43+
get { return 1e-9; }
44+
}
45+
46+
protected override double KilonewtonsPerCubicMeterInOneNewtonPerCubicMeter
47+
{
48+
get { return 1e-3; }
49+
}
50+
51+
protected override double KilonewtonsPerCubicMillimeterInOneNewtonPerCubicMeter
52+
{
53+
get { return 1e-12; }
54+
}
55+
56+
protected override double KilopoundsForcePerCubicFootInOneNewtonPerCubicMeter
57+
{
58+
get { return 6.366e-6; }
59+
}
60+
61+
protected override double KilopoundsForcePerCubicInchInOneNewtonPerCubicMeter
62+
{
63+
get { return 3.684e-9; }
64+
}
65+
66+
protected override double NewtonsPerCubicCentimeterInOneNewtonPerCubicMeter
67+
{
68+
get { return 1e-6; }
69+
}
70+
71+
protected override double NewtonsPerCubicMeterInOneNewtonPerCubicMeter
72+
{
73+
get { return 1; }
74+
}
75+
76+
protected override double NewtonsPerCubicMillimeterInOneNewtonPerCubicMeter
77+
{
78+
get { return 1e-9; }
79+
}
80+
81+
protected override double PoundsForcePerCubicFootInOneNewtonPerCubicMeter
82+
{
83+
get { return 0.006366; }
84+
}
85+
86+
protected override double PoundsForcePerCubicInchInOneNewtonPerCubicMeter
87+
{
88+
get { return 3.684e-6; }
89+
}
90+
91+
protected override double TonnesForcePerCubicCentimeterInOneNewtonPerCubicMeter
92+
{
93+
get { return 1.02e-13; }
94+
}
95+
96+
protected override double TonnesForcePerCubicMeterInOneNewtonPerCubicMeter
97+
{
98+
get { return 1.02e-4; }
99+
}
100+
101+
protected override double TonnesForcePerCubicMillimeterInOneNewtonPerCubicMeter
102+
{
103+
get { return 1.02e-10; }
104+
}
105+
}
106+
}

UnitsNet.Tests/CustomCode/TorqueTests.cs

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,84 @@ namespace UnitsNet.Tests.CustomCode
2323
{
2424
public class TorqueTests : TorqueTestsBase
2525
{
26-
protected override double NewtonmetersInOneNewtonmeter
26+
protected override double KilogramForceCentimetersInOneNewtonMeter
27+
{
28+
get { return 10.1971621; }
29+
}
30+
31+
protected override double KilogramForceMetersInOneNewtonMeter
32+
{
33+
get { return 0.101971621; }
34+
}
35+
36+
protected override double KilogramForceMillimetersInOneNewtonMeter
37+
{
38+
get { return 101.971621; }
39+
}
40+
41+
protected override double KilonewtonCentimetersInOneNewtonMeter
42+
{
43+
get { return 0.1; }
44+
}
45+
46+
protected override double KilonewtonMetersInOneNewtonMeter
47+
{
48+
get { return 0.001; }
49+
}
50+
51+
protected override double KilonewtonMillimetersInOneNewtonMeter
52+
{
53+
get { return 1; }
54+
}
55+
56+
protected override double KilopoundForceFeetInOneNewtonMeter
57+
{
58+
get { return 7.376e-4; }
59+
}
60+
61+
protected override double KilopoundForceInchesInOneNewtonMeter
62+
{
63+
get { return 0.008851; }
64+
}
65+
66+
protected override double NewtonCentimetersInOneNewtonMeter
67+
{
68+
get { return 100; }
69+
}
70+
71+
protected override double NewtonMetersInOneNewtonMeter
2772
{
2873
get { return 1; }
2974
}
75+
76+
protected override double NewtonMillimetersInOneNewtonMeter
77+
{
78+
get { return 1000; }
79+
}
80+
81+
protected override double PoundForceFeetInOneNewtonMeter
82+
{
83+
get { return 0.737562149277; }
84+
}
85+
86+
protected override double PoundForceInchesInOneNewtonMeter
87+
{
88+
get { return 8.85074579; }
89+
}
90+
91+
protected override double TonneForceCentimetersInOneNewtonMeter
92+
{
93+
get { return 1.01972e-2; }
94+
}
95+
96+
protected override double TonneForceMetersInOneNewtonMeter
97+
{
98+
get { return 1.01972e-4; }
99+
}
100+
101+
protected override double TonneForceMillimetersInOneNewtonMeter
102+
{
103+
get { return 1.01972e-1; }
104+
}
30105
}
31106
}

0 commit comments

Comments
 (0)