If you want to set up an expectation that a method is never called at all, and not just that it is never called with a specific parameter, you can do like this:
MockRepository mocks = new MockRepository();
Foo mockFoo = mocks.StrictMock<Foo>();// For void methods:
mockFoo.Bar();
LastCall.IgnoreArguments().Repeat.Never();// For non-void methods:
Expect.Call(mockFoo.Baz(1)).Return(null).Repeat.Never();
LastCall.IgnoreArguments().Repeat.Never();mockFoo.Replay();
// Do stuff
mockFoo.VerifyAllExpectations();
Comments