Пример #1
0
        public async Task RangesTest() => await BaseTests.ApiTestAsync(async (api, cancellationToken) =>
        {
            var response = await api.GetRangesAsync("comcast.net", cancellationToken);

            Assert.IsNotNull(response, nameof(response));
            Console.WriteLine(response.GetPropertiesText());
        });
Пример #2
0
        public async Task HostedDomainsTest() => await BaseTests.ApiTestAsync(async (api, cancellationToken) =>
        {
            var response = await api.GetDomainsAsync("1.1.1.1", cancellationToken);

            Assert.IsNotNull(response, nameof(response));
            Console.WriteLine(response.GetPropertiesText());
        });
Пример #3
0
        public async Task GetPrivacyInformationByIpTest() => await BaseTests.ApiTestAsync(async (api, cancellationToken) =>
        {
            var response = await api.GetPrivacyInformationByIpAsync("8.8.8.8", cancellationToken);

            Assert.IsNotNull(response, nameof(response));
            Console.WriteLine(response.GetPropertiesText());
        });
Пример #4
0
        public async Task BatchTest() => await BaseTests.ApiTestAsync(async (api, cancellationToken) =>
        {
            var dictionary = await api.BatchAsync(new []
            {
                "8.8.8.8",
                "8.8.8.8/city",
            }, cancellationToken);

            Assert.IsNotNull(dictionary, nameof(dictionary));

            foreach (var pair in dictionary)
            {
                Console.WriteLine($"{pair.Key}: {pair.Value}");
            }
        });
Пример #5
0
        public async Task GetInformationByIpsTest() => await BaseTests.ApiTestAsync(async (api, cancellationToken) =>
        {
            var dictionary = await api.GetInformationByIpsAsync(new[]
            {
                "8.8.8.8",
                "8.8.4.4",
            }, cancellationToken);

            Assert.IsNotNull(dictionary, nameof(dictionary));

            foreach (var pair in dictionary)
            {
                Assert.IsNotNull(pair.Value, nameof(pair.Value));

                Console.WriteLine($"{pair.Key}:");
                foreach (var property in pair.Value.GetType().GetProperties())
                {
                    Console.WriteLine($"  {property.Name}: {property.GetValue(pair.Value)}");
                }
                Console.WriteLine();
            }
        });