Interested in a
Personal Demo ?

Name* :
Please Enter your Name
Company E–Mail* :
Please Enter a Valid Email


"Typemock Isolator enables us to modify our legacy applications without changing the source code."
Christian Mérat, .NET Architect & Developer, GSoft Group
Success stories


US Toll Free
Outside US
Get your printable quote
Buy online

 Main | How to change behavior with Isolator++ »

Asserting A Function Call

With Isolator++ you can assert a function call on a fake object. Let’s say my class has a void call and I want to make sure got called. In the next test, the ASSERT_WAS_CALLED macro is used for validation of the VoidCall call:

// Asserting a method call

TEST_F(IsolatorTests, AssertWasCalled)


     ConcreteClass* fakeConcrete = FAKE(ConcreteClass);

     fakeConcrete->VoidCall(); // this call is ignored




The test will fail if the method was not called during the run. To make sure a method was not called, use ASSERT_ NOT_CALLED macro:

And finally to verify a method was called X times use the TIMES_CALLED macro:
int num = TIMES_CALLED(instance-> VoidCall ());

On the num variable, you can now use ASSERT_EQ to verify the count):
ASSERT_EQ(3, num);