File tree Expand file tree Collapse file tree 8 files changed +137
-1
lines changed
UnitsNet/CustomCode/Quantities
UnitsNet.Tests/CustomCode Expand file tree Collapse file tree 8 files changed +137
-1
lines changed Original file line number Diff line number Diff line change 23
23
24
24
using System ;
25
25
26
+ using Xunit ;
27
+
26
28
namespace UnitsNet . Tests . CustomCode
27
29
{
28
30
public class ElectricCurrentGradientTests : ElectricCurrentGradientTestsBase
@@ -36,5 +38,19 @@ public class ElectricCurrentGradientTests : ElectricCurrentGradientTestsBase
36
38
protected override double AmperesPerMinuteInOneAmperePerSecond => 60 ;
37
39
protected override double MilliamperesPerMinuteInOneAmperePerSecond => 6e4 ;
38
40
protected override double MilliamperesPerSecondInOneAmperePerSecond => 1e3 ;
41
+
42
+ [ Fact ]
43
+ public void ElectricCurrentGradientTimesDurationEqualsElectricCurrent ( )
44
+ {
45
+ ElectricCurrent electricCurrent = ElectricCurrentGradient . FromAmperesPerSecond ( 10 ) * Duration . FromSeconds ( 2 ) ;
46
+ Assert . Equal ( ElectricCurrent . FromAmperes ( 20 ) , electricCurrent ) ;
47
+ }
48
+
49
+ [ Fact ]
50
+ public void ElectricCurrentGradientTimesTimeSpanEqualsElectricCurrent ( )
51
+ {
52
+ ElectricCurrent electricCurrent = ElectricCurrentGradient . FromAmperesPerSecond ( 10 ) * TimeSpan . FromSeconds ( 2 ) ;
53
+ Assert . Equal ( ElectricCurrent . FromAmperes ( 20 ) , electricCurrent ) ;
54
+ }
39
55
}
40
56
}
Original file line number Diff line number Diff line change 1
1
// Licensed under MIT No Attribution, see LICENSE file at the root.
2
2
// Copyright 2013 Andreas Gullberg Larsen ([email protected] ). Maintained at https://github.com/angularsen/UnitsNet.
3
3
4
+ using System ;
5
+
4
6
using Xunit ;
5
7
6
8
namespace UnitsNet . Tests
@@ -52,5 +54,19 @@ public void ElectricCurrentMultipliedByDurationEqualsElectricCharge()
52
54
ElectricCharge ah = ElectricCurrent . FromAmperes ( 4 ) * Duration . FromHours ( 5 ) ;
53
55
Assert . Equal ( 20 , ah . AmpereHours ) ;
54
56
}
57
+
58
+ [ Fact ]
59
+ public void ElectricCurrentDividedByDurationEqualsElectricCurrentGradient ( )
60
+ {
61
+ ElectricCurrentGradient electricCurrentGradient = ElectricCurrent . FromAmperes ( 10 ) / Duration . FromSeconds ( 2 ) ;
62
+ Assert . Equal ( ElectricCurrentGradient . FromAmperesPerSecond ( 5 ) , electricCurrentGradient ) ;
63
+ }
64
+
65
+ [ Fact ]
66
+ public void ElectricCurrentDividedByTimeSpanEqualsElectricCurrentGradient ( )
67
+ {
68
+ ElectricCurrentGradient electricCurrentGradient = ElectricCurrent . FromAmperes ( 10 ) / TimeSpan . FromSeconds ( 2 ) ;
69
+ Assert . Equal ( ElectricCurrentGradient . FromAmperesPerSecond ( 5 ) , electricCurrentGradient ) ;
70
+ }
55
71
}
56
72
}
Original file line number Diff line number Diff line change 1
1
// Licensed under MIT No Attribution, see LICENSE file at the root.
2
2
// Copyright 2013 Andreas Gullberg Larsen ([email protected] ). Maintained at https://github.com/angularsen/UnitsNet.
3
3
4
+ using System ;
5
+
6
+ using Xunit ;
7
+
4
8
namespace UnitsNet . Tests
5
9
{
6
10
public class PressureChangeRateTests : PressureChangeRateTestsBase
7
11
{
8
12
protected override bool SupportsSIUnitSystem => false ;
9
- protected override double AtmospheresPerSecondInOnePascalPerSecond => 9.8692 * 1E-6 ;
13
+ protected override double AtmospheresPerSecondInOnePascalPerSecond => 9.8692 * 1E-6 ;
10
14
11
15
protected override double KilopascalsPerSecondInOnePascalPerSecond => 1e-3 ;
12
16
@@ -41,5 +45,19 @@ public class PressureChangeRateTests : PressureChangeRateTestsBase
41
45
protected override double MillibarsPerMinuteInOnePascalPerSecond => 0.6 ;
42
46
43
47
protected override double MillibarsPerSecondInOnePascalPerSecond => 1e-2 ;
48
+
49
+ [ Fact ]
50
+ public void PressureChangeRateTimesDurationEqualsPressure ( )
51
+ {
52
+ Pressure pressure = PressureChangeRate . FromPascalsPerSecond ( 500 ) * Duration . FromSeconds ( 2 ) ;
53
+ Assert . Equal ( Pressure . FromPascals ( 1000 ) , pressure ) ;
54
+ }
55
+
56
+ [ Fact ]
57
+ public void PressureChangeRateTimesTimeSpanEqualsPressure ( )
58
+ {
59
+ Pressure pressure = PressureChangeRate . FromPascalsPerSecond ( 500 ) * TimeSpan . FromSeconds ( 2 ) ;
60
+ Assert . Equal ( Pressure . FromPascals ( 1000 ) , pressure ) ;
61
+ }
44
62
}
45
63
}
Original file line number Diff line number Diff line change @@ -248,5 +248,19 @@ public void PressureDividedByReciprocalAreaEqualsForce()
248
248
Force force = Pressure . FromPascals ( 200 ) / ReciprocalArea . FromInverseSquareMeters ( 5 ) ;
249
249
Assert . Equal ( force , Force . FromNewtons ( 40 ) ) ;
250
250
}
251
+
252
+ [ Fact ]
253
+ public void PressureDividedByDurationEqualsPressureChangeRate ( )
254
+ {
255
+ PressureChangeRate pressureChangeRate = Pressure . FromPascals ( 500 ) / Duration . FromSeconds ( 2 ) ;
256
+ Assert . Equal ( PressureChangeRate . FromPascalsPerSecond ( 250 ) , pressureChangeRate ) ;
257
+ }
258
+
259
+ [ Fact ]
260
+ public void PressureDividedByTimeSpanEqualsPressurechangeRate ( )
261
+ {
262
+ PressureChangeRate pressureChangeRate = Pressure . FromPascals ( 50 ) / TimeSpan . FromSeconds ( 5 ) ;
263
+ Assert . Equal ( PressureChangeRate . FromPascalsPerSecond ( 10 ) , pressureChangeRate ) ;
264
+ }
251
265
}
252
266
}
Original file line number Diff line number Diff line change 1
1
// Licensed under MIT No Attribution, see LICENSE file at the root.
2
2
// Copyright 2013 Andreas Gullberg Larsen ([email protected] ). Maintained at https://github.com/angularsen/UnitsNet.
3
3
4
+ using System ;
5
+
4
6
namespace UnitsNet
5
7
{
6
8
public partial struct ElectricCurrent
@@ -24,5 +26,17 @@ public partial struct ElectricCurrent
24
26
{
25
27
return ElectricCharge . FromAmpereHours ( current . Amperes * time . Hours ) ;
26
28
}
29
+
30
+ /// <summary>Get <see cref="ElectricCurrentGradient"/> from <see cref="ElectricCurrent"/> divided by <see cref="Duration"/>.</summary>
31
+ public static ElectricCurrentGradient operator / ( ElectricCurrent current , Duration duration )
32
+ {
33
+ return ElectricCurrentGradient . FromAmperesPerSecond ( current . Amperes / duration . Seconds ) ;
34
+ }
35
+
36
+ /// <summary>Get <see cref="ElectricCurrentGradient"/> from <see cref="ElectricCurrent"/> divided by <see cref="TimeSpan"/>.</summary>
37
+ public static ElectricCurrentGradient operator / ( ElectricCurrent current , TimeSpan timeSpan )
38
+ {
39
+ return ElectricCurrentGradient . FromAmperesPerSecond ( current . Amperes / timeSpan . TotalSeconds ) ;
40
+ }
27
41
}
28
42
}
Original file line number Diff line number Diff line change
1
+ // Licensed under MIT No Attribution, see LICENSE file at the root.
2
+ // Copyright 2013 Andreas Gullberg Larsen ([email protected] ). Maintained at https://github.com/angularsen/UnitsNet.
3
+
4
+ using System ;
5
+
6
+ namespace UnitsNet
7
+ {
8
+ public partial struct ElectricCurrentGradient
9
+ {
10
+ /// <summary>Get <see cref="ElectricCurrent"/> from <see cref="ElectricCurrentGradient"/> times <see cref="Duration"/>.</summary>
11
+ public static ElectricCurrent operator * ( ElectricCurrentGradient currentGradient , Duration duration )
12
+ {
13
+ return ElectricCurrent . FromAmperes ( currentGradient . AmperesPerSecond * duration . Seconds ) ;
14
+ }
15
+
16
+ /// <summary>Get <see cref="ElectricCurrent"/> from <see cref="ElectricCurrentGradient"/> times <see cref="TimeSpan"/>.</summary>
17
+ public static ElectricCurrent operator * ( ElectricCurrentGradient currentGradient , TimeSpan timeSpan )
18
+ {
19
+ return ElectricCurrent . FromAmperes ( currentGradient . AmperesPerSecond * timeSpan . TotalSeconds ) ;
20
+ }
21
+ }
22
+ }
Original file line number Diff line number Diff line change 1
1
// Licensed under MIT No Attribution, see LICENSE file at the root.
2
2
// Copyright 2013 Andreas Gullberg Larsen ([email protected] ). Maintained at https://github.com/angularsen/UnitsNet.
3
3
4
+ using System ;
5
+
4
6
namespace UnitsNet
5
7
{
6
8
public partial struct Pressure
@@ -40,5 +42,17 @@ public partial struct Pressure
40
42
{
41
43
return new Force ( pressure . Pascals / reciprocalArea . InverseSquareMeters , UnitsNet . Units . ForceUnit . Newton ) ;
42
44
}
45
+
46
+ /// <summary>Get <see cref="PressureChangeRate"/> from <see cref="Pressure"/> divided by <see cref="TimeSpan"/> </summary>
47
+ public static PressureChangeRate operator / ( Pressure pressure , TimeSpan timeSpan )
48
+ {
49
+ return new PressureChangeRate ( pressure . Pascals / timeSpan . TotalSeconds , UnitsNet . Units . PressureChangeRateUnit . PascalPerSecond ) ;
50
+ }
51
+
52
+ /// <summary>Get <see cref="PressureChangeRate"/> from <see cref="Pressure"/> divided by <see cref="Duration"/> </summary>
53
+ public static PressureChangeRate operator / ( Pressure pressure , Duration duration )
54
+ {
55
+ return new PressureChangeRate ( pressure . Pascals / duration . Seconds , UnitsNet . Units . PressureChangeRateUnit . PascalPerSecond ) ;
56
+ }
43
57
}
44
58
}
Original file line number Diff line number Diff line change
1
+ // Licensed under MIT No Attribution, see LICENSE file at the root.
2
+ // Copyright 2013 Andreas Gullberg Larsen ([email protected] ). Maintained at https://github.com/angularsen/UnitsNet.
3
+
4
+ using System ;
5
+
6
+ namespace UnitsNet
7
+ {
8
+ public partial struct PressureChangeRate
9
+ {
10
+ /// <summary>Get <see cref="Pressure"/> from <see cref="PressureChangeRate"/> times <see cref="TimeSpan"/> </summary>
11
+ public static Pressure operator * ( PressureChangeRate pressureChangeRate , TimeSpan timeSpan )
12
+ {
13
+ return new Pressure ( pressureChangeRate . PascalsPerSecond * timeSpan . TotalSeconds , UnitsNet . Units . PressureUnit . Pascal ) ;
14
+ }
15
+
16
+ /// <summary>Get <see cref="Pressure"/> from <see cref="PressureChangeRate"/> times <see cref="Duration"/> </summary>
17
+ public static Pressure operator * ( PressureChangeRate pressureChangeRate , Duration duration )
18
+ {
19
+ return new Pressure ( pressureChangeRate . PascalsPerSecond * duration . Seconds , UnitsNet . Units . PressureUnit . Pascal ) ;
20
+ }
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments