コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
        }