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()
121121 Assert . Equal ( 4 , p . Watts ) ;
122122 }
123123
124+ [ Fact ]
125+ public void EnergyDividedByPowerEqualsDuration ( )
126+ {
127+ Duration d = Energy . FromKilowattHours ( 100 ) / Power . FromKilowatts ( 20 ) ;
128+ Assert . Equal ( 5 , d . Hours ) ;
129+ }
130+
124131 [ Fact ]
125132 public void EnergyTimesFrequencyEqualsPower ( )
126133 {
Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ public partial struct Energy
1919 return Power . FromWatts ( energy . Joules / duration . Seconds ) ;
2020 }
2121
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+
2228 /// <summary>Get <see cref="Power"/> from <see cref="Energy"/> times <see cref="Frequency"/>.</summary>
2329 public static Power operator * ( Energy energy , Frequency frequency )
2430 {
@@ -42,13 +48,13 @@ public partial struct Energy
4248 {
4349 return TemperatureDelta . FromKelvins ( energy . Joules / entropy . JoulesPerKelvin ) ;
4450 }
45-
51+
4652 /// <summary>Get <see cref="SpecificEnergy"/> from <see cref="Energy"/> divided by <see cref="Mass"/> </summary>
4753 public static SpecificEnergy operator / ( Energy energy , Mass mass )
4854 {
4955 return SpecificEnergy . FromJoulesPerKilogram ( energy . Joules / mass . Kilograms ) ;
5056 }
51-
57+
5258 /// <summary>Get <see cref="Mass"/> from <see cref="Energy"/> divided by <see cref="SpecificEnergy"/>.</summary>
5359 public static Mass operator / ( Energy energy , SpecificEnergy specificEnergy )
5460 {
You can’t perform that action at this time.
0 commit comments