コード例 #1
0
        public void MockGenericMethod1()
        {
            MockRepository mocks   = new MockRepository();
            IWithGeneric1  stubbed = mocks.StrictMock <IWithGeneric1>();

            byte myValue       = 3;
            int  returnedValue = 3;

            Expect.Call(stubbed.DoNothing <byte>(myValue)).Return(returnedValue);
            mocks.ReplayAll();
            int x = stubbed.DoNothing <byte>(myValue);

            Assert.Equal(myValue, x);

            mocks.VerifyAll();
        }
コード例 #2
0
        public void MockGenericMethod1()
        {
            byte myValue       = 3;
            int  returnedValue = 3;

            IWithGeneric1 stubbed = MockRepository.Mock <IWithGeneric1>();

            stubbed.Expect(s => s.DoNothing <byte>(myValue))
            .Return(returnedValue);

            int x = stubbed.DoNothing <byte>(myValue);

            Assert.Equal(myValue, x);

            stubbed.VerifyExpectations(true);
        }