I’ve been doing a fair amount with Rhino Mocks lately, and found that it doesn’t support one common scenario well.
You have an interface with several read-only properties (get accessors but no set accessors). You want to stub that interface.
It appears that you have to actually create a MockRepository rather than just using the static method to create the stub. You then have to call SetupResult.For on the properties, and put the repository instance into replay mode. Worse, you then can’t change the results (as far as I can tell). This makes it more difficult to define setup fixtures and the like.
I’m hoping Rhino Mocks v3.5 will resolve this issue. If it doesn’t, I may be looking for a new mocking framework.
Update - September 7, 2008
Please see Ayende’s comment.
Development Central is the blog of Bill Sorensen, a professional software developer. Much of this will relate to C#, .NET, and OOP in general.
Disclaimer
These postings are provided "AS IS" with no warranties and confer no rights.