I'm trying to assert with RhinoMocks that a certain property setter was called. But it's not working as expected.
The following simplified example illustrates the problem.
Consider this interface:
public interface IMyInterface
{
string SomeProperty { get; set; }
}
And now consider the following code:
var mock = MockRepository.GenerateStub<IMyInterface>();
mock.SomeProperty = "abc";
mock.AssertWasCalled(x => x.SomeProperty = Arg<string>.Is.Anything);
I was expecting the assert on the last line would pass without problem. However, it is throwing an ExpectationViolationException
with this message:
"IMyInterface.set_SomeProperty(anything); Expected #1, Actual #0."
I can't understand why this should happen. Can anyone please help?