public void RecordPlayBackSyntaxUsing() { // Prepare mock repository MockRepository mocks = new MockRepository(); IDependency dependency = mocks.StrictMock<IDependency>(); // Record expectations using (mocks.Record()) { Expect .Call(dependency.SomeMethod()) .Return(null); } // Replay and validate interaction // Replace mocks.ReplayAll && mocks.VerifyAll object result; using (mocks.Playback()) { ComponentImplementation underTest = new ComponentImplementation(dependency); result = underTest.TestMethod(); } // Post-interaction assertions Assert.IsNull(result); }
public void RecordPlayBackSyntaxUsing() { // Prepare mock repository MockRepository mocks = new MockRepository(); IDependency dependency = mocks.StrictMock <IDependency>(); // Record expectations using (mocks.Record()) { Expect .Call(dependency.SomeMethod()) .Return(null); } // Replay and validate interaction // Replace mocks.ReplayAll && mocks.VerifyAll object result; using (mocks.Playback()) { ComponentImplementation underTest = new ComponentImplementation(dependency); result = underTest.TestMethod(); } // Post-interaction assertions Assert.IsNull(result); }