示例#1
0
        public void CanMockGenericClass()
        {
            MockRepository            mocks = new MockRepository();
            GenericTestClass <string> t     = (GenericTestClass <string>)mocks.StrictMock(typeof(GenericTestClass <string>));

            Expect.Call(t.Method("foo")).Return(42);
            mocks.ReplayAll();
            Assert.Equal(42, t.Method("foo"));
            mocks.VerifyAll();
        }
示例#2
0
        public void CanMockGenericClass()
        {
            GenericTestClass <string> t = MockRepository.Mock <GenericTestClass <string> >();

            t.Expect(x => x.Method("foo"))
            .Return(42);

            Assert.Equal(42, t.Method("foo"));
            t.VerifyAllExpectations();
        }
示例#3
0
        public void CanMockGenericClass()
        {
            GenericTestClass <string> t = MockRepository.Mock <GenericTestClass <string> >();

            t.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            t.Expect(x => x.Method("foo"))
            .Return(42);

            Assert.Equal(42, t.Method("foo"));
            t.VerifyAllExpectations();
        }