public void MockInterfaceWithGenericMethodWithConstraints_UsingDynamicMock() { ITestInterface mockObj = MockRepository.MockWithRemoting <ITestInterface>(); mockObj.AddService <IDisposable, SqlConnection>(); mockObj.VerifyAllExpectations(); }
public void MockInterfaceWithGenericMethodWithConstraints_UsingDynamicMock() { ITestInterface mockObj = MockRepository.MockWithRemoting <ITestInterface>(); mockObj.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault); mockObj.AddService <IDisposable, SqlConnection>(); mockObj.VerifyAllExpectations(); }
public void MockInterfaceWithGenericMethodWithConstraints_WhenNotValid_UsingDynamicMock() { ITestInterface mockObj = MockRepository.MockWithRemoting <ITestInterface>(); mockObj.Expect(x => x.AddService <IDisposable, SqlConnection>()) .Return(mockObj); Assert.Throws <ExpectationViolationException>( () => mockObj.VerifyAllExpectations()); }
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()); }