IMethodBehaviorCallOriginal Method

Typemock Isolator Developer Guide
Specify that an intercepted call will try to execute the real logic of the intercepted instance.

Namespace:  TypeMock.ArrangeActAssert.Fluent
Assembly:  Typemock.ArrangeActAssert (in Typemock.ArrangeActAssert.dll) Version: 9.4.1.0 (9.4.1.0)
Syntax

void CallOriginal()
Remarks

This interface is returned by WhenCalled(Action) method.

Before using this directive make sure that the intercepted method has a real implementation that can be executed.

Examples

This test shows faking an object to return null values, and overriding one of its methods to call its original implementation:
[TestMethod]
[Isolated]
public void CallOriginalOnFakeInstance()
{
    RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.ReturnNulls);

    // Override the Increment() method to call its original implementation
    Isolate.WhenCalled(() => fake.Increment()).CallOriginal();

    // Make sure Count is reset
    fake.Count = 0;

    // This call now redirects to its original implementation - the count should increment
    fake.Increment();
    Assert.AreEqual(1, fake.Count);

    // even though we called the original implementation, we can still verify the call happened
    Isolate.Verify.WasCalledWithAnyArguments(() => fake.Increment());
}
See Also

Reference