File tree 2 files changed +28
-0
lines changed
UnitsNet/CustomCode/Quantities
UnitsNet.Tests/CustomCode 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -64,5 +64,19 @@ public void TemperatureDeltaTimesEntropyEqualsEnergy()
64
64
Energy energy = TemperatureDelta . FromKelvins ( 20 ) * Entropy . FromJoulesPerKelvin ( 4 ) ;
65
65
Assert . Equal ( Energy . FromJoules ( 80 ) , energy ) ;
66
66
}
67
+
68
+ [ Fact ]
69
+ public void TemperatureDeltaDividedByTimeSpanEqualsTemperatureChangeRate ( )
70
+ {
71
+ TemperatureChangeRate changeRate = TemperatureDelta . FromKelvins ( 20 ) / TimeSpan . FromSeconds ( 2 ) ;
72
+ Assert . Equal ( TemperatureChangeRate . FromDegreesCelsiusPerSecond ( 10 ) , changeRate ) ;
73
+ }
74
+
75
+ [ Fact ]
76
+ public void TemperatureDeltaDividedByDurationEqualsTemperatureChangeRate ( )
77
+ {
78
+ TemperatureChangeRate changeRate = TemperatureDelta . FromKelvins ( 20 ) / Duration . FromSeconds ( 2 ) ;
79
+ Assert . Equal ( TemperatureChangeRate . FromDegreesCelsiusPerSecond ( 10 ) , changeRate ) ;
80
+ }
67
81
}
68
82
}
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 TemperatureDelta
@@ -40,5 +42,17 @@ public partial struct TemperatureDelta
40
42
{
41
43
return temperatureDelta . Kelvins * cte . PerKelvin ;
42
44
}
45
+
46
+ /// <summary> Get <see cref="TemperatureChangeRate"/> from <see cref="TemperatureDelta"/> divided by <see cref="TimeSpan"/>.</summary>
47
+ public static TemperatureChangeRate operator / ( TemperatureDelta temperatureDelta , TimeSpan timespan )
48
+ {
49
+ return TemperatureChangeRate . FromDegreesCelsiusPerSecond ( temperatureDelta . Kelvins / timespan . TotalSeconds ) ;
50
+ }
51
+
52
+ /// <summary> Get <see cref="TemperatureChangeRate"/> from <see cref="TemperatureDelta"/> divided by <see cref="Duration"/>.</summary>
53
+ public static TemperatureChangeRate operator / ( TemperatureDelta temperatureDelta , Duration duration )
54
+ {
55
+ return TemperatureChangeRate . FromDegreesCelsiusPerSecond ( temperatureDelta . Kelvins / duration . Seconds ) ;
56
+ }
43
57
}
44
58
}
You can’t perform that action at this time.
0 commit comments