コード例 #1
0
        /// <summary> Constructs a DNS query request object for given domain name to resolve. </summary>
        /// <param name="domainNameToResolve">Domain name to resolve. E.g. www.microsoft.com</param>
        /// <returns>Dns query request object.</returns>
        public DnsRequestMessage ProcessRequest(string domainNameToResolve)
        {
            ushort           headerId = GetNextUniqueId();
            DnsRequestHeader header   = new DnsRequestHeader(headerId, true, DnsOpCode.Query);

            DnsQuestion       question = new DnsQuestion(dnsString.Parse(domainNameToResolve), QueryType.A, QueryClass.IN);
            DnsRequestMessage message  = new DnsRequestMessage(header, question);

            return(message);
        }
コード例 #2
0
        public void Parse_should_successfully_parse_given_queryString(string query, string parsedValue)
        {
            // Arrange.

            // Act.
            IDnsString resultString = dnsString.Parse(query);

            // Assert.
            Assert.AreEqual(parsedValue, resultString.Value);
        }