|Home||Back to Index|
Daniel Cazzulino gave me the last piece of the puzzle on the discussion group: Mock.Get(theInterface) returns the mock for the given interface instance, allowing me to set further expectations on an object. See the discussion for the reasons I wanted this feature.
The only major issue I ran into in converting the tests was one class that used out parameters on methods. Since Moq doesn’t support out or ref parameters in the current revision (it’s supposed to be in the trunk, though), I created a stub class by hand in a few minutes. Hopefully I can remove that in the near future.
It’s liberating to have no record/replay model. I also find Moq relatively intuitive; with Rhino Mocks, I regularly had to look up how some feature worked.
No one I asked at work had used either library, so I was free to switch. I plan to do a presentation on Moq to the developers in the near future.
Update - October 8, 2008
A new version of Moq is available with support for out and ref parameters! I tested it with out parameters, and it works. You do have to be careful due to closures capturing variables, though - please see the discussion posts.