What is Rhino Mocks?
Rhino Mocks allows you to easily create mock objects and setup a wide range of expectations on them using strongly typed notation instead of compiler-opaque strings. It's as simple as:
IProjectView projectView = mocks.StrictMock<IProjectView>();
- Mock Object - an object that pretends to be another object and allows you to set expectations on its interactions with another object.
- Interaction Based Testing - you specify a certain sequence of interactions between objects, initiate an action, and then verify that the sequence of interactions happened as you specified it.
- State Based Testing - you initiate an action and then check for the expected results (return value, property, created object, etc).
- Expectation - general name for validation that a particular method call is the expected one.
- Record & Replay model - a model that allows for recording actions on a mock object and then replaying and verifying them. All mocking frameworks uses this model. Some (NMock, TypeMock.Net, NMock2) use it implicitly and some (EasyMock.Net, Rhino Mocks) use it explicitly.
- Ordering - The ability to specify that replaying a sequence of method calls will occur in a specific order (or disorder).
Check here for Rhino Mocks Change Log
- mock interfaces, delegates and classes, including those with parameterized constructors.
- set expectations on the called methods by using strongly typed mocks instead of strings.
- lends itself easily to refactoring & leaning on the compiler.
- allows a wide range of expectations to be set on a mock object or several mock objects.
- Attention: Rhino Mocks can only mock interfaces, delegates and virtual methods of classes! (Although it is possible to get work around existing code and easily apply Rhino Mocks, see Example of testing an abstract class)
- Rhino Mocks now supports "Recursive mocking" (as of revision 1683). Special guidance (see here) should be followed when using this functionality, however.