Пример #1
0
        private void ResolveA(DnsClient client, string domain)
        {
            IEnumerable <DnsResourceRecord> expectedMatches = s_recordTable[domain, DnsStandard.RecordType.ANAME];
            IEnumerable <AddressRecord>     matches         = client.ResolveA(domain);

            Assert.True(Equals(matches, expectedMatches));
        }
Пример #2
0
 public static IEnumerable <AddressRecord> ResolveA(TestServer server, string domain, bool useUDP)
 {
     using (DnsClient client = server.CreateClient())
     {
         client.UseUDPFirst = useUDP;
         return(client.ResolveA(domain));
     }
 }
Пример #3
0
        public void TestNoNagle()
        {
            // test using a server with Nagle turned off
            using (FakeServer server = new FakeServer(TestStore.Default.Store, 53535))
            {
                server.Start();
                using (DnsClient client = new DnsClient("127.0.0.1", 53535))
                {
                    client.UseUDPFirst = false;
                    client.Timeout     = TimeSpan.FromSeconds(10);

                    server.BeginAccept();
                    Assert.True(client.ResolveA("foo.com").Count() == 3);

                    TextRecord[] txtRecords = null;

                    server.BeginAccept();

                    Assert.Null(Record.Exception(() => txtRecords = client.ResolveTXT("bigrecord.com").ToArray()));
                    Assert.True(txtRecords != null && txtRecords.Length == 1);
                    Assert.True(txtRecords[0].Strings.Count == 128);
                }
            }
        }