File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
UnitsNet.Tests/CustomCode
UnitsNet/CustomCode/Quantities Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -64,5 +64,19 @@ public void TemperatureDeltaTimesEntropyEqualsEnergy()
6464 Energy energy = TemperatureDelta . FromKelvins ( 20 ) * Entropy . FromJoulesPerKelvin ( 4 ) ;
6565 Assert . Equal ( Energy . FromJoules ( 80 ) , energy ) ;
6666 }
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+ }
6781 }
6882}
Original file line number Diff line number Diff line change 11// Licensed under MIT No Attribution, see LICENSE file at the root.
22// Copyright 2013 Andreas Gullberg Larsen ([email protected] ). Maintained at https://github.com/angularsen/UnitsNet. 33
4+ using System ;
5+
46namespace UnitsNet
57{
68 public partial struct TemperatureDelta
@@ -40,5 +42,17 @@ public partial struct TemperatureDelta
4042 {
4143 return temperatureDelta . Kelvins * cte . PerKelvin ;
4244 }
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+ }
4357 }
4458}
You can’t perform that action at this time.
0 commit comments