Rhino Mocks Experimental Feature - With.Mocks
I'm going to stray from my usual quick release cycle for Rhino Mocks for this feature. The idea is to take this idea and apply it to Rhino Mocks.
Here is the result that I have at the moment:
[Test]
public void UsingTheWithMocksConstruct()
{
With.Mocks(delegate
{
IDemo demo = Mocker.Current.CreateMock<IDemo>();
Expect.Call(demo.ReturnIntNoArgs()).Return(5);
Mocker.Current.ReplayAll();
Assert.AreEqual(5, demo.ReturnIntNoArgs());
});
}
This is very similar to what we have when MockRepository implemented IDisposable, and it has non of the limitations that we run into using the using() statement. This is in the source repository only at the moment, since I'm still toying around with the idea. I would love to get some feedback about this.
You can see the relevant tests here.
Comments
Comment preview