IParameters Interface

Typemock Isolator Developer Guide
Typemock Isolator can validates parameter values, collections and arrays. To do so just pass the list of expected parameter values to the Args method.

Namespace:  TypeMock
Assembly:  TypeMock (in TypeMock.dll) Version: 9.3.6.0 (9.3.6.0)
Syntax

public interface IParameters

The IParameters type exposes the following members.

Methods

  NameDescription
Public methodArgs
Public methodWhen
Top
Remarks

It is possible to check that a mocked method has been called with specific argument values.

Examples

For example, if we need to check that an int parameter is 10 we can write the following code
[Test]
public void Test()
{
    // Start mocking TestedClass
    Mock mock = MockManager.Mock(typeof(TestedClass));
    // first time passInt will be called, arguments must be 10 
    mock.ExpectCall("passInt").Args(10);
    // second time 1
    mock.ExpectCall("passInt").Args(1);
    TestedClass t = new TestedClass();
    // This will pass 
    t.passInt(10);
    // This will fail 
    t.passInt(3);
    MockManager.Verify();
}

Single Dimension Arrays and Collections are iterated and checked for match of all items See Check for built in ParameterCheckers See ParameterChecker for details of user defined checks
Note Note
BEWARE, Typemock Isolator normally check the type of return value with the existing method, but it does not check the legitimacy of the returned value in case of overloaded methods that have different return types, (as Typemock Isolator sees these as one mocked method) if you return a value with the wrong type a System.InvalidCastException will be thrown
Note Note
Typemock Isolator supports checking methods with up to 30 parameters
Note Note
This Interface is not to be implemented by client
See Also

Reference