public void CreateServiceShouldCreateInstanceOfBingSearchEngineWhenTypeIsBing() { // arrange var type = SearchEngine.Bing; // act var result = _searchServiceFactory.CreateService(type); // assert result.Should().BeOfType <BingSearchService>(); }
public async Task <string> GetRanks([FromHeader] Application.Common.Constants.SearchEngine searchEngine, string keyWords, string url) { try { return(await _searchServiceFactory.CreateService(searchEngine).GetRanks(keyWords, url, _config.MaxResults)); } catch (Exception ex) { _logger.LogError(ex.Message, ex.StackTrace); throw ex; } }