public async Task SRV_Fail_Test() { var query = new DnsQuery("_unknown._tcp.imprezzio.org", DnsRecordType.SRV); DnsEntry[] records = await query.TryResolve(); Assert.AreEqual(0, records.Length); Assert.AreEqual(DnsQueryStatus.NotFound, query.QueryStatus); }
public void Extreme_DNS_Test() { const int TIME = 2, COUNT = TIME * 2000; var stopAt = DateTime.Now.AddMinutes(TIME); while (DateTime.Now < stopAt) { var tasks = new List <Task>(); var exceptions = new List <Exception>(); for (var i = 0; i < COUNT; i++) { var dns = new DnsQuery("zbox.kmb.home", DnsRecordType.A); tasks.Add(dns.TryResolve().ContinueWith(t => { try { var res = t.Result; } catch (Exception ex) { exceptions.Add(ex); } })); } Task.WaitAll(tasks.ToArray()); if (exceptions.Count > 0) { throw new AggregateException(exceptions); } Console.WriteLine("{0} Queried at {1:G}", COUNT, DateTime.Now); Task.Delay(TimeSpan.FromSeconds(TIME)).Wait(); } }