public void NearbySearchResultsRBPWithOptions_ValidQueryWithOpenNow() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > searchResults = placesSearch.GetNearbySearchResultsRankByProminenceWithOptions(VALID_LOCATION, SMALL_RADIUS, open_now: true); searchResults.Wait(); Places.NearbySearchResultList resultList = searchResults.Result.Item1; ResponseStatus responseStatus = searchResults.Result.Item2; Assert.AreSame(responseStatus, Places.PlacesStatus.OK); Assert.IsNotNull(resultList); Assert.GreaterOrEqual(resultList.Results.Count, 1); for (int i = 0; i < resultList.Results.Count; i++) { Places.NearbySearchResult result = resultList.Results[i]; // Verifying Place_id Assert.IsNotNull(result.Place_id); Assert.IsNotEmpty(result.Place_id); // Verifying Name Assert.IsNotNull(result.Name); Assert.IsNotEmpty(result.Name); // Verifying OpeningHours Assert.IsNotNull(result.OpeningHours); Assert.IsTrue(result.OpeningHours.OpenNow); } }
public void PlacesPhotos_ValidQuery() { Places.PlacesSearch placesSearch = new Places.PlacesSearch(VALID_SETUP); Places.Location VALID_LOCATION = new Places.Location(40.757870, -73.983996); Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > searchResults = placesSearch.GetNearbySearchResultsRankByProminenceWithOptions(VALID_LOCATION, 10000.00, type: Places.NearbySearchTypes.MUSEUM); searchResults.Wait(); Places.NearbySearchResultList resultList = searchResults.Result.Item1; int photoCounter = 0; for (int i = 0; i < resultList.Results.Count; i++) { if (resultList.Results[i].Photos != null && resultList.Results[i].Photos.Count > 0) { List <Places.Photo> photos = resultList.Results[i].Photos; for (int j = 0; j < photos.Count; j++) { Places.Photo photo = photos[j]; Task <Tuple <String, ResponseStatus> > response = placesPhotos.GetPlacesPhotos(photo.Photo_ref, EDITABLE_VALID_FILE_LOCATION + $"_{photoCounter}.jpg", maxHeight: 500); response.Wait(); Assert.IsNotNull(response.Result.Item1); Assert.AreEqual(response.Result.Item1, EDITABLE_VALID_FILE_LOCATION + $"_{photoCounter}.jpg"); Assert.IsTrue(System.IO.File.Exists(response.Result.Item1)); Assert.AreEqual(response.Result.Item2, Places.PlacesStatus.OK); photoCounter++; } } } for (int i = 0; i < photoCounter; i++) { System.IO.File.Delete(EDITABLE_VALID_FILE_LOCATION + $"_{i}.jpg"); } }