@@ -65,7 +65,7 @@ public static void ToTimeSpanShouldNotThrowExceptionOnValuesSlightlyLargerThanTi
65
65
{
66
66
Duration duration = Duration . FromSeconds ( TimeSpan . MinValue . TotalSeconds + 1 ) ;
67
67
TimeSpan timeSpan = duration . ToTimeSpan ( ) ;
68
- Assert . AreEqual ( duration . Seconds , timeSpan . TotalSeconds , 1e-3 ) ;
68
+ Assert . AreEqual ( duration . Seconds , timeSpan . TotalSeconds , 1e-3 ) ;
69
69
}
70
70
71
71
[ Test ]
@@ -111,5 +111,101 @@ public static void DateTimeMinusDurationReturnsDateTime()
111
111
DateTime expected = new DateTime ( 2016 , 1 , 1 ) ;
112
112
Assert . AreEqual ( expected , result ) ;
113
113
}
114
+
115
+ [ Test ]
116
+ public static void TimeSpanLessThanDurationShouldReturnCorrectly ( )
117
+ {
118
+ TimeSpan timeSpan = TimeSpan . FromHours ( 10 ) ;
119
+ Duration duration = Duration . FromHours ( 11 ) ;
120
+ Assert . IsTrue ( timeSpan < duration , "timeSpan should be less than duration" ) ;
121
+ }
122
+
123
+ [ Test ]
124
+ public static void TimeSpanGreaterThanDurationShouldReturnCorrectly ( )
125
+ {
126
+ TimeSpan timeSpan = TimeSpan . FromHours ( 12 ) ;
127
+ Duration duration = Duration . FromHours ( 11 ) ;
128
+ Assert . IsTrue ( timeSpan > duration , "timeSpan should be greater than duration" ) ;
129
+ }
130
+
131
+ [ Test ]
132
+ public static void DurationLessThanTimeSpanShouldReturnCorrectly ( )
133
+ {
134
+ TimeSpan timeSpan = TimeSpan . FromHours ( 11 ) ;
135
+ Duration duration = Duration . FromHours ( 10 ) ;
136
+ Assert . IsTrue ( duration < timeSpan , "duration should be less than timeSpan" ) ;
137
+ }
138
+
139
+ [ Test ]
140
+ public static void DurationGreaterThanTimeSpanShouldReturnCorrectly ( )
141
+ {
142
+ TimeSpan timeSpan = TimeSpan . FromHours ( 11 ) ;
143
+ Duration duration = Duration . FromHours ( 12 ) ;
144
+ Assert . IsTrue ( duration > timeSpan , "duration should be greater than timeSpan" ) ;
145
+ }
146
+
147
+ [ Test ]
148
+ public static void TimeSpanLessOrEqualThanDurationShouldReturnCorrectly ( )
149
+ {
150
+ TimeSpan timeSpan = TimeSpan . FromHours ( 10 ) ;
151
+ Duration duration = Duration . FromHours ( 11 ) ;
152
+ Assert . IsTrue ( timeSpan <= duration , "timeSpan should be less than duration" ) ;
153
+ }
154
+
155
+ [ Test ]
156
+ public static void TimeSpanGreaterThanOrEqualDurationShouldReturnCorrectly ( )
157
+ {
158
+ TimeSpan timeSpan = TimeSpan . FromHours ( 12 ) ;
159
+ Duration duration = Duration . FromHours ( 11 ) ;
160
+ Assert . IsTrue ( timeSpan >= duration , "timeSpan should be greater than duration" ) ;
161
+ }
162
+
163
+ [ Test ]
164
+ public static void DurationLessThanOrEqualTimeSpanShouldReturnCorrectly ( )
165
+ {
166
+ TimeSpan timeSpan = TimeSpan . FromHours ( 11 ) ;
167
+ Duration duration = Duration . FromHours ( 10 ) ;
168
+ Assert . IsTrue ( duration <= timeSpan , "duration should be less than timeSpan" ) ;
169
+ }
170
+
171
+ [ Test ]
172
+ public static void DurationGreaterThanOrEqualTimeSpanShouldReturnCorrectly ( )
173
+ {
174
+ TimeSpan timeSpan = TimeSpan . FromHours ( 11 ) ;
175
+ Duration duration = Duration . FromHours ( 12 ) ;
176
+ Assert . IsTrue ( duration >= timeSpan , "duration should be greater than timeSpan" ) ;
177
+ }
178
+
179
+ [ Test ]
180
+ public static void DurationEqualToTimeSpanShouldReturnCorrectly ( )
181
+ {
182
+ TimeSpan timeSpan = TimeSpan . FromHours ( 11 ) ;
183
+ Duration duration = Duration . FromHours ( 11 ) ;
184
+ Assert . IsTrue ( duration == timeSpan , "duration should be equal to timeSpan" ) ;
185
+ }
186
+
187
+ [ Test ]
188
+ public static void TimeSpanEqualToDurationShouldReturnCorrectly ( )
189
+ {
190
+ TimeSpan timeSpan = TimeSpan . FromHours ( 11 ) ;
191
+ Duration duration = Duration . FromHours ( 11 ) ;
192
+ Assert . IsTrue ( timeSpan == duration , "timeSpan should be equal to duration" ) ;
193
+ }
194
+
195
+ [ Test ]
196
+ public static void DurationNotEqualToTimeSpanShouldReturnCorrectly ( )
197
+ {
198
+ TimeSpan timeSpan = TimeSpan . FromHours ( 12 ) ;
199
+ Duration duration = Duration . FromHours ( 11 ) ;
200
+ Assert . IsTrue ( duration != timeSpan , "duration should not be equal to timeSpan" ) ;
201
+ }
202
+
203
+ [ Test ]
204
+ public static void TimeSpanNotEqualToDurationShouldReturnCorrectly ( )
205
+ {
206
+ TimeSpan timeSpan = TimeSpan . FromHours ( 12 ) ;
207
+ Duration duration = Duration . FromHours ( 11 ) ;
208
+ Assert . IsTrue ( timeSpan != duration , "timeSpan should not be equal to duration" ) ;
209
+ }
114
210
}
115
211
}
0 commit comments