public void UseIpAddressFilter_stores_always_false_filter()
        {
            bool AlwaysFalseIpAddressFilter(IPAddress ipAddress) => false;

            var ldapConnectionOptions = new LdapConnectionOptions()
                                        .ConfigureIpAddressFilter(AlwaysFalseIpAddressFilter);

            var ipAddressV4 = CreateRandomIpAddressV4();

            Assert.Equal(AlwaysFalseIpAddressFilter(ipAddressV4), ldapConnectionOptions.IpAddressFilter(ipAddressV4));
            var ipAddressV6 = CreateRandomIpAddressV6();

            Assert.Equal(AlwaysFalseIpAddressFilter(ipAddressV6), ldapConnectionOptions.IpAddressFilter(ipAddressV6));
        }
        public void New_instance_has_expected_defaults()
        {
            var ldapConnectionOptions = new LdapConnectionOptions();

            Assert.False(ldapConnectionOptions.Ssl);

            var ipAddressV4 = CreateRandomIpAddressV4();

            Assert.True(ldapConnectionOptions.IpAddressFilter(ipAddressV4));

            var ipAddressV6 = CreateRandomIpAddressV6();

            Assert.True(ldapConnectionOptions.IpAddressFilter(ipAddressV6));

            Assert.Empty(ldapConnectionOptions.ClientCertificates);
            Assert.False(ldapConnectionOptions.CheckCertificateRevocationEnabled);

            Assert.Equal(SslProtocols.None, ldapConnectionOptions.SslProtocols);
        }
        public void UseIpAddressFilter_filters_specific_ip_address()
        {
            var ipAddressV4 = CreateRandomIpAddressV4();

            bool IpAddressFilter(IPAddress ipAddress) => ipAddressV4.Equals(ipAddress);

            var ldapConnectionOptions = new LdapConnectionOptions()
                                        .ConfigureIpAddressFilter(IpAddressFilter);

            Assert.True(ldapConnectionOptions.IpAddressFilter(ipAddressV4));
        }