示例#1
0
        public void TestTokenMatcherCom()
        {
            var template = ReadTemplate("whois.iana");
            var input    = ReadData("com");

            var result = tokenizer.Tokenize(template, input);

            Assert.AreEqual(39, result.Matches.Count);
            AssertWriter.Write(result);
        }
示例#2
0
        public void TestParseAbogadoData()
        {
            var pattern = ReadTemplate("whois.iana");
            var input   = ReadData("abogado");

            var result = tokenizer.Tokenize(pattern, input);

            AssertWriter.Write(result);

            Assert.AreEqual("abogado", result.First("Tld"));
            Assert.AreEqual("Minds + Machines Group Limited", result.First("Organization.Name"));

            Assert.AreEqual(2, result.All("Organization.Address").Count);
            Assert.AreEqual("Craigmuir Chambers, Road Town Tortola VG 1110", result.All("Organization.Address")[0]);
            Assert.AreEqual("Virgin Islands, British", result.All("Organization.Address")[1]);

            Assert.AreEqual("Admin Contact", result.First("AdminContact.Name"));
            Assert.AreEqual("Minds + Machines Ltd", result.First("AdminContact.Organization"));

            Assert.AreEqual(2, result.All("AdminContact.Address").Count);
            Assert.AreEqual("32 Nassau St, Dublin 2", result.All("AdminContact.Address")[0]);
            Assert.AreEqual("Ireland", result.All("AdminContact.Address")[1]);

            Assert.AreEqual("+1-877-734-4783", result.First("AdminContact.TelephoneNumber"));
            Assert.AreEqual("*****@*****.**", result.First("AdminContact.Email"));
            Assert.AreEqual("TLD Registry Services Technical", result.First("TechContact.Name"));
            Assert.AreEqual("Nominet", result.First("TechContact.Organization"));

            Assert.AreEqual(6, result.All("TechContact.Address").Count);
            Assert.AreEqual("Minerva House,", result.All("TechContact.Address")[0]);
            Assert.AreEqual("Edmund Halley Road,", result.All("TechContact.Address")[1]);
            Assert.AreEqual("Oxford Science Park,", result.All("TechContact.Address")[2]);
            Assert.AreEqual("Oxford,", result.All("TechContact.Address")[3]);
            Assert.AreEqual("OX4 4DQ", result.All("TechContact.Address")[4]);
            Assert.AreEqual("United Kingdom", result.All("TechContact.Address")[5]);

            Assert.AreEqual("+44.1865332211", result.First("TechContact.TelephoneNumber"));
            Assert.AreEqual("*****@*****.**", result.First("TechContact.Email"));

            Assert.AreEqual(8, result.All("NameServers").Count);
            Assert.AreEqual("DNS1.NIC.ABOGADO 213.248.217.13 2a01:618:401:0:0:0:0:13", result.All("NameServers")[0]);
            Assert.AreEqual("DNS2.NIC.ABOGADO 103.49.81.13 2401:fd80:401:0:0:0:0:13", result.All("NameServers")[1]);
            Assert.AreEqual("DNS3.NIC.ABOGADO 213.248.221.13 2a01:618:405:0:0:0:0:13", result.All("NameServers")[2]);
            Assert.AreEqual("DNS4.NIC.ABOGADO 2401:fd80:405:0:0:0:0:13 43.230.49.13", result.All("NameServers")[3]);
            Assert.AreEqual("DNSA.NIC.ABOGADO 156.154.100.3 2001:502:ad09:0:0:0:0:3", result.All("NameServers")[4]);
            Assert.AreEqual("DNSB.NIC.ABOGADO 156.154.101.3", result.All("NameServers")[5]);
            Assert.AreEqual("DNSC.NIC.ABOGADO 156.154.102.3", result.All("NameServers")[6]);
            Assert.AreEqual("DNSD.NIC.ABOGADO 156.154.103.3", result.All("NameServers")[7]);

            Assert.AreEqual("whois.nic.abogado", result.First("Url"));
            Assert.AreEqual("Registration information: http://mm-registry.com", result.First("Remarks"));
            Assert.AreEqual("2014-07-10", result.First("Created"));
            Assert.AreEqual("2018-06-29", result.First("Changed"));
            Assert.AreEqual("Found", result.First("Status"));
        }
示例#3
0
        public void TestWhoisCoop()
        {
            var template = ReadTemplate("whois.coop");
            var input    = ReadData("moscowfood.coop");

            var result = tokenizer.Tokenize(template, input);

            AssertWriter.Write(result);
            Assert.AreEqual("5662D-COOP", result.First("RegistryDomainId"));
            Assert.AreEqual("moscowfood.coop", result.First("DomainName"));
            Assert.AreEqual(new DateTime(2013, 01, 30, 00, 00, 00, 000, DateTimeKind.Utc), result.First("Expiration"));

            Assert.AreEqual(3, result.All("DomainStatus").Count);
            Assert.AreEqual("clientDeleteProhibited", result.All("DomainStatus")[0]);
            Assert.AreEqual("clientTransferProhibited", result.All("DomainStatus")[1]);
            Assert.AreEqual("clientUpdateProhibited", result.All("DomainStatus")[2]);

            Assert.AreEqual("Domain Bank Inc.", result.First("Registrar.Name"));
            Assert.AreEqual("31", result.First("Registrar.IanaId"));
            Assert.AreEqual(new DateTime(2001, 10, 09, 04, 36, 36, 000, DateTimeKind.Utc), result.First("Registered"));
            Assert.AreEqual("registrant", result.First("Type"));
            Assert.AreEqual("71764C-COOP", result.First("Contact.Id"));
            Assert.AreEqual("Kenna Eaton", result.First("Contact.Name"));
            Assert.AreEqual("Moscow Food Co-op", result.First("Contact.Organization"));

            Assert.AreEqual(5, result.All("Address").Count);
            Assert.AreEqual("P. O. Box 9485", result.All("Address")[0]);
            Assert.AreEqual("Moscow", result.All("Address")[1]);
            Assert.AreEqual("ID", result.All("Address")[2]);
            Assert.AreEqual("83843", result.All("Address")[3]);
            Assert.AreEqual("United States", result.All("Address")[4]);

            Assert.AreEqual("+1.2088828537", result.First("Phone"));
            Assert.AreEqual("+1.2088828082", result.First("Fax"));

            Assert.AreEqual(4, result.All("Email").Count);
            Assert.AreEqual("*****@*****.**", result.All("Email")[0]);
            Assert.AreEqual("*****@*****.**", result.All("Email")[1]);
            Assert.AreEqual("*****@*****.**", result.All("Email")[2]);
            Assert.AreEqual("*****@*****.**", result.All("Email")[3]);


            Assert.AreEqual(2, result.All("NameServers").Count);
            Assert.AreEqual("ns2.west-datacenter.net", result.All("NameServers")[0]);
            Assert.AreEqual("ns1.west-datacenter.net", result.All("NameServers")[1]);

            Assert.AreEqual("Found", result.First("Status"));
        }
示例#4
0
        public void TestWhoisVe()
        {
            var template = ReadTemplate("whois.ve");
            var input    = ReadData("aloespa.com.ve");

            var result = tokenizer.Tokenize(template, input);

            AssertWriter.Write(result);
            Assert.AreEqual("Rafael Perez", result.First("Registrant.Name"));
            Assert.AreEqual("aloespa.com.ve-dom", result.First("Registrant.RegistryId"));
            Assert.AreEqual("*****@*****.**", result.First("Registrant.Email"));

            Assert.AreEqual(3, result.All("Registrant.Address").Count);
            Assert.AreEqual("Rafael Perez", result.All("Registrant.Address")[0]);
            Assert.AreEqual("Caracas", result.All("Registrant.Address")[1]);
            Assert.AreEqual("Caracas, D. Federal  VE", result.All("Registrant.Address")[2]);

            Assert.AreEqual("aloespa.com.ve", result.First("DomainName"));
            Assert.AreEqual("Tepuynet", result.First("AdminContact.Name"));
            Assert.AreEqual("aloespa.com.ve-adm", result.First("AdminContact.RegistryId"));
            Assert.AreEqual("*****@*****.**", result.First("AdminContact.Email"));

            Assert.AreEqual(3, result.All("AdminContact.Address").Count);
            Assert.AreEqual("Tepuynet C.A.", result.All("AdminContact.Address")[0]);
            Assert.AreEqual("Av. Bolivar Norte Torre Banaven, Piso 9 Ofic. 9-9", result.All("AdminContact.Address")[1]);
            Assert.AreEqual("Valencia, Carabobo  VE", result.All("AdminContact.Address")[2]);

            Assert.AreEqual("2418246437", result.First("AdminContact.TelephoneNumber"));
            Assert.AreEqual("2418246437", result.First("AdminContact.FaxNumber"));
            Assert.AreEqual("Tepuynet", result.First("TechnicalContact.Name"));
            Assert.AreEqual("aloespa.com.ve-tec", result.First("TechnicalContact.RegistryId"));
            Assert.AreEqual("*****@*****.**", result.First("TechnicalContact.Email"));

            Assert.AreEqual(3, result.All("TechnicalContact.Address").Count);
            Assert.AreEqual("Tepuynet C.A.", result.All("TechnicalContact.Address")[0]);
            Assert.AreEqual("Av. Bolivar Norte Torre Banaven, Piso 9 Ofic. 9-9", result.All("TechnicalContact.Address")[1]);
            Assert.AreEqual("Valencia, Carabobo  VE", result.All("TechnicalContact.Address")[2]);

            Assert.AreEqual("2418246437", result.First("TechnicalContact.TelephoneNumber"));
            Assert.AreEqual("2418246437", result.First("TechnicalContact.FaxNumber"));
            Assert.AreEqual("Tepuynet", result.First("BillingContact.Name"));
            Assert.AreEqual("aloespa.com.ve-bil", result.First("BillingContact.RegistryId"));
            Assert.AreEqual("*****@*****.**", result.First("BillingContact.Email"));

            Assert.AreEqual(3, result.All("BillingContact.Address").Count);
            Assert.AreEqual("Tepuynet C.A.", result.All("BillingContact.Address")[0]);
            Assert.AreEqual("Av. Bolivar Norte Torre Banaven, Piso 9 Ofic. 9-9", result.All("BillingContact.Address")[1]);
            Assert.AreEqual("Valencia, Carabobo  VE", result.All("BillingContact.Address")[2]);

            Assert.AreEqual("2418246437", result.First("BillingContact.TelephoneNumber"));
            Assert.AreEqual("2418246437", result.First("BillingContact.FaxNumber"));
            Assert.AreEqual(new DateTime(2010, 11, 21, 15, 21, 32, 000, DateTimeKind.Utc), result.First("Expiration"));
            Assert.AreEqual(new DateTime(2006, 06, 08, 21, 54, 41, 000, DateTimeKind.Utc), result.First("Updated"));
            Assert.AreEqual(new DateTime(2005, 11, 21, 15, 21, 32, 000, DateTimeKind.Utc), result.First("Registered"));
            Assert.AreEqual("SUSPENDIDO", result.First("DomainStatus"));

            Assert.AreEqual(2, result.All("NameServers").Count);
            Assert.AreEqual("ns10.tepuyserver.net", result.All("NameServers")[0]);
            Assert.AreEqual("ns9.tepuyserver.net", result.All("NameServers")[1]);

            Assert.AreEqual("Found", result.First("Status"));
        }