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: INonPublicMethodHandlerAn interface reference.
Remarks
Examples
[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