- http://www.chrisbrandsma.com/2007/09/rhino-mocks-new-syntax.html
- http://aspalliance.com/1400_Beginning_to_Mock_with_Rhino_Mocks_and_MbUnit__Part_1.all
The old way:
[Test] public void MyOldTest() { // Record your expectations here Expect.Call(myObject.MyProperty).Return(1); mocks.ReplayAll(); // do your work here int i = myObject.MyProperty; // check you values mocks.VerifyAll(); Assert.AreEqual(1, i); }
The new way:
[Test] public void MyNewTest() { // Record your expectations here using ( mocks.Record() ) { Expect.Call(myObject.MyProperty).Return(1); } // do your work here int i; using ( mocks.Playback() ) { i = myObject.MyProperty; } // check you values Assert.AreEqual(1, i); }