Fake Method Highlighting

This feature is available for C# only.

When debugging, it is easy to get confused when you enter the mocked method. Although the code is there and includes a breakpoint, when you step into the function, it is the mocked code that actually runs rather than the actual code.

To help you identify the mocked method when you reach the method and set a breakpoint at the beginning, Typemock Isolator highlights the method as shown on the following figure:

When you step into the method, it will be highlighted only if the next call is mocked. In the following code, when the DoSomething() method is called for the first time, it will be mocked and highlighted. When DoSomething() is called next time, it is displayed as a regular code because no expectation was set.

C#

public void TestDoSomething()
{
   Mock mock = MockManager.Mock(typeof(AClass));
   mock.ExpectCall("DoSomething");
   
   AClass instanceA = new AClass();
   AClass instanceB = new AClass();

   // This call will be mocked
   instanceA.DoSomething();
   // This call will not be mocked
   instanceB.DoSomething();

   MockManager.Verify();
}