public void OpenConnectionShouldNotBeOpenedAgain() { var connection = NewConnection(); connection.Setup(x => x.State).Returns(ConnectionState.Open); var testHelper = new TestConnectionHelper(); testHelper.TestOpenState(connection.Object); connection.Setup(x => x.State).Returns(ConnectionState.Connecting); testHelper.TestOpenState(connection.Object); connection.Verify(x => x.Open(), Times.Never); }
public void ConnectionShouldBeOpenedSynchronously() { var connection = NewConnection(); connection.Setup(x => x.State).Returns(ConnectionState.Closed); connection.Setup(x => x.Open()); var testHelper = new TestConnectionHelper(); testHelper.TestOpenState(connection.Object); connection.Verify(x => x.Open(), Times.Once); }