public void MockInterfaceWithGenericMethodWithConstraints() { MockRepository mockery = new MockRepository(); ITestInterface mockObj = mockery.StrictMockWithRemoting <ITestInterface>(); mockObj.AddService <IDisposable, SqlConnection>(); LastCall.Return(mockObj); mockery.ReplayAll(); mockObj.AddService <IDisposable, SqlConnection>(); mockery.VerifyAll(); }
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_UsingDynamicMock() { MockRepository mockery = new MockRepository(); ITestInterface mockObj = mockery.DynamicMockWithRemoting <ITestInterface>(); mockery.ReplayAll(); mockObj.AddService <IDisposable, SqlConnection>(); mockery.VerifyAll(); }
public void MockInterfaceWithGenericMethodWithConstraints_WhenNotValid_UsingDynamicMock() { MockRepository mockery = new MockRepository(); ITestInterface mockObj = mockery.DynamicMockWithRemoting <ITestInterface>(); mockObj.AddService <IDisposable, SqlConnection>(); LastCall.Return(mockObj); mockery.ReplayAll(); Assert.Throws <ExpectationViolationException>( "ITestInterface.AddService<System.IDisposable, System.Data.SqlClient.SqlConnection>(); Expected #1, Actual #0.", () => mockery.VerifyAll()); }