public void Test() { SimpleOperations myMock = MockRepository.Partial <SimpleOperations>(); myMock.Expect(x => x.AddTwoValues(1, 2)) .Return(3); Assert.Equal(3, myMock.AddTwoValues(1, 2)); myMock.VerifyExpectations(); }
public void Test() { MockRepository mocks = new MockRepository(); SimpleOperations myMock = mocks.StrictMock <SimpleOperations>(); Expect.Call(myMock.AddTwoValues(1, 2)).Return(3); mocks.ReplayAll(); Assert.Equal(3, myMock.AddTwoValues(1, 2)); mocks.VerifyAll(); }
public void Test() { SimpleOperations myMock = MockRepository.Partial <SimpleOperations>(); myMock.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault); myMock.Expect(x => x.AddTwoValues(1, 2)) .Return(3); Assert.Equal(3, myMock.AddTwoValues(1, 2)); myMock.VerifyExpectations(); }