IIsolateNonPublicWhenCalledLocal Method (Object, String, String)

Typemock Isolator Developer Guide
Sets behavior for a specific local function on an object

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

INonPublicMethodHandler WhenCalledLocal(
	Object targetObject,
	string methodName,
	string localFunctionName
)

Parameters

targetObject
Type: SystemObject
The object to set method behavior on.
methodName
Type: SystemString
The name of the method that defines the local function.
localFunctionName
Type: SystemString
The name of the local function to set behavior on.

Return Value

Type: INonPublicMethodHandler
An interface reference.
Remarks

Because of the nature of fluent interface, WhenCalledLocal should be used with its proceeding methods. See INonPublicMethodHandler
Examples

Here is an example how to use WhenCalledLocal in order to change the return value:
[TestMethod]
[Isolated]
public void ChangeLocalFunctionReturnValue()
{
   var fake = Isolate.Fake.Instance<classWithLocal>(Members.CallOriginal);

    // Changing the local function behaviour by setting it return 5.
   Isolate.NonPublic.WhenCalledLocal(fake, "UseLocalFunc", "GetLocal").WillReturn(5);
   var result = fake.UseLocalFunc();

   Assert.AreEqual(5, result);
}
See Also

Reference