Ejemplo n.º 1
0
        public void SearchTest_Invalid()
        {
            // Mock the WebPageUtility
            var mockedWebPageUtility = new MockedWebPageUtility("..\\..\\SampleData\\InvalidFile.txt");

            // Create the searcher and pass the mocked utility
            var searcher = new GoogleSearcher(mockedWebPageUtility);
            var results  = searcher.Search("Google Australia", new SearchQuery("latest space exploration", "www.space.com"), 100);

            // Check number of results and rank
            Assert.AreEqual(0, results.Count);
        }
Ejemplo n.º 2
0
        public void SearchTest_1Result()
        {
            // Mock the WebPageUtility
            var mockedWebPageUtility = new MockedWebPageUtility("..\\..\\SampleData\\LSE_100Results.txt");

            // Create the searcher and pass the mocked utility
            var searcher = new GoogleSearcher(mockedWebPageUtility);
            var results  = searcher.Search("Google Australia", new SearchQuery("latest space exploration", "www.nasa.gov"), 100);

            // Check number of results and rank
            Assert.AreEqual(1, results.Count);
            Assert.AreEqual(6, results[0].RankPosition);
        }