Wackiest Mocking Strategy?
I am starting to see a lot more refernces to Rhino Mocks in blogs and articles, which is really great. What is interesting is that I get to see a lot of mocking related code (either on the Rhino Mocks list or directly). People are doing some crazy stuff with Rhino Mocks, things I never imagined that they would do.
What is the strangest thing that you ever used a mock object for?
For myself, I used it to implement an in memory database based on expectations matching the results to a query. (And if you can't figure that out, I am glad, talk about trying to grok that.)
Comments
I keep seeing the references, with heaps and heaps of priase, but would love to see an Introduction to Mocks 101 With Real World Examples for the clueless among us...
Phil does a pretty good job of explaining how to use Rhino Mocks to test Events on an Interface.
If you're looking for even more real-world examples, grab yourself a copy of the Subtext code base - we use Rhino Mocks a good bit in our test suite.
Since I am not prepared for this meeting coming up I am considering mocking myself and using
Expect.Call(me.Answer).IgnoreArguments().Return(WhatTheyWantToHear()).Repeat.Any();
Ha! I started trying to mock an in memory database. (I need something to assist with unit testing the next version of our in-house O/RM.)
However, I found that my mocking skills are still too weak. So I gave up for the time being.
Any reason not to use SQLite for it?
Well, our current version of our O/RM uses sprocs, though we are likely to eliminate that in the next rev.
I also considered Firebird.
Right now, I'm taking a step back, and examining the units tests in NHibernate.
Comment preview