partial argument match in rhino mocks

.net, rhino-mocks, unit-testing

Solution

// arrange
var fooStub = MockRepository.GenerateStub<IFoo>();

// act
fooStub.Bar("arg1", "arg2", 3);

// assert
fooStub.AssertWasCalled(
    x => x.Bar(
        Arg<string>.Is.Equal("arg1"), 
        Arg<string>.Is.Anything, 
        Arg<int>.Is.Equal(3))
);

Problem

In my unit test instead of IgnoreArguments i want to use some partial matching of arguments in rhino mocks testing. How to do that? Thanks, John

Original source