I have recently blogged a few posts about how to let Rhino Mocks do more for us. They are listed below:
- Rhino.Mocks Ordered Expectations for AAA Syntax
- Rhino.Mocks Ordered Expectations Enhanced API for AAA
- Introduce A Powerful AAA Syntax for Rhino.Mocks
All those features require reader either change the source code of Rhino Mocks or download a special version of Rhino Mocks that I built. Those changes are quite invasive.
By carefully looking at the code, I found that there are some features can be extract into an extension library without touching the Rhino Mocks itself. Actually, only the ordered expectation requires source code change. Hence, I decided to build a extension library so that everybody can use. You can either drop the source into your test project or download the Rhino.Mocks.Extension.dll and add the reference to it.
Here is the current feature list:
- Create multi mock for AAA: Mockery.GenerateMultiMock
- Create partial mock for AAA: Mockery.GeneratePartialMock, Mocker.GeneratePartialMultiMock
- Ability to use test framework's assert: Assert.IsTrue(mock.ActivityOf(x=>x.Foo()));
- Use operator to check "or" condition: mock.ActivityOf(x=>x.Foo()) | mock2.ActivityOf(x=>x.Bar())
- Support assert for one and exactly one is called: Mockery.ExactOneOf(m.ActivityOf(...), ...).AssertOccured;
Please see my earlier posts for the detail of feature 3-5.