public void Ayende_View_On_Mocking() { ISomeSystem mockSomeSystem = MockRepository.GenerateStrictMock <ISomeSystem>(); mockSomeSystem.Expect(x => x.GetFooFor <ExpectedBar>("foo")) .Return(new List <ExpectedBar>()); ExpectedBarPerformer cut = new ExpectedBarPerformer(mockSomeSystem); Assert.Throws <ExpectationViolationException>( @"ISomeSystem.GetFooFor<Rhino.Mocks.Tests.FieldsProblem.UnexpectedBar>(""foo""); Expected #1, Actual #1. ISomeSystem.GetFooFor<Rhino.Mocks.Tests.FieldsProblem.ExpectedBar>(""foo""); Expected #1, Actual #0.", () => cut.DoStuffWithExpectedBar("foo")); }
public void Ayende_View_On_Mocking() { MockRepository mocks = new MockRepository(); ISomeSystem mockSomeSystem = mocks.StrictMock <ISomeSystem>(); using (mocks.Record()) { Expect.Call(mockSomeSystem.GetFooFor <ExpectedBar>("foo")) .Return(new List <ExpectedBar>()); } Assert.Throws <ExpectationViolationException>( @"ISomeSystem.GetFooFor<Rhino.Mocks.Tests.FieldsProblem.UnexpectedBar>(""foo""); Expected #1, Actual #1. ISomeSystem.GetFooFor<Rhino.Mocks.Tests.FieldsProblem.ExpectedBar>(""foo""); Expected #1, Actual #0.", () => { using (mocks.Playback()) { ExpectedBarPerformer cut = new ExpectedBarPerformer(mockSomeSystem); cut.DoStuffWithExpectedBar("foo"); } } ); }
public ExpectedBarPerformer(ISomeSystem system) { this.system = system; }