Inheritance: IIpAddressReverser
Esempio n. 1
0
        public void ReverseTests(string ipAddress, string expected)
        {
            var reverser = new IpAddressReverser();

            string result = reverser.Reverse(ipAddress);

            Assert.Equal(expected, result);
        }
Esempio n. 2
0
        private static DnsSpamLookupResult FromStore(string tenant, string ipAddress)
        {
            var lookupServers = GetRblServers(tenant);
            var reverser = new IpAddressReverser();
            var resolver = new HostEntryResolver();
            var queryable = new DnsQueryable(resolver);

            var lookup = new DnsSpamLookup(reverser, queryable, lookupServers);
            return lookup.IsListedInSpamDatabase(ipAddress);
        }
Esempio n. 3
0
        public void IsListedInSpamDatabaseTest(string ipAddress, bool isSpammer)
        {
            var lookupServers = new []{""};
            var reverser = new IpAddressReverser();
            var resolver = new FakeHostEntryResolver();
            var queryable = new DnsQueryable(resolver);

            var lookup = new DnsSpamLookup(reverser, queryable, lookupServers);
            var result = lookup.IsListedInSpamDatabase(ipAddress);

            Assert.Equal(isSpammer, result.IsListed);
        }
Esempio n. 4
0
        public IPHostEntry GetHostEntry(string address)
        {
            var reverser = new IpAddressReverser();
            string server = string.Empty;

            foreach (var ipAddress in this.Spammers)
            {
                string reversed = reverser.Reverse(ipAddress.ToString()) + "." + server;
                if (reversed.Equals(address))
                {
                    return new IPHostEntry
                    {
                        AddressList = this.FakeRblServers.ToArray()
                    };
                }
            }

            return new IPHostEntry();
        }