public void GivenWebPageContentWithNoInfoTrackResultsExpectCorrectRankings() { //Arrange const string SomeRandomWebPageContent = "<!doctype html><html><span class=\"Z98Wse\">Ad</span><cite>https://www.website1.com.au/Property_<b>Search</b></cite><span class=\"CiacGf\"></span><cite>www.saiglobal.com/<b>title</b>-<b>search</b></cite></div><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\"><cite>https://www.website2.com.au/SomePage</cite></html>"; const string InfoTrackUrl = "https://www.infotrack.com.au"; //Act string actualRankings = ResultsGenerator.GetRankingsFormattedAsString(SomeRandomWebPageContent, InfoTrackUrl); //Assert Assert.AreEqual("0", actualRankings); }
public ViewResult GetResults(InputFields inputFields) { if (ModelState.IsValid) { string googleSearchUrl = UrlGenerator.GenerateGoogleSearchUrl(inputFields.KeyWords); string webPageContent = WebPageDownloader.GetWebPageContent(googleSearchUrl); string rankings = ResultsGenerator.GetRankingsFormattedAsString(webPageContent, inputFields.Url); Results results = new Results { Rankings = rankings }; return(View("Results", results)); } return(View("Index")); }