public void LocationWithCoordinates() { var yelp = new Yelp(Config.Options); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { term = "food" }, LocationOptions = new LocationOptions() { location = "bellevue", coordinates = new CoordinateOptions() { latitude = 37.788022, longitude = -122.399797 } } }; var results = yelp.Search(searchOptions).Result; Assert.IsTrue(results.businesses.Count > 0); }
public void LimitTest() { var y = new Yelp(Config.Options); var searchOptions = new SearchOptions() { GeneralOptions = new GeneralOptions() { term = "coffee", limit = 15, }, LocationOptions = new LocationOptions() { location = "seattle, wa" } }; var results = y.Search(searchOptions).Result; if (results.error != null) { Assert.Fail(results.error.text); } if (results.businesses.Count != 15) { Assert.Fail(string.Format("Limit test returned {0} results instead of 15", results.businesses.Count)); } Console.WriteLine(results); }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult Results(SimpleSearchModel model) { Yelp yelp = new Yelp(MvcApplication.Options); var results = yelp.Search(model.Term, model.Location); return(View(results)); }
public void LocationWithCoordinates() { var o = GetOptions(); var yelp = new Yelp(o); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { term = "food" }, LocationOptions = new LocationOptions() { location = "bellevue", coordinates = new CoordinateOptions() { latitude = 37.788022, longitude = -122.399797 } } }; var results = yelp.Search(searchOptions); Console.WriteLine(results); }
public void BasicTest() { var o = GetOptions(); var y = new Yelp(o); var results = y.Search("coffee", "seattle, wa"); Console.WriteLine(results); }
public void BasicTest() { var y = new Yelp(Config.Options); var results = y.Search("coffee", "seattle, wa").Result; if (results.error != null) { Assert.Fail(results.error.text); } Console.WriteLine(results); }
private void Button_Click_1(object sender, RoutedEventArgs e) { var yelp = new Yelp(Config.Options); var task = yelp.Search(txtSearch.Text, txtLocation.Text); task.ContinueWith((results) => { App.ViewModel = new ViewModels.SearchResultViewModel(results.Result); NavigationService.Navigate(new Uri("/SearchResultsPage.xaml")); }); }
public void ErrorTest_UNSPECIFIED_LOCATION() { var y = new Yelp(Config.Options); var searchOptions = new SearchOptions(); var results = y.Search(searchOptions).Result; Assert.IsTrue(results.error != null); Assert.IsTrue(results.error.id == YelpSharp.Data.ErrorId.UNSPECIFIED_LOCATION); Console.WriteLine(results); }
public void LocationByBounds() { var yelp = new Yelp(Config.Options); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { LocationOptions = new CoordinateOptions() { latitude = 37.788022, longitude = -122.399797 } }; var results = yelp.Search(searchOptions).Result; Assert.IsTrue(results.businesses.Count > 0); }
public async void Search() { this.Businesses.Clear(); Yelp yelp = new Yelp(Config.Options); SearchResults searchResults = await yelp.Search(this.SearchOptions); if (searchResults != null && searchResults.businesses != null) { for (int count = 0; count < searchResults.businesses.Count; count++) { this.Businesses.Add(searchResults.businesses[count]); } } }
public void VerifyLocationInResult() { var y = new Yelp(Config.Options); var results = y.Search("coffee", "seattle, wa").Result; if (results.error != null) { Assert.Fail(results.error.text); } var bus = results.businesses[0]; if (bus.location.coordinate == null) { Assert.Fail("No coordinate found on location for business"); } }
public void MultipleCategories() { var yelp = new Yelp(Config.Options); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { category_filter = "climbing,bowling" }, LocationOptions = new LocationOptions() { location = "Seattle" } }; var results = yelp.Search(searchOptions).Result; Assert.IsTrue(results.businesses.Count > 0); }
public void LocationWithRadius() { var yelp = new Yelp(Config.Options); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { term = "food", radius_filter = 5 }, LocationOptions = new LocationOptions() { location = "bellevue" } }; var results = yelp.Search(searchOptions).Result; Assert.IsTrue(results.businesses.Count > 0); }
public void VerifyCoordinatesWithRadius() { var yelp = new Yelp(Config.Options); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { radius_filter = 3000 }, LocationOptions = new CoordinateOptions() { latitude = 47.603525, longitude = -122.329580 } }; var results = yelp.Search(searchOptions).Result; Assert.IsTrue(results.businesses.Count > 0); }
public void ErrorTest_UNAVAILABLE_FOR_LOCATION() { var y = new Yelp(Config.Options); var searchOptions = new SearchOptions() { LocationOptions = new CoordinateOptions() { latitude = 1, longitude = 1 } }; var results = y.Search(searchOptions).Result; Assert.IsTrue(results.error != null); Assert.IsTrue(results.error.id == YelpSharp.Data.ErrorId.UNAVAILABLE_FOR_LOCATION); Console.WriteLine(results); }
public void ErrorTest_INVALID_SIGNATURE() { var o = GetOptions(); var y = new Yelp(o); var searchOptions = new SearchOptions() { GeneralOptions = new GeneralOptions() { term = "coffee + tea" } }; var results = y.Search(searchOptions); Assert.IsTrue(results.error != null); Assert.IsTrue(results.error.id == YelpSharp.Data.ErrorId.INVALID_SIGNATURE); Console.WriteLine(results); }
public void MultipleCategories() { var o = GetOptions(); var yelp = new Yelp(o); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { category_filter = "climbing,bowling" }, LocationOptions = new LocationOptions() { location = "Seattle" } }; var results = yelp.Search(searchOptions); Console.WriteLine(results); }
public void LocationWithRadius() { var o = GetOptions(); var yelp = new Yelp(o); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { term = "food", radius_filter = 5 }, LocationOptions = new LocationOptions() { location = "bellevue" } }; var results = yelp.Search(searchOptions); Console.WriteLine(results); }
public void VerifyTermWithEscapedCharacter() { var y = new Yelp(Config.Options); var searchOptions = new SearchOptions { GeneralOptions = new GeneralOptions { term = "Frimark Keller & Associates" }, LocationOptions = new LocationOptions { location = "60173" } }; var results = y.Search(searchOptions).Result; Assert.IsTrue(results.businesses != null); Assert.IsTrue(results.businesses.Count > 0); }
public void LocationByCoordinates() { var o = GetOptions(); var yelp = new Yelp(o); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { radius_filter = 5 }, LocationOptions = new CoordinateOptions() { latitude = 37.788022, longitude = -122.399797 } }; var results = yelp.Search(searchOptions); Console.WriteLine(results); }
public void VerifyGeneralOptions() { var y = new Yelp(Config.Options); var searchOptions = new SearchOptions(); searchOptions.GeneralOptions = new GeneralOptions() { term = "coffee" }; searchOptions.LocationOptions = new LocationOptions() { location = "seattle" }; var results = y.Search(searchOptions).Result; Assert.IsTrue(results.businesses != null); Assert.IsTrue(results.businesses.Count > 0); }
public IList <Restaurant> Execute(string name) { if (string.IsNullOrEmpty(name)) { return(new List <Restaurant>()); } var accessToken = ConfigurationManager.AppSettings["Yelp.AccessToken"]; var accessTokenSecret = ConfigurationManager.AppSettings["Yelp.AccessTokenSecret"]; var consumerKey = ConfigurationManager.AppSettings["Yelp.ConsumerKey"]; var consumerSecret = ConfigurationManager.AppSettings["Yelp.ConsumerSecret"]; var yelp = new Yelp(new Options { AccessToken = accessToken, AccessTokenSecret = accessTokenSecret, ConsumerKey = consumerKey, ConsumerSecret = consumerSecret }); var results = yelp.Search(new SearchOptions { GeneralOptions = new GeneralOptions { category_filter = "food", term = name, radius_filter = 40000 }, LocationOptions = new LocationOptions { location = "houston, tx" } }).Result; var restaurants = results.businesses.Select(Mapper.Map <Restaurant>).ToList(); foreach (var restaurant in restaurants) { if (restaurant.Address.StreetLine1 != null) { var inspections = InspectionData.GetRecords(HostingEnvironment.MapPath("~/App_Data/inspection-data.txt")).Where(i => restaurant.Address.StreetLine1.ToLower().StartsWith(string.Format("{0} {1}", i.StNum, i.StName).ToLower())).ToList(); if (inspections.Any()) { restaurant.Violations = inspections.Select(Mapper.Map <Violation>).ToList(); } } } return(restaurants.Where(x => x.Name.StartsWith(name, StringComparison.CurrentCultureIgnoreCase)).ToList()); }
public void AdvancedTest() { var o = GetOptions(); var y = new Yelp(o); var searchOptions = new SearchOptions(); searchOptions.GeneralOptions = new GeneralOptions() { term = "coffee" }; searchOptions.LocationOptions = new LocationOptions() { location = "seattle" }; var results = y.Search(searchOptions); Assert.IsTrue(results.businesses != null); Assert.IsTrue(results.businesses.Count > 0); Console.WriteLine(results); }
public void UrlEscapedCharacters() { var o = GetOptions(); var y = new Yelp(o); var searchOptions = new SearchOptions(); searchOptions.GeneralOptions = new GeneralOptions() { term = "coffee $&`:<>[]{}\"#%@/;=?\\^|~', tea" }; searchOptions.LocationOptions = new LocationOptions() { location = "seattle" }; var results = y.Search(searchOptions); Assert.IsTrue(results.businesses != null); Assert.IsTrue(results.businesses.Count > 0); Console.WriteLine(results); }