File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
UnitsNet.Tests/CustomCode
UnitsNet/CustomCode/Quantities Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,13 @@ public void EnergyDividedByDurationEqualsPower()
121
121
Assert . Equal ( 4 , p . Watts ) ;
122
122
}
123
123
124
+ [ Fact ]
125
+ public void EnergyDividedByPowerEqualsDuration ( )
126
+ {
127
+ Duration d = Energy . FromKilowattHours ( 100 ) / Power . FromKilowatts ( 20 ) ;
128
+ Assert . Equal ( 5 , d . Hours ) ;
129
+ }
130
+
124
131
[ Fact ]
125
132
public void EnergyTimesFrequencyEqualsPower ( )
126
133
{
Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ public partial struct Energy
19
19
return Power . FromWatts ( energy . Joules / duration . Seconds ) ;
20
20
}
21
21
22
+ /// <summary>Get <see cref="Duration"/> from <see cref="Energy"/> divided by <see cref="Power"/>.</summary>
23
+ public static Duration operator / ( Energy energy , Power power )
24
+ {
25
+ return Duration . FromSeconds ( energy . Joules / power . Watts ) ;
26
+ }
27
+
22
28
/// <summary>Get <see cref="Power"/> from <see cref="Energy"/> times <see cref="Frequency"/>.</summary>
23
29
public static Power operator * ( Energy energy , Frequency frequency )
24
30
{
@@ -42,13 +48,13 @@ public partial struct Energy
42
48
{
43
49
return TemperatureDelta . FromKelvins ( energy . Joules / entropy . JoulesPerKelvin ) ;
44
50
}
45
-
51
+
46
52
/// <summary>Get <see cref="SpecificEnergy"/> from <see cref="Energy"/> divided by <see cref="Mass"/> </summary>
47
53
public static SpecificEnergy operator / ( Energy energy , Mass mass )
48
54
{
49
55
return SpecificEnergy . FromJoulesPerKilogram ( energy . Joules / mass . Kilograms ) ;
50
56
}
51
-
57
+
52
58
/// <summary>Get <see cref="Mass"/> from <see cref="Energy"/> divided by <see cref="SpecificEnergy"/>.</summary>
53
59
public static Mass operator / ( Energy energy , SpecificEnergy specificEnergy )
54
60
{
You can’t perform that action at this time.
0 commit comments