public void ConnectionRefusedAsync(bool pooled)
{
var csb = new NpgsqlConnectionStringBuilder(ConnectionString) { Port = 44444, Pooling = pooled };
using (var conn = new NpgsqlConnection(csb))
{
Assert.That(async () => await conn.OpenAsync(), Throws.Exception
.TypeOf<SocketException>()
.With.Property(nameof(SocketException.SocketErrorCode)).EqualTo(SocketError.ConnectionRefused)
);
Assert.That(conn.FullState, Is.EqualTo(ConnectionState.Closed));
}
}
#endif