Beispiel #1
0
        public async Task Run(IEnumerable <string> input)
        {
            if (input.Count() < 2)
            {
                throw new ArgumentException("The input query is not correct, please execute again with a 2 or more search variables");
            }

            Console.WriteLine("Execution in process...");

            var searchResults = await _searchEnginesService.GetSearchResultsAsync(input);

            var searchEnginesWinnersList = _resultsAggregatorService.FindSearchEnginesWinners(searchResults).ToList();
            var searchEnginesTotalWinner = _resultsAggregatorService.FindSearchEnginesTotalWinner(searchResults);

            _resultsOutputService.OutputSearchResults(searchResults);
            _resultsOutputService.OutputWinners(searchEnginesWinnersList);
            _resultsOutputService.OutputTotalWinner(searchEnginesTotalWinner);

            Console.WriteLine("Execution has been completed");
        }
        public void FindSearchEnginesTotalWinner_InputEmpty_ShouldThrowArgumentException()
        {
            var input = new List <SearchResultModel>();

            Assert.Throws <ArgumentException>(() => _resultsAggregatorService.FindSearchEnginesTotalWinner(input));
        }