Npgsql.Tests.SecurityTests.RejectSelfSignedCertificate C# (CSharp) Method

RejectSelfSignedCertificate() private method

private RejectSelfSignedCertificate ( bool useSslStream ) : void
useSslStream bool
return void
        public void RejectSelfSignedCertificate(bool useSslStream)
        {
            var csb = new NpgsqlConnectionStringBuilder(ConnectionString)
            {
                SslMode = SslMode.Require,
                UseSslStream = useSslStream
            };

            using (var conn = new NpgsqlConnection(csb))
            {
                // The following is necessary since a pooled connector may exist from a previous
                // SSL test
                NpgsqlConnection.ClearPool(conn);

                // TODO: Specific exception, align with SslStream
                Assert.That(() => conn.Open(), Throws.Exception);
            }
        }