// Test for no http:// in URL. public void UrlNoHttpTest() { IWebCollector collector = new WebCollector(); string url = "aftonbladet.se"; collector.GetHTMLFromUrl(url); Assert.AreEqual(string.Empty, collector.HtmlCode); }
public async Task GetHTMLFromUrlTestValidURL() { var wc = new WebCollector(); await wc.GetHTMLFromUrl("https://www.aftonbladet.se/"); var result = wc.HtmlCode; Assert.IsNotEmpty(result); }
// Test for string.Empty URL. public void UrlStringEmptyTest() { IWebCollector collector = new WebCollector(); string url = string.Empty; collector.GetHTMLFromUrl(url); Assert.AreEqual(string.Empty, collector.HtmlCode); }
public async Task GetHTMLFromUrlTestWithNoHTTP() { var wc = new WebCollector(); await wc.GetHTMLFromUrl("www.aftonbladet.se"); var result = wc.HtmlCode; Assert.IsEmpty(result); }
public async Task GetHTMLFromUrlTestWithEmptyString() { var wc = new WebCollector(); await wc.GetHTMLFromUrl(string.Empty); var result = wc.HtmlCode; Assert.IsEmpty(result);; }
public async Task GetHTMLFromUrlTestWithNull() { var wc = new WebCollector(); await wc.GetHTMLFromUrl(null); var result = wc.HtmlCode; Assert.IsEmpty(result); }
public async Task <int> UpdateGUI(string url, string searchCrit) { WebCollector webData = new WebCollector(); webData.GetHTMLFromUrl(url); WebCalculator stuff = new WebCalculator(); int result = stuff.Count(webData, searchCrit); System.Threading.Thread.Sleep(1000); return(result); }
// Test to see if inputting valid data works public void ValidDataTest() { IWebCollector collector = new WebCollector(); string url = "http://aftonbladet.se"; collector.GetHTMLFromUrl(url); if (collector.HtmlCode == string.Empty) { Assert.Fail("String is empty when it should contain HTML code"); } }
public void CalculateNumberOfHitsTestKeywordEmpty() { var wb = new WebCollector(); wb.GetHTMLFromUrl("https://www.aftonbladet.se/"); WebCalculator wc = new WebCalculator(); int result = wc.CalculateNumberOfHits(wb, string.Empty); if (result != -1) { Assert.Fail(); } }
public void CalculateNumberOfHitsTestHTTPNull() { var wb = new WebCollector(); wb.GetHTMLFromUrl(""); WebCalculator wc = new WebCalculator(); if (wb.HtmlCode == null) { int result = wc.CalculateNumberOfHits(wb, "polis"); if (result != -1) { Assert.Fail(); } } }
private async void Button_Click(object sender, RoutedEventArgs e) { resultBox.Text = "Please Wait.."; if (keyword != null && site != null) { WebCollector wc = new WebCollector(); WebCalculator wb = new WebCalculator(); //Ascync! await wc.GetHTMLFromUrl(site); var tempSite = wc.HtmlCode; int result = wb.CalculateNumberOfHits(wc, keyword); resultBox.Text = result.ToString(); } else { MessageBox.Show("Choose Keyword And Site"); } }