public void It_should_open_connection() { var connectionInfo = CreateValidConnectionInfo(); var connection = new PLinkConnection(connectionInfo); var observer = new ConnectionObserver(); connection.Observer = observer; connection.Open(); WaitForExit(connection); observer.AppliedStates.Should().Contain(ConnectionState.Opening); observer.AppliedStates.Should().Contain(ConnectionState.Open); observer.AppliedStates.Should().Contain(ConnectionState.Closing); observer.AppliedStates.Should().Contain(ConnectionState.Closed); }
public void It_should_handle_invalid_hostname() { var connectionInfo = CreateValidConnectionInfo(); connectionInfo.HostName = "foo"; var connection = new PLinkConnection(connectionInfo); var observer = new ConnectionObserver(); connection.Observer = observer; connection.Open(); WaitForExit(connection); observer.FatalError.Should().Be.EqualTo("Unable to open connection: Host does not exist"); observer.AppliedStates.Should().Contain(ConnectionState.Opening); observer.AppliedStates.Should().Contain(ConnectionState.Closed); }
public void It_should_handle_invalid_password() { var connectionInfo = CreateValidConnectionInfo(); connectionInfo.Password = "******"; var connection = new PLinkConnection(connectionInfo); var observer = new ConnectionObserver(); connection.Observer = observer; connection.Open(); WaitForExit(connection); observer.FatalError.Should().Be.EqualTo("Access Denied"); observer.AppliedStates.Should().Contain(ConnectionState.Opening); observer.AppliedStates.Should().Contain(ConnectionState.Closing); observer.AppliedStates.Should().Contain(ConnectionState.Closed); }