public void GetUrl_no_Address_set() { Assert.Throws <InvalidOperationException>(() => { var req = new GeocodingRequest(); //req.Address = something; var actual = req.ToUri(); }); }
public void LatLng_for_address_will_invoke_reverse_geocoding() { var req = new GeocodingRequest(); req.Address = new LatLng(-30.1d, 40.2d); //using -30.1f,40.2f gives precision error beyond 6 digits when using format "R". strange. Uri expected = new Uri("json?latlng=-30.1,40.2", UriKind.Relative); Uri actual = req.ToUri(); Assert.AreEqual(expected, actual); }
public void Implicit_PlaceId_set_from_string() { var req = new GeocodingRequest(); req.PlaceId = "ChIJN1t_tDeuEmsRUsoyG83frY4"; // Google Uri expected = new Uri("json?place_id=ChIJN1t_tDeuEmsRUsoyG83frY4", UriKind.Relative); Uri actual = req.ToUri(); Assert.AreEqual(expected, actual); }
/// <summary> /// Sends the specified request to the Google Maps Geocoding web /// service and parses the response as an GeocodingResponse /// object. /// </summary> /// <param name="request"></param> /// <returns></returns> public GeocodeResponse GetResponse(GeocodingRequest request) { var url = new Uri(this.BaseUri, request.ToUri()); return Internal.Http.Get(url).As<GeocodeResponse>(); }
public async Task <GeocodeResponse> GetResponseAsync(GeocodingRequest request) { var url = new Uri(baseUri, request.ToUri()); return(await http.GetAsync <GeocodeResponse>(url)); }
/// <summary> /// Sends the specified request to the Google Maps Geocoding web /// service and parses the response as an GeocodingResponse /// object. /// </summary> /// <param name="request"></param> /// <returns></returns> public GeocodeResponse GetResponse(GeocodingRequest request) { var url = new Uri(baseUri, request.ToUri()); return(http.Get <GeocodeResponse>(url)); }
/// <summary> /// Sends the specified request to the Google Maps Geocoding web /// service and parses the response as an GeocodingResponse /// object. /// </summary> /// <param name="request"></param> /// <returns></returns> public GeocodeResponse GetResponse(GeocodingRequest request) { var url = new Uri(this.BaseUri, request.ToUri()); return(Internal.Http.Get(url).As <GeocodeResponse>()); }