public void GetUriTest() { var request = new LocationGeocodeRequest { Key = "abc", Location = new Entities.Common.Location(1, 1) }; var uri = request.GetUri(); Assert.IsNotNull(uri); Assert.AreEqual($"/maps/api/geocode/json?key={request.Key}&language={request.Language.ToCode()}&latlng={Uri.EscapeDataString(request.Location.ToString())}", uri.PathAndQuery); }
public void GetUriWhenLocationTypeTest() { var request = new LocationGeocodeRequest { Key = "abc", Location = new Entities.Common.Location(1, 1), LocationTypes = new[] { GeometryLocationType.Rooftop } }; var uri = request.GetUri(); Assert.IsNotNull(uri); Assert.AreEqual($"/maps/api/geocode/json?key={request.Key}&language={request.Language.ToCode()}&latlng={Uri.EscapeDataString(request.Location.ToString())}&location_type={Uri.EscapeDataString(string.Join("|", request.LocationTypes.Select(x => x.ToString().ToUpper()).AsEnumerable()))}", uri.PathAndQuery); }
public void GetUriWhenResultTypeTest() { var request = new LocationGeocodeRequest { Key = "abc", Location = new Entities.Common.Location(1, 1), ResultTypes = new[] { PlaceLocationType.Accounting, PlaceLocationType.Administrative_Area_Level_1 } }; var uri = request.GetUri(); Assert.IsNotNull(uri); Assert.AreEqual($"/maps/api/geocode/json?key={request.Key}&language={request.Language.ToCode()}&latlng={Uri.EscapeDataString(request.Location.ToString())}&result_type={Uri.EscapeDataString(string.Join("|", request.ResultTypes.Select(x => x.ToString().ToLower()).AsEnumerable()))}", uri.PathAndQuery); }