Example #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();
        }
Example #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();
        }