Update:
You are not using AAA syntax correctly. You no longer need an instance for the MockRepository (this was used for Rhino prior to 3.5). Just call the static methods in the MockRepository:
var contextChannel = MockRepository.GenerateStub<IContextChannel>(); var context = MockRepository.GenerateStub<IOperationContext>(); context.Stub(x => x.Channel).Return(contextChannel);
Here are some documents:
Original answer
Not. You no longer need to call Replay
in situations like yours.
In previous versions, there was a record-repeat paradigm where you recorded expectations and played them during the test. It has been replaced with AAA syntax, where you can configure mocks much easier and more flexibly.
Behind the scenes, the recording and playback status of the layout is still preserved. Methods such as Stub
put the layout in the recording state, configure it, and return to the recording. You do not need to explicitly call Record
in these cases.
If you want to do a few more complicated operations, you can configure moker to reproduce the state yourself, do something with it, for example. to wait for reset:
mock.BackToRecord(BackToRecordOptions.All); mock.Replay();
source share