public async Task GivenValidRequest_ThenHasExpectedResponseItems(string postalCode) { var response = await HttpRequestFactory.GetAnonymous(_clientApiUrl, $"json?address={postalCode}"); dynamic responseContent = response.ContentAsDynamic(); Assert.NotNull(responseContent.results); Assert.NotNull(responseContent.results[0].place_id); Assert.NotNull(responseContent.results[0].formatted_address); }
public async Task <GeoLocation> GetDetails(string postalCode) { var response = await HttpRequestFactory.GetAnonymous(_clientApiUrl, $"json?address={postalCode}"); var responseContent = response.ContentAsType <GoogleMapsResults>(); var adminLevel1 = responseContent.results.SelectMany(result => result.address_components.Where(component => component.types.Any(type => type == "administrative_area_level_1"))); var location = new GeoLocation() { Province = adminLevel1.First().short_name }; return(location); }
public async Task GivenValidRequest_ThenHasExpectedResponseCode() { var response = await HttpRequestFactory.GetAnonymous(_clientApiUrl, $"json?address=J3Y%209H5"); Assert.Equal(HttpStatusCode.OK, response.StatusCode); }