File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
UnitsNet.Tests/CustomCode
UnitsNet/CustomCode/Quantities Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -121,5 +121,12 @@ public void PressureDividedBySpecificWeightEqualsLength()
121
121
Length length = Pressure . FromPascals ( 20 ) / SpecificWeight . FromNewtonsPerCubicMeter ( 2 ) ;
122
122
Assert . Equal ( Length . FromMeters ( 10 ) , length ) ;
123
123
}
124
+
125
+ [ Fact ]
126
+ public void PressureDividedByLengthEqualsSpecificWeight ( )
127
+ {
128
+ SpecificWeight specificWeight = Pressure . FromPascals ( 20 ) / Length . FromMeters ( 2 ) ;
129
+ Assert . Equal ( SpecificWeight . FromNewtonsPerCubicMeter ( 10 ) , specificWeight ) ;
130
+ }
124
131
}
125
132
}
Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ public partial struct Pressure
47
47
{
48
48
return new Length ( pressure . Pascals / specificWeight . NewtonsPerCubicMeter , UnitsNet . Units . LengthUnit . Meter ) ;
49
49
}
50
+
51
+ public static SpecificWeight operator / ( Pressure pressure , Length length )
52
+ {
53
+ return new SpecificWeight ( pressure . Pascals / length . Meters , UnitsNet . Units . SpecificWeightUnit . NewtonPerCubicMeter ) ;
54
+ }
50
55
#endif
51
56
}
52
57
}
You can’t perform that action at this time.
0 commit comments