示例#1
0
        public void MockInterfaceWithGenericMethodWithConstraints_UsingDynamicMock()
        {
            ITestInterface mockObj = MockRepository.MockWithRemoting <ITestInterface>();

            mockObj.AddService <IDisposable, SqlConnection>();
            mockObj.VerifyAllExpectations();
        }
示例#2
0
        public void MockInterfaceWithGenericMethodWithConstraints_UsingDynamicMock()
        {
            ITestInterface mockObj = MockRepository.MockWithRemoting <ITestInterface>();

            mockObj.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            mockObj.AddService <IDisposable, SqlConnection>();
            mockObj.VerifyAllExpectations();
        }
示例#3
0
        public void MockInterfaceWithGenericMethodWithConstraints_WhenNotValid_UsingDynamicMock()
        {
            ITestInterface mockObj = MockRepository.MockWithRemoting <ITestInterface>();

            mockObj.Expect(x => x.AddService <IDisposable, SqlConnection>())
            .Return(mockObj);

            Assert.Throws <ExpectationViolationException>(
                () => mockObj.VerifyAllExpectations());
        }
示例#4
0
        public void MockInterfaceWithGenericMethodWithConstraints_WhenNotValid()
        {
            ITestInterface mockObj = MockRepository.MockWithRemoting <ITestInterface>();

            mockObj.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            mockObj.Expect(x => x.AddService <IDisposable, SqlConnection>())
            .Return(mockObj);

            Assert.Throws <ExpectationViolationException>(
                () => mockObj.VerifyAllExpectations());
        }