The error message to display.
The file name where the error occurred. The value is added automatically at the call site.
The line where the error occurred. The value is added automatically at the call site.
DUnitAssertError if any method was called outside of preset boundries.
1 import dunit.mockable; 2 3 class T 4 { 5 int getValue() 6 { 7 return 1; 8 } 9 10 mixin Mockable!(T); 11 } 12 13 unittest 14 { 15 import dunit.toolkit; 16 17 auto mock = T.getMock(); 18 19 // Replace method while defining a minimum call limit. 20 mock.mockMethod("getValue", delegate(){ 21 return 2; 22 }, 1); 23 24 // Increase the call count of 'getValue' by one. 25 mock.getValue().assertEqual(2); 26 27 // Assert methods calls are within defined limits. 28 mock.assertMethodCalls(); 29 }
Assert all replaced methods are called the defined amount of times.