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()
90
90
Assert . AreEqual ( area , Area . FromSquareMeters ( 20 ) ) ;
91
91
}
92
92
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
+
93
100
[ Test ]
94
101
public void ToStringReturnsCorrectNumberAndUnitWithDefaultUnitWhichIsMeter ( )
95
102
{
Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ public static Length FromFeetInches(double feet, double inches)
68
68
return Speed . FromMetersPerSecond ( length . Meters / duration . Seconds ) ;
69
69
}
70
70
71
+ public static Duration operator / ( Length length , Speed speed )
72
+ {
73
+ return Duration . FromSeconds ( length . Meters / speed . MetersPerSecond ) ;
74
+ }
75
+
71
76
public static Area operator * ( Length length1 , Length length2 )
72
77
{
73
78
return Area . FromSquareMeters ( length1 . Meters * length2 . Meters ) ;
You can’t perform that action at this time.
0 commit comments