Exemplo n.º 1
0
        public void TestDomainCheckNominetResponse()
        {

            var eppResponse =
                new DomainCheckResponse(
                    ToBytes(
                        @"<?xml version=""1.0"" encoding=""UTF-8"" standalone=""no""?>
<epp xmlns=""urn:ietf:params:xml:ns:epp-1.0""
      xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
      xsi:schemaLocation=""http://www.nominet.org.uk/epp/xml/epp-1.0 epp-1.0.xsd"">
  <response>
    <result code=""1000"">
      <msg>Command completed successfully</msg>
    </result>
    <resData>
      <domain:chkData
        xmlns:domain=""urn:ietf:params:xml:ns:domain-1.0""
        xsi:schemaLocation=""urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"">
        <domain:cd>
          <domain:name avail=""1"">testing.co.uk</domain:name>
        </domain:cd>
      </domain:chkData>
    </resData>
    <trID>
      <clTRID>EPP-e331cb97-e073-43fa-9f31-dc0249d79c82</clTRID>
      <svTRID>231770</svTRID>
    </trID>
  </response>
</epp>
"));

            if (eppResponse.Results.Count > 0)
            {
                Console.WriteLine("Domain is available: {0}", eppResponse.Results[0].Available);
            }
            else
            {
                Console.WriteLine("Error");
            }

        }
Exemplo n.º 2
0
        public void TestDomainCheckResponse1()
        {
            byte[] input = File.ReadAllBytes("DomainCheckResponse1.xml");
            var response = new DomainCheckResponse(input);

            Assert.AreEqual("1000", response.Code);
            Assert.AreEqual("Command completed successfully", response.Message);

            List<DomainCheckResult> expectedResults = new List<DomainCheckResult>()
                    {
                        new DomainCheckResult()
                        {
                            Name = "example.com",
                            Available = true,
                            Reason = null
                        },
                        new DomainCheckResult()
                        {
                            Name = "example.net",
                            Available = false,
                            Reason = "In use"
                        },
                        new DomainCheckResult()
                        {
                            Name = "example.org",
                            Available = true,
                            Reason = null
                        }
                    };

            CollectionAssert.AreEqual(expectedResults.ToArray(), response.Results.ToArray());

            Assert.AreEqual("ABC-12345", response.ClientTransactionId);
            Assert.AreEqual("54322-XYZ", response.ServerTransactionId);
        }