It is possible:
public class OneProperty
{
virtual public int MyInt
{
get;
set;
}
}
[Test]
public void IntWasSet()
{
var prop = Rhino.Mocks.MockRepository.GenerateMock<OneProperty>();
prop.MyInt = 5;
prop.AssertWasNotCalled(x => x.MyInt = Arg<int>.Is.Anything);
prop.VerifyAllExpectations();
}
Running this test on Rhino Mocks 3.5 results in the following error:
Errors and failures: 1) Test error: InterfacerTests.TestMatchesInterface.IntWasSet Rhino.Mocks.Exceptions.ExpectationViolationException: OneProperty.set_MyInt is expected (nothing); would not be called, but it was found on actual calls made to a mock object.
I discovered the syntax Arg<T>
source
share