当前位置: 首页>>代码示例>>C#>>正文


C# Request.AddQuestion方法代码示例

本文整理汇总了C#中System.Net.Request.AddQuestion方法的典型用法代码示例。如果您正苦于以下问题:C# Request.AddQuestion方法的具体用法?C# Request.AddQuestion怎么用?C# Request.AddQuestion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.Request的用法示例。


在下文中一共展示了Request.AddQuestion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DNSHelperTest

        public void DNSHelperTest()
        {
            Assert.AreEqual(IPAddress.Parse("208.67.222.222"), DNSHelper.OpenDNS1);
            Assert.AreEqual(IPAddress.Parse("208.67.220.220"), DNSHelper.OpenDNS2);

            var dnsServers = DNSHelper.GetLocalDNS();
            Assert.IsTrue(dnsServers.Any());

            foreach (var dnsServer in dnsServers)
            {
                Request request = new Request();
                request.AddQuestion(new Question("google.com", DnsType.ANAME, DnsClass.IN));
                Response response = Resolver.Lookup(request, dnsServer);

                var address = ((ANameRecord)response.Answers[0].Record).IPAddress;

                Assert.IsNotNull(address);
            }
        }
开发者ID:FreeApophis,项目名称:zensorchecker,代码行数:19,代码来源:ToolsTestsNUnit.cs

示例2: CorrectANameForCodeProject

        public void CorrectANameForCodeProject()
        {
            // also 194.72.0.114
            // create a new request
            var request = new Request();

            // add the codeproject ANAME question
            request.AddQuestion(new Question("codeproject.com", DnsType.ANAME, DnsClass.IN));

            // send the request
            Response response = null;
            multiDnsServerAction.Invoke( dnsServer => response = Resolver.Lookup(request, dnsServer));

            // check the reponse
            Assert.AreEqual(ReturnCode.Success, response.ReturnCode);
            Assert.AreEqual(1, response.Answers.Length);
            var record = (ANameRecord) response.Answers[0].Record;
            Assert.AreEqual(IPAddress.Parse("65.39.148.34"), record.IPAddress);
        }
开发者ID:ra00l,项目名称:Bdev.Net.Dns,代码行数:19,代码来源:CorrectBehaviour.cs

示例3: CorrectNSForCodeProject

        public void CorrectNSForCodeProject()
        {
            // also 194.72.0.114
            // create a new request
            var request = new Request();

            // add the codeproject ANAME question
            request.AddQuestion(new Question("codeproject.com", DnsType.NS, DnsClass.IN));

            // send the request
            Response response = null;
            multiDnsServerAction.Invoke(dnsServer => response= Resolver.Lookup(request, dnsServer));

            // check the reponse
            Assert.AreEqual(ReturnCode.Success, response.ReturnCode);

            // we expect 4 records
            Assert.IsTrue(response.Answers.Length>0);

        }
开发者ID:ra00l,项目名称:Bdev.Net.Dns,代码行数:20,代码来源:CorrectBehaviour.cs

示例4: RepeatedANameLookups

        public void RepeatedANameLookups()
        {
            var request = new Request();

            // add the codeproject ANAME question
            request.AddQuestion(new Question("codeproject.com", DnsType.ANAME, DnsClass.IN));

            for (int i = 0; i < 1000; i++)
            {
                // send the request
                Response response = null;
                multiDnsServerAction.Invoke( dnsServer => response = Resolver.Lookup(request, dnsServer));

                // check the reponse
                Assert.AreEqual(ReturnCode.Success, response.ReturnCode);
                Assert.AreEqual(1, response.Answers.Length);
            }
        }
开发者ID:ra00l,项目名称:Bdev.Net.Dns,代码行数:18,代码来源:CorrectBehaviour.cs


注:本文中的System.Net.Request.AddQuestion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。