public async Task AmazonService_GetAllPages() { // Arrange AmazonWebScraper.AmazonScraper amazonService = AmazonModule.Create <AmazonWebScraper.AmazonScraper>(); // Act var pages = await amazonService.GeAlltPageDataFromAsinAsync("B082XY23D5"); // Assert Assert.NotNull(pages); }
public async Task Scraper_GetPageContent2() { // Arrange Scraper scraper = AmazonModule.Create <Scraper>(); // Act string content = await scraper.GetPageAsync(new Uri(@"/Samsung-Unlocked-Fingerprint-Recognition-Long-Lasting/product-reviews/B082XY23D5/ref=cm_cr_arp_d_paging_btm_2?ie=UTF8&pageNumber=2", UriKind.Relative)); // Assert Assert.NotNull(content); Assert.True(content.StartsWith("<!doctype html>")); Assert.True(content.Length > 0); }
public async Task Scraper_GetPageContent() { // Arrange Scraper scraper = AmazonModule.Create <Scraper>(); // Act string content = await scraper.GetPageAsync(new Uri(@"/product-reviews/B082XY23D5", UriKind.Relative)); // Assert Assert.NotNull(content); Assert.True(content.StartsWith("<!doctype html>")); Assert.True(content.Length > 0); }
public async Task AmazonService_GetPages() { // Arrange AmazonWebScraper.AmazonScraper amazonService = AmazonModule.Create <AmazonWebScraper.AmazonScraper>(); // Act AsinPageData page = await amazonService.GetPageDataFromAsinAsync("B082XY23D5"); AsinPageData page2 = await amazonService.GetPageDataFromUriAsync(page.NextPageUri); // Assert Assert.NotNull(page); Assert.NotEqual(page.NextPageUri.ToString(), page2.NextPageUri.ToString()); }
public void Scraper_GetPageContent() { // Arrange AmazonParser parser = AmazonModule.Create <AmazonParser>(); // Act var page = parser.ParseAsinPage(GetStringRessource(this.GetType().Assembly, "B082XY23D5.html")); // Assert Assert.NotNull(page); // dummy Assert.Equal("Samsung Galaxy S20 5G Factory Unlocked New Android Cell Phone US Version, 128GB of Storage, Fingerprint ID and Facial Recognition, Long-Lasting Battery, Cosmic Gray", page.ProductTitle); Assert.Equal("/Samsung-Unlocked-Fingerprint-Recognition-Long-Lasting/product-reviews/B082XY23D5/ref=cm_cr_arp_d_paging_btm_2?ie=UTF8&pageNumber=2", page.NextPageUri.ToString()); Assert.Equal(10, page.CustomerReviews.Count); }