Search code examples
rhino-mocks

Wildcard argument in a method mock, to match anything?


When I'm making an Expect.Call(mock.method(arg1, arg2 ..)).., is there a way by which I can make one of the method arguments a wildcard so the mock will match it no matter what the runtime argument value is? Otherwise, is there another means to achieve this behaviour using Rhino Mocks?

Rhino Mocks 3.6


Solution

  • Heh. Shortly after posting I found the IgnoreArguments() method:

            Expect.Call(dataAccessMock.SetCustomer(oCustomer, out strOutCustId))
                .IgnoreArguments();
    

    which states:

    // Summary:
    // Ignores the arguments for this method. Any argument will be matched againt [sic]
    // this method.