Beispiel #1
0
        public void GetGeoLocationData_InvalidInputAddress_ExceptionIsThrown(string address)
        {
            //Arrange
            var ipStackService = new IpStackService(_configuration);

            //Assert
            Assert.Throws <UriFormatException>(() => ipStackService.GetIpAddressDetails(address));
        }
Beispiel #2
0
        public void GetGeoLocationData_ValidIpAddress_SpecialFieldsSelected_GeoLocationDataForSelectedFieldsReturned(string address)
        {
            //Arrange
            var ipStackService = new IpStackService(_configuration);

            //Action
            var result = ipStackService.GetIpAddressDetails(address, includeHostname: true, includeSecurity: true, language: "en");

            //Assert
            Assert.Multiple(() =>
            {
                Assert.IsNotEmpty(result.Hostname);
                Assert.IsNull(result.Security);     // THIS should be null because of free subscription (security is not available)
            });
        }
Beispiel #3
0
        public void GetGeoLocationData_ValidIpAddress_OnlySelectedFields_GeoLocationDataForSelectedFieldsReturned(string address)
        {
            //Arrange
            var ipStackService = new IpStackService(_configuration);

            //Action
            var result = ipStackService.GetIpAddressDetails(address, "ip,country_code,location.capital");

            //Assert
            Assert.Multiple(() =>
            {
                Assert.IsNotEmpty(result.Ip);
                Assert.IsNotEmpty(result.CountryCode);
                Assert.IsNotEmpty(result.Location.Capital);
            });
        }
Beispiel #4
0
        public void GetGeoLocationData_ValidAddress_AllFields_GeoLocationDataForALLNonPaidSubscriptionReturned(string address)
        {
            //Arrange
            var ipStackService = new IpStackService(_configuration);

            //Action
            var result = ipStackService.GetIpAddressDetails(address);

            //Assert
            Assert.Multiple(() =>
            {
                Assert.IsNotEmpty(result.City);
                Assert.IsNotEmpty(result.Ip);
                Assert.IsNotNull(result.Latitude);
                Assert.IsNotNull(result.Longitude);
            });
        }