コード例 #1
0
        public void Match_Ip()
        {
            var whitelist = new Whitelist(
                new IPAddress[] { IPAddress.Parse("127.0.0.1") },
                new Regex[] { });

            Assert.IsTrue(whitelist.Match(IPAddress.Parse("127.0.0.1")));
        }
コード例 #2
0
        public void Match_Regex()
        {
            var whitelist = new Whitelist(
                new IPAddress[] { },
                new Regex[] { new Regex("^(dns|mail)\\.google$") });

            Assert.IsTrue(whitelist.Match(IPAddress.Parse("8.8.8.8")));
        }
コード例 #3
0
        public void Match_Nothing()
        {
            var whitelist = new Whitelist(
                new IPAddress[] { },
                new Regex[] { });

            Assert.IsFalse(whitelist.Match(IPAddress.Parse("127.0.0.1")));
        }
コード例 #4
0
        public void Match_LookupError()
        {
            var whitelist = new Whitelist(
                new IPAddress[] { },
                new Regex[] { });

            // 192.0.2.0/24 reserved for testing, should yield no host
            Assert.IsFalse(whitelist.Match(IPAddress.Parse("192.0.2.1")));
        }