public void PlacesDetauilsTest() { var _request = new PlacesAutoCompleteRequest { Key = _apiKey, Input = "jagtvej 2200", Sensor = true, Language = "en", }; var _response = GooglePlaces.AutoComplete.Query(_request); var _results = _response.Predictions.ToList(); var _result = _results.First(); var _request2 = new PlacesDetailsRequest { Key = _apiKey, PlaceId = _result.PlaceId, Sensor = true, }; var _response2 = GooglePlaces.Details.Query(_request2); Assert.AreEqual(Status.OK, _response2.Status); }
public void PlacesDetailsWhenApiKeyIsNullTest() { var request = new PlacesDetailsRequest { Key = null }; var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.Details.Query(request)); Assert.AreEqual(_exception.Message, "ApiKey must be provided"); }
public void PlacesDetailsWhenPlaceIdIsStringEmptyTest() { var request = new PlacesDetailsRequest { Key = ApiKey, PlaceId = string.Empty }; var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.Details.Query(request)); Assert.AreEqual(_exception.Message, "PlaceId must be provided."); }
public void PlacesDetailsAsyncTest() { var request = new PlacesAutoCompleteRequest { Key = ApiKey, Input = "jagtvej 2200", Sensor = true, Language = "en", }; var response = GooglePlaces.AutoComplete.QueryAsync(request).Result; var results = response.Predictions.ToArray(); var result = results.First(); var request2 = new PlacesDetailsRequest { Key = ApiKey, PlaceId = result.PlaceId, Sensor = true, }; var response2 = GooglePlaces.Details.Query(request2); Assert.AreEqual(Status.Ok, response2.Status); }