I’m new to mocks and am deciding on a mock framework. The Moq home quotes
Currently, it’s the only mocking library that goes against the generalized and somewhat unintuitive (especially for novices) Record/Reply approach from all other frameworks.
Can anyone explain simply what the Record/Replay approach is and how Moq differs? What are the pros and cons of each especially from the point of deciding a framework?
Thanks.
The Record/Replay approach is supported by RhinoMocks. The basic idea is that your test execution is divided into two phases, the record phase and the replay phase. To be a little bit more concrete
So the Expecting block is the Record phase and the Verify block is the Replay phase.
The Moq variant of this code would be
Which as you can see is much nicer to read. I used to use RhinoMocks but since I discovered Moq I only use Moq. I find it to be produce much more readable code. So my advice would be to go for Moq.