public void TestGetJobDescription() { var expected = File.ReadAllText(@"helper3.txt"); var actual = JobScraper.GetJobDescription("https://www.lipsum.com/", ".//h1"); Assert.AreEqual(expected, actual); }
private void btn_JobScraper_Start_Click(object sender, RoutedEventArgs e) { #region Settings try { if (!string.IsNullOrEmpty(txt_JobScraper_url_flePath.Text)) { GlobalsScraper.txtUrlJobScraper = txt_JobScraper_url_flePath.Text; } else { GlobusLogHelper.log.Info("Please upload the Job_Url first."); MessageBox.Show("Please upload the Job_Url first."); } if (!string.IsNullOrEmpty(txt_JobScraper_MinDelay.Text) && !string.IsNullOrEmpty(txt_JobScraper_MaxDelay.Text)) { GlobalsScraper.txtMinDelay = Convert.ToInt32(txt_JobScraper_MinDelay.Text); GlobalsScraper.txtMaxDelay = Convert.ToInt32(txt_JobScraper_MaxDelay.Text); } else { GlobusLogHelper.log.Info("Delay field can't be empty."); MessageBox.Show("Delay field can't be empty."); return; } if (!string.IsNullOrEmpty(txt_Limit_for_job_scraper.Text)) { GlobalsScraper.txtLimitToScrapeJobs = Convert.ToInt32(txt_Limit_for_job_scraper.Text); } else { GlobusLogHelper.log.Info("Limit field can't be empty."); MessageBox.Show("Limit field can't be empty."); } } catch (Exception ex) { } #endregion try { JobScraper objJobScraper = new JobScraper(); Thread thrThreadStartJobScraper = new Thread(objJobScraper.ThreadStartJobScraper); thrThreadStartJobScraper.Start(); } catch (Exception ex) { } }
public void TestGetSingleJobCVbankas() { string testData = File.ReadAllText(@"test2.html"); var testDocument = new HtmlDocument(); testDocument.LoadHtml(testData); var expected = new Job(Constants.Grid.MinimumRowHeight) { Company = "Test", PostDate = "prieš 6 min.", Address = "Islandijoje", Salary = "Nuo 3015 €/mėn.", CompanyImage = "https://i.ytimg.com/vi/J3pF2jkQ4vc/maxresdefault.jpg".SaveImage(), Title = "Santechnikas", Url = "https://www.cvbankas.lt/santechnikas/" }; var actual = JobScraper.GetJobs(testDocument, Constants.WebsiteXpaths[Constants.Website.CVbankas], false) .FirstOrDefault(); Assert.IsTrue(expected.Equals(actual)); }
public void TestGetSingleJobCVonline() { string testData = File.ReadAllText(@"test.html"); var testDocument = new HtmlDocument(); testDocument.LoadHtml(testData); var expected = new Job(Constants.Grid.MinimumRowHeight) { Company = "Gintas, UAB", PostDate = "Prieš 20 val.", ValidUntilDate = "2020.02.25", Address = "Ukmergės g. 322, Vilnius", Salary = "Nuo 2000.00 iki 3400.00 EUR per month (bruto)", CompanyImage = "https://i.ytimg.com/vi/J3pF2jkQ4vc/maxresdefault.jpg".SaveImage(), Title = "JAVA SOFTWARE ENGINEER", Url = "http://www.cvonline.lt/darbo-skelbimas/gintas-uab/java-software-engineer.html" }; var actual = JobScraper.GetJobs(testDocument, Constants.WebsiteXpaths[Constants.Website.CVonline], false) .FirstOrDefault(); Assert.IsTrue(expected.Equals(actual)); }