public void NearbySearchResultsRBPWithOptions_ValidQueryWithMinMaxPrice() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > searchResults = placesSearch.GetNearbySearchResultsRankByProminenceWithOptions(VALID_LOCATION, SMALL_RADIUS, min_price: 1, max_price: 3); 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 PriceLevel for each item Assert.GreaterOrEqual(result.PriceLevel, 1); Assert.LessOrEqual(result.PriceLevel, 3); } }
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 NearbySearchResultsRBPWithOptions_ValidQueryWithType() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > searchResults = placesSearch.GetNearbySearchResultsRankByProminenceWithOptions(VALID_LOCATION, SMALL_RADIUS, type: MUSEUM_TYPE); 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 Types Assert.IsNotNull(result.Types); Assert.GreaterOrEqual(result.Types.Count, 1); Assert.IsTrue(result.Types.Contains(MUSEUM_TYPE.ToString().ToLower())); } }
public void TextSearchResultsWithOptions_ValidQueryWithOpenNow() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > textResults = placesSearch.GetTextSearchResultsWithOptions(PIZZA_QUERY, open_now: true); textResults.Wait(); Places.NearbySearchResultList resultsList = textResults.Result.Item1; ResponseStatus response = textResults.Result.Item2; Assert.IsNotNull(resultsList); Assert.GreaterOrEqual(resultsList.Results.Count, 1); Assert.AreSame(response, Places.PlacesStatus.OK); for (int i = 0; i < resultsList.Results.Count; i++) { Places.NearbySearchResult result = resultsList.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); Assert.IsNotNull(result.OpeningHours); } }
public void TextSearchResultsWithOptions_ValidQueryWithMinMaxPrice() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > textResults = placesSearch.GetTextSearchResultsWithOptions(PIZZA_QUERY, min_price: 1, max_price: 2); textResults.Wait(); Places.NearbySearchResultList resultsList = textResults.Result.Item1; ResponseStatus response = textResults.Result.Item2; Assert.IsNotNull(resultsList); Assert.GreaterOrEqual(resultsList.Results.Count, 1); Assert.AreSame(response, Places.PlacesStatus.OK); for (int i = 0; i < resultsList.Results.Count; i++) { Places.NearbySearchResult result = resultsList.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); Assert.GreaterOrEqual(result.PriceLevel, 1); Assert.LessOrEqual(result.PriceLevel, 2); } }
public void TextSearchResultsWithOptions_ValidQueryWithLocationAndRadius() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > textResults = placesSearch.GetTextSearchResultsWithOptions(PIZZA_QUERY, location: LOCATION_PURDUE, radius: RADIUS); textResults.Wait(); Places.NearbySearchResultList resultsList = textResults.Result.Item1; ResponseStatus response = textResults.Result.Item2; Assert.IsNotNull(resultsList); Assert.GreaterOrEqual(resultsList.Results.Count, 1); Assert.AreSame(response, Places.PlacesStatus.OK); for (int i = 0; i < resultsList.Results.Count; i++) { Places.NearbySearchResult result = resultsList.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); double dist = BasicFunctions.distanceBetweenLocations(result.Geometry.Location, LOCATION_PURDUE) / 1000.00; Assert.LessOrEqual(dist, RADIUS); } }
public void TextSearchResultsWithOptions_ValidQueryWithTypes() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > textResults = placesSearch.GetTextSearchResultsWithOptions(PIZZA_QUERY, type: Places.NearbySearchTypes.MEAL_TAKEAWAY); textResults.Wait(); Places.NearbySearchResultList resultsList = textResults.Result.Item1; ResponseStatus response = textResults.Result.Item2; Assert.IsNotNull(resultsList); Assert.GreaterOrEqual(resultsList.Results.Count, 1); Assert.AreSame(response, Places.PlacesStatus.OK); for (int i = 0; i < resultsList.Results.Count; i++) { Places.NearbySearchResult result = resultsList.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 Types Assert.IsNotNull(result.Types); Assert.GreaterOrEqual(result.Types.Count, 1); Assert.IsTrue(result.Types.Contains(Places.NearbySearchTypes.MEAL_TAKEAWAY.ToString().ToLower())); } }
public void NearbySearchResultsRBPWithOptions_ValidQueryWithAllOptions() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > searchResults = placesSearch.GetNearbySearchResultsRankByProminenceWithOptions(VALID_LOCATION, LARGE_RADIUS, open_now: true, keyword: "mexican", min_price: 1, max_price: 3, type: Places.NearbySearchTypes.RESTAURANT); 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); Boolean hasKeyword = false; 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); if (result.Name.ToLower().Contains("mexican")) { hasKeyword = true; } // Verifying OpeningHours Assert.IsNotNull(result.OpeningHours); Assert.IsTrue(result.OpeningHours.OpenNow); // Verifying PriceLevel for each item Assert.GreaterOrEqual(result.PriceLevel, 1); Assert.LessOrEqual(result.PriceLevel, 3); // Verifying Types Assert.IsNotNull(result.Types); Assert.GreaterOrEqual(result.Types.Count, 1); Assert.IsTrue(result.Types.Contains("restaurant") || result.Types.Contains("food")); } Assert.IsTrue(hasKeyword); }
public void TextSearchResultsWithOptions_ValidQueryWithAllOptions() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > textResults = placesSearch.GetTextSearchResultsWithOptions(PIZZA_QUERY, location: LOCATION_PURDUE, radius: RADIUS, type: Places.NearbySearchTypes.MEAL_TAKEAWAY, open_now: true, min_price: 2, max_price: 3); textResults.Wait(); Places.NearbySearchResultList resultsList = textResults.Result.Item1; ResponseStatus response = textResults.Result.Item2; Assert.IsNotNull(resultsList); Assert.GreaterOrEqual(resultsList.Results.Count, 1); Assert.AreSame(response, Places.PlacesStatus.OK); for (int i = 0; i < resultsList.Results.Count; i++) { Places.NearbySearchResult result = resultsList.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); Assert.IsNotNull(result.OpeningHours); Assert.GreaterOrEqual(result.PriceLevel, 2); Assert.LessOrEqual(result.PriceLevel, 3); double dist = BasicFunctions.distanceBetweenLocations(result.Geometry.Location, LOCATION_PURDUE) / 1000.00; Assert.LessOrEqual(dist, RADIUS); // Verifying Types Assert.IsNotNull(result.Types); Assert.GreaterOrEqual(result.Types.Count, 1); Assert.IsTrue(result.Types.Contains(Places.NearbySearchTypes.MEAL_TAKEAWAY.ToString().ToLower())); } }
public void NearbySearchResultsRBPWithOptions_ValidQueryWithKeyword() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > searchResults = placesSearch.GetNearbySearchResultsRankByProminenceWithOptions(VALID_LOCATION, SMALL_RADIUS, keyword: THEATER_KEYWORD); 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); Boolean hasKeyword = false; 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); if (result.Name.ToLower().Contains(THEATER_KEYWORD)) { hasKeyword = true; } } Assert.IsTrue(hasKeyword); }
public void NearbySearchAdditionalResults_ValidQuery() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > searchResults = placesSearch.GetNearbySearchResultsRankByDistanceWithOptions(VALID_LOCATION, keyword: PIZZA_KEYWORD, open_now: true, min_price: 3, max_price: 4); searchResults.Wait(); // Verifying the first page of results 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); // Get the next page of results Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > searchResults2 = placesSearch.GetAdditionalNearbySearchResults(resultList.NextPageToken); searchResults2.Wait(); Boolean photosSet = false; Boolean geometrySet = false; Boolean plusCodeSet = false; 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 Geometry if (result.Geometry != null && result.Geometry.Viewport != null && result.Geometry.Location != null) { geometrySet = true; } // Verifying IconHTTP Assert.IsNotNull(result.IconHTTP); Assert.IsNotEmpty(result.IconHTTP); // Verifying ID Assert.IsNotNull(result.Id); Assert.IsNotEmpty(result.Id); // Verifying OpeningHours Assert.IsNotNull(result.OpeningHours); Assert.IsTrue(result.OpeningHours.OpenNow); // Verifying Photos if (result.Photos != null && result.Photos.Count >= 1) { photosSet = true; } // Verifying PlusCode if (result.PlusCode != null && result.PlusCode.CompoundCode != null && result.PlusCode.GlobalCode != null) { plusCodeSet = true; } // Verifying PriceLevel Assert.GreaterOrEqual(result.PriceLevel, 3); Assert.LessOrEqual(result.PriceLevel, 4); // Verifying Rating Assert.GreaterOrEqual(result.Rating, 0); // Verifying References Assert.IsNotNull(result.Reference); Assert.IsNotEmpty(result.Reference); // Verifying Scope Assert.IsNotNull(result.Scope); Assert.IsNotEmpty(result.Scope); // Verifying Types Assert.IsNotNull(result.Types); Assert.GreaterOrEqual(result.Types.Count, 1); // Verifying Vicinity Assert.IsNotNull(result.Vicinity); Assert.IsNotEmpty(result.Vicinity); } // Verifying that at least one result has each of Photos, PlusCode, and Geometry is set Assert.IsTrue(photosSet && plusCodeSet && geometrySet); }
public void TextSearchResults_ValidQuery() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > textResults = placesSearch.GetTextSearchResults(VALID_QUERY); textResults.Wait(); Places.NearbySearchResultList resultsList = textResults.Result.Item1; ResponseStatus response = textResults.Result.Item2; Assert.IsNotNull(resultsList); Assert.GreaterOrEqual(resultsList.Results.Count, 1); Assert.AreSame(response, Places.PlacesStatus.OK); Boolean photosSet = false; Boolean geometrySet = false; Boolean openingHoursSet = false; for (int i = 0; i < resultsList.Results.Count; i++) { Places.NearbySearchResult result = resultsList.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 Photos if (result.Photos != null && result.Photos.Count >= 1) { photosSet = true; } //Verifying Geometry if (result.Geometry != null && result.Geometry.Viewport != null && result.Geometry.Location != null) { geometrySet = true; } // Verifying Icon Assert.IsNotNull(result.IconHTTP); Assert.IsNotEmpty(result.IconHTTP); // Verifying Id Assert.IsNotNull(result.Id); Assert.IsNotEmpty(result.Id); // Verifying Types Assert.IsNotNull(result.Types); Assert.GreaterOrEqual(result.Types.Count, 1); // Verifying OpeningHours if (result.OpeningHours != null) { openingHoursSet = true; } } Assert.IsTrue(openingHoursSet && photosSet && geometrySet); }
public void NearbySearchResultsRBD_ValidQueryWithKeyword() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > searchResults = placesSearch.GetNearbySearchResultsRankByDistance(VALID_LOCATION, keyword: PIZZA_KEYWORD); 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); Boolean photosSet = false; Boolean geometrySet = false; Boolean openingHoursSet = false; 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 Photos if (result.Photos != null && result.Photos.Count >= 1) { photosSet = true; } //Verifying Geometry if (result.Geometry != null && result.Geometry.Viewport != null && result.Geometry.Location != null) { geometrySet = true; } // Verifying Icon Assert.IsNotNull(result.IconHTTP); Assert.IsNotEmpty(result.IconHTTP); // Verifying Id Assert.IsNotNull(result.Id); Assert.IsNotEmpty(result.Id); // Verifying Types Assert.IsNotNull(result.Types); Assert.GreaterOrEqual(result.Types.Count, 1); // Verifying OpeningHours if (result.OpeningHours != null) { openingHoursSet = true; } } Assert.IsTrue(openingHoursSet && photosSet && geometrySet); }
public void TextSearchAdditionalResults_ValidQuery() { Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > textResults = placesSearch.GetTextSearchResultsWithOptions(FOOD_QUERY, location: LOCATION_NYC, radius: RADIUS, type: Places.NearbySearchTypes.MEAL_DELIVERY, open_now: true, min_price: 0, max_price: 4); textResults.Wait(); Places.NearbySearchResultList resultsList = textResults.Result.Item1; ResponseStatus response = textResults.Result.Item2; Assert.IsNotNull(resultsList); Assert.GreaterOrEqual(resultsList.Results.Count, 1); Assert.AreSame(response, Places.PlacesStatus.OK); // Get the next page of results Task <Tuple <Places.NearbySearchResultList, ResponseStatus> > searchResults2 = placesSearch.GetAdditionalTextSearchResults(resultsList.NextPageToken); searchResults2.Wait(); Boolean photosSet = false; Boolean geometrySet = false; Boolean plusCodeSet = false; for (int i = 0; i < resultsList.Results.Count; i++) { Places.NearbySearchResult result = resultsList.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); Assert.GreaterOrEqual(result.PriceLevel, 0); Assert.LessOrEqual(result.PriceLevel, 4); double dist = BasicFunctions.distanceBetweenLocations(result.Geometry.Location, LOCATION_NYC) / 1000.00; Assert.LessOrEqual(dist, RADIUS); // Verifying Types Assert.IsNotNull(result.Types); Assert.GreaterOrEqual(result.Types.Count, 1); Assert.IsTrue(result.Types.Contains(Places.NearbySearchTypes.MEAL_DELIVERY.ToString().ToLower())); // Verifying Geometry if (result.Geometry != null && result.Geometry.Viewport != null && result.Geometry.Location != null) { geometrySet = true; } // Verifying IconHTTP Assert.IsNotNull(result.IconHTTP); Assert.IsNotEmpty(result.IconHTTP); // Verifying ID Assert.IsNotNull(result.Id); Assert.IsNotEmpty(result.Id); // Verifying OpeningHours Assert.IsNotNull(result.OpeningHours); Assert.IsTrue(result.OpeningHours.OpenNow); // Verifying Photos if (result.Photos != null && result.Photos.Count >= 1) { photosSet = true; } // Verifying PlusCode if (result.PlusCode != null && result.PlusCode.CompoundCode != null && result.PlusCode.GlobalCode != null) { plusCodeSet = true; } // Verifying Rating Assert.GreaterOrEqual(result.Rating, 0); // Verifying References Assert.IsNotNull(result.Reference); Assert.IsNotEmpty(result.Reference); // Verifying Types Assert.IsNotNull(result.Types); Assert.GreaterOrEqual(result.Types.Count, 1); Assert.IsTrue(result.Types.Contains(Places.NearbySearchTypes.MEAL_DELIVERY.ToString().ToLower())); } // Verifying that at least one result has each of Photos, PlusCode, and Geometry is set Assert.IsTrue(photosSet && plusCodeSet && geometrySet); }