File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
UnitsNet.Tests/CustomCode
UnitsNet/CustomCode/UnitClasses Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,13 @@ public void LengthTimesLengthEqualsArea()
9090 Assert . AreEqual ( area , Area . FromSquareMeters ( 20 ) ) ;
9191 }
9292
93+ [ Test ]
94+ public void LengthDividedBySpeedEqualsDuration ( )
95+ {
96+ Duration duration = Length . FromMeters ( 20 ) / Speed . FromMetersPerSecond ( 2 ) ;
97+ Assert . AreEqual ( Duration . FromSeconds ( 10 ) , duration ) ;
98+ }
99+
93100 [ Test ]
94101 public void ToStringReturnsCorrectNumberAndUnitWithDefaultUnitWhichIsMeter ( )
95102 {
Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ public static Length FromFeetInches(double feet, double inches)
6868 return Speed . FromMetersPerSecond ( length . Meters / duration . Seconds ) ;
6969 }
7070
71+ public static Duration operator / ( Length length , Speed speed )
72+ {
73+ return Duration . FromSeconds ( length . Meters / speed . MetersPerSecond ) ;
74+ }
75+
7176 public static Area operator * ( Length length1 , Length length2 )
7277 {
7378 return Area . FromSquareMeters ( length1 . Meters * length2 . Meters ) ;
You can’t perform that action at this time.
0 commit comments