public void UrlStringIsNullOrEmpty() { WebCollector wc = new WebCollector(); var stringnull = Assert.Throws <ArgumentNullException>( () => wc.GetHtmlFromUrl(url: null)); Assert.IsTrue(stringnull.Message.Contains("Cant be null or empty values")); var stringempty = Assert.Throws <ArgumentNullException>( () => wc.GetHtmlFromUrl(url: String.Empty)); Assert.IsTrue(stringempty.Message.Contains("Cant be null or empty values")); }
public void ValidUrl() { WebCollector wc = new WebCollector(); string url = "https://www.aftonbladet.se/"; wc.GetHtmlFromUrl(url); Assert.IsTrue(url.Contains("https")); }
public void UrlNotContainsHttp() { WebCollector wc = new WebCollector(); string url = "www.aftonbladet.se"; var ex = Assert.Throws <ArgumentException>( () => wc.GetHtmlFromUrl(url)); Assert.IsTrue(ex.Message.Contains("missing https")); }
public void TestKeyWordStringEmptyWebCalculator() { IWebCalCulator wc = new WebCalCulator(); IWebColector wb = new WebCollector(); string url = "https://www.aftonbladet.se/"; wb.GetHtmlFromUrl(url); var results = wc.CalculateNumberOfHits(wb, keyword: String.Empty); Assert.AreEqual(-1, results); }