コード例 #1
0
        public void CreateServiceShouldCreateInstanceOfBingSearchEngineWhenTypeIsBing()
        {
            // arrange
            var type = SearchEngine.Bing;

            // act
            var result = _searchServiceFactory.CreateService(type);

            // assert
            result.Should().BeOfType <BingSearchService>();
        }
コード例 #2
0
 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;
     }
 }