Пример #1
0
        private GeolocatorResponse CreateGeolocationResponse(MapquestGeolocationResponse mapquestResponse)
        {
            EnsureMapquestResponseContainsGeolocation(mapquestResponse);

            var geoResponse = new GeolocatorResponse();

            geoResponse.LatitudeLongitude.Latitude  = mapquestResponse.Results.First().Locations.First().LatitudeLongitude.Latitude;
            geoResponse.LatitudeLongitude.Longitude = mapquestResponse.Results.First().Locations.First().LatitudeLongitude.Longitude;
            return(geoResponse);
        }
Пример #2
0
        private void EnsureMapquestResponseContainsGeolocation(MapquestGeolocationResponse mapquestResponse)
        {
            if (mapquestResponse.Results.FirstOrDefault() == null)
            {
                throw new GetARyderEmptyGeolocationException("Mapquest did not return any results when attempting to geolocate.");
            }

            if (mapquestResponse.Results.First().Locations.FirstOrDefault() == null)
            {
                throw new GetARyderEmptyGeolocationException("Mapquest did not return any locations when attempting to geolocate.");
            }
        }
Пример #3
0
 public void SetMapquestGeolocationResponse(MapquestGeolocationResponse mapquestGeolocationResponse)
 {
     ExpectedMapquestGeolocationResponse = mapquestGeolocationResponse;
 }