IReturnValueHandlerTWillReturn Method

Typemock Isolator Developer Guide
Specify that the intercepted method will return the given value. The real implementation will not be executed.

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

void WillReturn(
	T value
)

Parameters

value
Type: T
The fake value to return when the call is intercepted
Examples

This example shows using WillReturn() to change the return value for a property call:
[TestMethod]
[Isolated]
public void FakeAnInstance_ChangeMethodReturnValue()
{
    RealLogger fake = Isolate.Fake.Instance<RealLogger>();

    // Change the return value for Count property
    Isolate.WhenCalled(() => fake.Count).WillReturn(10);

    // fake.Count will return the assigned value
    Assert.AreEqual(10, fake.Count);
}
See Also

Reference