IVerifyCallsHandlerWasNotCalledWithArguments Method (Action)

Typemock Isolator Developer Guide
Overloaded. Verifies that a method was not called with arguments matching custom verifier.

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

IArgumentsMatcher WasNotCalledWithArguments(
	Action action
)

Parameters

action
Type: SystemAction
A method returning a value in the form of a Lambda Expression that we want to verify if was called.

Return Value

Type: IArgumentsMatcher
Exceptions

ExceptionCondition
VerifyException Thrown if the method, was not called with arguments matching the custom verifier.
Remarks

Calls to WasCalledWithArguments must be followed with call to Matching() method.
Examples

The following example verifies a method was called with positive int value.
[TestMethod]
[Isolated]
public void VerifyMethodCalledWithMatchingArguments()
{
    var fake = Isolate.Fake.Instance<RealLogger>();

    fake.Log(-1);

    Isolate.Verify.WasNotCalledWithArguments(() => fake.Log(0)).Matching(args => (int) args[0] > 0);
}
The following example verifies a method was not called with positive int value and exact string value.
[TestMethod]
[Isolated]
public void VerifyMethodCalledWithMatchingArguments()
{
    var fake = Isolate.Fake.Instance<RealLogger>();

    fake.Log(-1, "rts");

    Isolate.Verify.WasNotCalledWithArguments(() => fake.Log(0, null))
        .Matching(args => ((int) args[0] > 0) && ((string) args[1] == "str"));
}
See Also

Reference