I can't find out what's the problem. I haven't found any documentation on AssertWasCalled on Rhino.Mocks site, so I have to ask the question here.
What I do in my tests is I call _mocks.ReplayAll(), then one or more _mockedObject.AssertWasCalled() and then _mocks.VerifyAll(). But it tells me that "This action is invalid when the mock object is in record state".
Here's the code:
[Test]
public void SetStateExecuting_Should_Set_State_To_Pause_And_Not_Change_GlobalState_When_GlobalState_Is_Paused()
{
var task = new Task { ID = 1, TimeZone = -660, GlobalState = TaskState.Paused };
_taskDataProvider.Expect(p => p.StateUpdate(task.ID, task.TimeZone, TaskState.Paused));
_mockRepository.ReplayAll();
_manager.SetStateExecuting(task);
_taskDataProvider.AssertWasNotCalled(p => p.GlobalStateUpdate(task.ID, TaskState.Executing));
_mockRepository.VerifyAll();
}
What is the correct order in which I should call these functions to function correctly?