Exemplo n.º 1
0
        private static async Task TestGetHostAddressesAsync(Func <Task <IPAddress[]> > getHostAddressesFunc)
        {
            Task <IPAddress[]> hostEntryTask1 = getHostAddressesFunc();
            Task <IPAddress[]> hostEntryTask2 = getHostAddressesFunc();

            await TestSettings.WhenAllOrAnyFailedWithTimeout(hostEntryTask1, hostEntryTask2);

            IPAddress[] list1 = hostEntryTask1.Result;
            IPAddress[] list2 = hostEntryTask2.Result;

            Assert.NotNull(list1);
            Assert.NotNull(list2);

            Assert.Equal(list1.Length, list2.Length);

            var set = new HashSet <IPAddress>();

            for (int i = 0; i < list1.Length; i++)
            {
                Assert.Equal(list1[i], list2[i]);
                Assert.True(set.Add(list1[i]), "Multiple entries for address " + list1[i]);
            }
        }
Exemplo n.º 2
0
        public async Task Dns_GetHostEntryAsync_IPAddress_Ok()
        {
            IPAddress localIPAddress = await TestSettings.GetLocalIPAddress();

            TestGetHostEntryAsync(() => Dns.GetHostEntryAsync(localIPAddress));
        }
Exemplo n.º 3
0
        public async Task GetHostEntryAsyncWithAddress()
        {
            IPAddress localIPAddress = await TestSettings.GetLocalIPAddress();

            GetHostEntryAsync(() => Dns.GetHostEntryAsync(localIPAddress));
        }