Пример #1
0
        public void TestFindingUrlWorks()
        {
            string html      = @"<div data-async-context=""query:heygooglehowdoItypespaces?""><div class=""g""> result 1 </div><div class=""g""> www.sympli.com.au </div><div class=""g""> result 3 </div><div class=""g""> result 4 </div><div class=""g""> result 5 </div></div>";
            var    organiser = new GoogleSearchResultsOrganiser(html);
            var    finder    = new FinderOfKeywordsInSearchResults(organiser, "heygooglehowdoItypespaces?");
            int    location  = finder.FindKeyphraseFirstAppearanceIndex("www.sympli.com.au");

            Assert.That(location, Is.EqualTo(1));
        }
Пример #2
0
        public void TestFindKeyphraseFirstAppearanceIndexWithSpaces()
        {
            string html      = @"<div data-async-context=""query:does%20this%20work?""><div class=""g""> result 1 </div><div class=""g""> result 2 </div><div class=""g""> result 3 </div><div class=""g""> result 4 </div><div class=""g""> result 5 </div></div>";
            var    organiser = new GoogleSearchResultsOrganiser(html);
            var    finder    = new FinderOfKeywordsInSearchResults(organiser, "does this work?");
            int    location  = finder.FindKeyphraseFirstAppearanceIndex("result 5");

            Assert.That(location, Is.EqualTo(4));
        }
Пример #3
0
        public void TestBingActualData()
        {
            TextReader tr        = new StreamReader(@"TestFiles\TestBingSearchResult.txt");
            string     html      = tr.ReadToEnd();
            var        organiser = new BingSearchResultsOrganiser(html);
            var        finder    = new FinderOfKeywordsInSearchResults(organiser, "e-settlements");
            int        location  = finder.FindKeyphraseFirstAppearanceIndex("sympli");

            Assert.That(location, Is.EqualTo(3));
        }