예제 #1
0
        public void CanMockGenericMethodInGenericClass()
        {
            GenericTestClass <string> t = MockRepository.Mock <GenericTestClass <string> >();

            t.Expect(x => x.GenericMethod <int>("foo"))
            .Return(42);

            Assert.Equal(42, t.GenericMethod <int>("foo"));
            t.VerifyAllExpectations();
        }
예제 #2
0
        public void CanMockGenericMethodInGenericClass()
        {
            GenericTestClass <string> t = MockRepository.Mock <GenericTestClass <string> >();

            t.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            t.Expect(x => x.GenericMethod <int>("foo"))
            .Return(42);

            Assert.Equal(42, t.GenericMethod <int>("foo"));
            t.VerifyAllExpectations();
        }