OLD | NEW |
1 library typed_mock; | 1 library typed_mock; |
2 | 2 |
3 _InvocationMatcher _lastMatcher; | 3 _InvocationMatcher _lastMatcher; |
4 | 4 |
5 /// Enables stubbing methods. | 5 /// Enables stubbing methods. |
6 /// | 6 /// |
7 /// Use it when you want the mock to return a particular value when a particular | 7 /// Use it when you want the mock to return a particular value when a particular |
8 /// method, getter or setter is called. | 8 /// method, getter or setter is called. |
9 /// | 9 /// |
10 /// when(obj.testProperty).thenReturn(10); | 10 /// when(obj.testProperty).thenReturn(10); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 void any() { | 233 void any() { |
234 // mark as verified, but don't check the actual count | 234 // mark as verified, but don't check the actual count |
235 _count(); | 235 _count(); |
236 } | 236 } |
237 | 237 |
238 /// Verifies that there was no matching interactions. | 238 /// Verifies that there was no matching interactions. |
239 void never() { | 239 void never() { |
240 times(0); | 240 times(0); |
241 } | 241 } |
242 | 242 |
243 /// Verifies that there was excatly one martching interaction. | 243 /// Verifies that there was exactly one matching interaction. |
244 void once() { | 244 void once() { |
245 times(1); | 245 times(1); |
246 } | 246 } |
247 | 247 |
248 /// Verifies that there was the specified number of matching interactions. | 248 /// Verifies that there was the specified number of matching interactions. |
249 void times(int expected) { | 249 void times(int expected) { |
250 var times = _count(); | 250 var times = _count(); |
251 if (times != expected) { | 251 if (times != expected) { |
252 var member = _matcher._member; | 252 var member = _matcher._member; |
253 throw new VerifyError('$expected expected, but $times' | 253 throw new VerifyError('$expected expected, but $times' |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 const _ArgumentMatcher_anyString(); | 417 const _ArgumentMatcher_anyString(); |
418 | 418 |
419 @override | 419 @override |
420 bool matches(val) { | 420 bool matches(val) { |
421 return val is String; | 421 return val is String; |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 /// Matches any [String] value. | 425 /// Matches any [String] value. |
426 final anyString = const _ArgumentMatcher_anyString() as dynamic; | 426 final anyString = const _ArgumentMatcher_anyString() as dynamic; |
OLD | NEW |