public void Rank_String_Should_Be_Returned_With_Site_Rank() { _mockConfig.SetupGet(c => c[LookupRegexConfig]) .Returns("(<div class=\"r\"><a href=\"(.*?)\">)"); var searchResults = "<div class=\"r\"><a href=\"http://www.infotrack.com.au\">Test Dummy Data</a></div>"; var ranks = _googleRankCalculatorService .GetUrlRanksFromSearchResults(searchResults, new Uri("http://www.infotrack.com.au")); Assert.That(ranks, Is.EqualTo("1")); }
private IActionResult _GetSearchRank(string searchResults, Uri urlToSearch, SearchViewModel searchViewModel) { try { searchViewModel.RankString = _rankCalculator.GetUrlRanksFromSearchResults(searchResults, urlToSearch); return(View(nameof(Index), SetupSearchViewModel(searchViewModel))); } catch (ArgumentException ex) { _logger.LogError(ex.Message); return(RedirectToAction("Error")); } }