Example #1
0
        public void CalculateTotalWinner_ShouldReturnDotNetAsWinner()
        {
            //Arrange
            IWebRequest    webRequest     = new WebRequestImplementation();
            SearchExecutor searchExecutor = new SearchExecutor(webRequest);
            Report         googleReport1  = new Report()
            {
                SearchEngine = SearchEngineEnum.Google.ToString(), Keyword = ".net", Quantity = 999
            };
            Report googleReport2 = new Report()
            {
                SearchEngine = SearchEngineEnum.Google.ToString(), Keyword = ".java", Quantity = 758
            };

            Report bingReport1 = new Report()
            {
                SearchEngine = SearchEngineEnum.Bing.ToString(), Keyword = ".net", Quantity = 120
            };
            Report bingReport2 = new Report()
            {
                SearchEngine = SearchEngineEnum.Bing.ToString(), Keyword = ".java", Quantity = 95
            };

            //Act
            searchExecutor.reports.Add(googleReport1);
            searchExecutor.reports.Add(googleReport2);
            searchExecutor.reports.Add(bingReport1);
            searchExecutor.reports.Add(bingReport2);
            var result = searchExecutor.CalculateTotalWinner();

            //Assert
            result.Should().Be("Total winner: .net");
        }