The difference between these three types of Rhino Mocks mocking solutions has always been a little confusing to me. So, here's my best shot at some concise definitions:
- A normal mock object will throw an exception when a method, which has no explicit expectation defined, is called on the mock instance.
- A dynamic mock, instead of throwing an exception, will return null or 0 for any unexpected method calls.
- A partial mock, like a dynamic mock, will not throw an exception if a method is called when there is no expectation defined for the method; but, instead of returning 0 or null, a partial mock will call the actual implementation method (i.e., not the mock) on the object and return that value. This lets you selectively mock specific methods on an object.