MockCommon.expectNotCalled

Used to assert function not call

mixin template MockCommon()
void
expectNotCalled
(
string functionName
string message = null
string file = __FILE__
size_t line = __LINE__
V...
)
(
auto ref V values
)

Parameters

functionName

The name of expected function.

message

Exception message.

file

The file name that the assert failed in. Should be left as default.

line

The file line that the assert failed in. Should be left as default.

values
Type: V

Are expected parameter values.

Throws

If function is call with parameters, will throw an UnitTestException.

Examples

1 interface Dummy
2 {
3   void test();
4   void test(int a);
5 }
6 
7 auto mock = new Mock!Dummy;
8 mock.test(12);
9 mock.expectNotCalled!"test"();
10 mock.expectNotCalled!"test"(24);
11 
12 // Will throw an exception like "UnitTestException@example.d(6): <test> expected call with <12> <0> count but called <1> counts        
13 mock.exceptNotCalled!"test"(12);

Meta