public void ThreadPoolCallback(Object threadContext) { IProviderSearchService searchService; switch (SearchContext.Provider) { case ProviderEnum.Google: searchService = new GoogleSearchService(); break; case ProviderEnum.Bing: searchService = new BingSearchService(); break; case ProviderEnum.Yahoo: searchService = new YahooSearchService(); break; case ProviderEnum.Twitter: searchService = new TwitterSearchService(); break; case ProviderEnum.Flickr: searchService = new FlickrSearchService(); break; default: searchService = new BingSearchService(); break; } SearchResultList = searchService.Search(SearchContext); DoneEvent.Set(); }
public void BingSearchImagesTest() { string query = "Lady Gaga"; int page = 1; int count = 8; SearchContext searchContext = new SearchContext(SearchTypeEnum.Image, query, page, count); SearchResultList searchResultList = new BingSearchService().Search(searchContext); int result = searchResultList.Count(); Assert.That(result > 0); foreach (SearchResultItem item in searchResultList) { Console.WriteLine(item.Title + " " + item.DisplayURL); } Console.ReadLine(); }
public void BingSearchWebTest() { string query = "Test"; int page = 1; int count = 8; SearchContext searchContext = new SearchContext(SearchTypeEnum.Web, query, page, count); SearchResultList searchResultList = new BingSearchService().Search(searchContext); int result = searchResultList.Count(); Assert.That(result > 0); foreach (SearchResultItem item in searchResultList) { Console.WriteLine(item.Title); } Console.ReadLine(); }