From c9e1fe070dad92f9b470375890eb80e4c9c0fc3f Mon Sep 17 00:00:00 2001 From: maforget <11904426+maforget@users.noreply.github.com> Date: Thu, 28 Mar 2024 17:45:24 -0400 Subject: [PATCH] Updated tests --- Tests/AmazonBookTest.cs | 41 +++++++++++++++++++++++++++++++++--- Tests/AmazonLinkSerieTest.cs | 6 +++--- Tests/AmazonLinkTest.cs | 12 +++++------ Tests/SearcherTest.cs | 6 +++--- 4 files changed, 50 insertions(+), 15 deletions(-) diff --git a/Tests/AmazonBookTest.cs b/Tests/AmazonBookTest.cs index 753eede..31eb61d 100644 --- a/Tests/AmazonBookTest.cs +++ b/Tests/AmazonBookTest.cs @@ -30,7 +30,7 @@ public void TestGetBook() Assert.AreEqual("Rob Guillory", book.Writer);//Author Assert.AreEqual("Rob Guillory, Taylor Wells", book.CoverArtist); Assert.AreEqual("Rob Guillory, Taylor Wells", book.Penciller);//Artists - Assert.AreEqual(0.0f, book.BookPrice); + Assert.AreEqual(-1f, book.BookPrice); } [TestMethod] @@ -103,7 +103,7 @@ public void TestGetBook4() Assert.AreEqual(@"https://www.amazon.com/dp/B07X5N41P8", book.Web); Assert.AreEqual("Rob Guillory", book.Writer);//Author Assert.AreEqual("Rob Guillory", book.Penciller);//Contributor - Assert.AreEqual(10.99f, book.BookPrice); + Assert.AreEqual(11.99f, book.BookPrice); } [TestMethod] @@ -123,7 +123,7 @@ public void TestGetBook5() Assert.AreEqual(2019, book.Year); Assert.AreEqual("en", book.LanguageISO); Assert.AreEqual("DC", book.Publisher); - Assert.AreEqual(4.5f, book.CommunityRating); + Assert.AreEqual(4.6f, book.CommunityRating); Assert.AreEqual(@"https://www.amazon.com/dp/B07VVTGY3Z", book.Web); Assert.AreEqual("Joshua Williamson", book.Writer);//Author Assert.AreEqual("David Marquez", book.Penciller); @@ -229,5 +229,40 @@ public void TestGetBook9() Assert.AreEqual("Sebastian Piriz", book.Penciller); Assert.AreEqual(1.99f, book.BookPrice); } + + [TestMethod] + public void TestGetBook10() + { + var link = new AmazonLinkIssues("B0CQLL8R8H"); + var book = link.ScrapeData(); + + Assert.AreEqual("I Hate Fairyland Vol. 6", book.Title); + Assert.AreEqual(@"Death by a thousand Gerts! King Cloudeus is determined to finish what his sister Queen Cloudia never could: kick Gert out of Fairyland FOR GOOD! And the only way to do that is have every Gert who ever lived battle each other to the death. Who said there's only so many Gerts to go around?! They clearly haven't read this comic. OG Gert returns to find the last key to escape, but is it too late, and will she become a Lifetime Citizen of Fairyland? Eisner Award-winning writer SKOTTIE YOUNG (MIDDLEWEST, TWIG, THE ME YOU LOVE IN THE DARK) and artist BRETT BEAN (Marvel’s Rocket and Groot) are back in the triumphant return to I HATE FAIRYLAND! Collects I HATE FAIRYLAND (2022) #6-10", book.Summary); + Assert.AreEqual("Scraped metadata from Amazon [B0CQLL8R8H].", book.Notes); + Assert.AreEqual("I Hate Fairyland", book.Series); + Assert.AreEqual("6", book.Number); + Assert.AreEqual(17, book.Day); + Assert.AreEqual(1, book.Month); + Assert.AreEqual(2024, book.Year); + Assert.AreEqual("en", book.LanguageISO); + Assert.AreEqual("Image", book.Publisher); + //Assert.AreEqual(4.3f, book.CommunityRating); + Assert.AreEqual(@"https://www.amazon.com/dp/B0CQLL8R8H", book.Web); + Assert.AreEqual("Skottie Young", book.Writer);//Author + Assert.AreEqual("Skottie Young", book.Penciller);//Artist + Assert.AreEqual("Brett B Bean", book.CoverArtist); + Assert.AreEqual(13.99f, book.BookPrice); + } + + [TestMethod] + public void TestGetBook11() + { + var link = new AmazonLinkIssues("1779524692"); + var book = link.ScrapeData(); + + Assert.AreEqual(27, book.Day); + Assert.AreEqual(2, book.Month); + Assert.AreEqual(2024, book.Year); + } } } diff --git a/Tests/AmazonLinkSerieTest.cs b/Tests/AmazonLinkSerieTest.cs index 975973a..335551c 100644 --- a/Tests/AmazonLinkSerieTest.cs +++ b/Tests/AmazonLinkSerieTest.cs @@ -44,7 +44,7 @@ public void TestSeriesGetIssues2() { var amazonLink = new AmazonLinkSerie("B0932GH6NJ"); var issues = amazonLink.GetIssues();//From the collections View - var thirdIssue = issues[2]; + var thirdIssue = issues[1]; Assert.AreEqual("B08TSN4GCN", thirdIssue.ASIN); Assert.AreEqual("Usagi Yojimbo Saga Volume 2 (Second Edition)", thirdIssue.Title); @@ -56,7 +56,7 @@ public void TestSeriesGetIssues2() Assert.IsNull(thirdIssue.SerieInfo.RawText); Assert.AreEqual("Usagi Yojimbo Saga", thirdIssue.SerieInfo.Serie); Assert.AreEqual("2", thirdIssue.SerieInfo.Number); - Assert.AreEqual(9, thirdIssue.SerieInfo.Count); + Assert.AreEqual(8, thirdIssue.SerieInfo.Count); } [TestMethod] @@ -76,7 +76,7 @@ public void TestLongSeries() Assert.IsNull(fortyIssue.SerieInfo.RawText); Assert.AreEqual("40", fortyIssue.SerieInfo.Number); Assert.AreEqual("Saga", fortyIssue.SerieInfo.Serie); - Assert.AreEqual(64, fortyIssue.SerieInfo.Count); + Assert.AreEqual(66, fortyIssue.SerieInfo.Count); } [TestMethod] diff --git a/Tests/AmazonLinkTest.cs b/Tests/AmazonLinkTest.cs index 714ef7d..e6a0af7 100644 --- a/Tests/AmazonLinkTest.cs +++ b/Tests/AmazonLinkTest.cs @@ -20,7 +20,7 @@ public void TestLinks() Assert.AreEqual($@"https://www.amazon.com/dp/{asin}", amazonLink.Link); var serieASIN = "B07JJ7S3BR"; - var serieText = "Book 16 of 19: Farmhand"; + var serieText = "Book 16 of 20: Farmhand"; var serieLink = $"dp/{serieASIN}?binding=kindle_edition&ref_=dbs_s_ks_series_rwt_tkin&sr=1-18"; var linkSerie = new AmazonLinkSerie(serieText, serieLink); amazonLink.SerieInfo = SerieInfo.Parse(serieText, title, linkSerie); @@ -29,10 +29,10 @@ public void TestLinks() Assert.AreEqual($@"https://www.amazon.com/dp/{serieASIN}", amazonLink.SerieInfo.SerieLink.Link); Assert.AreEqual("Farmhand", amazonLink.SerieInfo.Serie); - Assert.AreEqual("Farmhand (16 of 19 book series)", amazonLink.SerieDisplayText); + Assert.AreEqual("Farmhand (16 of 20 book series)", amazonLink.SerieDisplayText); Assert.AreEqual(serieText, amazonLink.SerieInfo.RawText); Assert.AreEqual("16", amazonLink.SerieInfo.Number); - Assert.AreEqual(19, amazonLink.SerieInfo.Count); + Assert.AreEqual(20, amazonLink.SerieInfo.Count); } [TestMethod] @@ -50,7 +50,7 @@ public void TestLinks2() Assert.AreEqual(imageLink, amazonLink.ImageLink); var serieASIN = "B07JJ7S3BR"; - var serieText = "Book 1 of 19: Farmhand"; + var serieText = "Book 1 of 20: Farmhand"; var serieLink = $"dp/{serieASIN}?binding=kindle_edition&ref_=dbs_s_ks_series_rwt_tkin&sr=1-18"; var linkSerie = new AmazonLinkSerie(serieText, serieLink); amazonLink.SerieInfo = SerieInfo.Parse(serieText, title, linkSerie); @@ -59,10 +59,10 @@ public void TestLinks2() Assert.AreEqual($@"https://www.amazon.com/dp/{serieASIN}", amazonLink.SerieInfo.SerieLink.Link); Assert.AreEqual("Farmhand", amazonLink.SerieInfo.Serie); - Assert.AreEqual("Farmhand (1 of 19 book series)", amazonLink.SerieDisplayText); + Assert.AreEqual("Farmhand (1 of 20 book series)", amazonLink.SerieDisplayText); Assert.AreEqual(serieText, amazonLink.SerieInfo.RawText); Assert.AreEqual("1", amazonLink.SerieInfo.Number); - Assert.AreEqual(19, amazonLink.SerieInfo.Count); + Assert.AreEqual(20, amazonLink.SerieInfo.Count); } [TestMethod] diff --git a/Tests/SearcherTest.cs b/Tests/SearcherTest.cs index 35dd486..612f717 100644 --- a/Tests/SearcherTest.cs +++ b/Tests/SearcherTest.cs @@ -46,10 +46,10 @@ public void TestGetResults() Assert.AreEqual(@"https://m.media-amazon.com/images/I/91n3NKbV9aL._AC_UY654_QL65_.jpg", linkFarm.ImageLink); Assert.AreEqual("Farmhand", linkFarm.SerieInfo.Serie); Assert.AreEqual("Farmhand", linkFarm.SerieInfo.SerieLink.Title); - Assert.IsTrue(Regex.IsMatch(linkFarm.SerieInfo.SerieLink.SerieDisplayText, @"Farmhand \(\d+? book series\)")); + //Assert.IsTrue(Regex.IsMatch(linkFarm.SerieInfo.SerieLink.SerieDisplayText, @"Farmhand \(\d+? book series\)")); Assert.AreEqual("16", linkFarm.SerieInfo.Number); //Assert.AreEqual(19, linkFarm.SerieInfo.Count); - Assert.IsTrue(Regex.IsMatch(linkFarm.SerieDisplayText, @"Farmhand \(16 of \d+? book series\)")); + Assert.IsTrue(Regex.IsMatch(linkFarm.SerieDisplayText, @"Farmhand \(book series\)")); } @@ -65,7 +65,7 @@ public void TestGetResultsSerie() Assert.IsTrue(res.Count > 0); Assert.AreEqual("B07JJ7S3BR", linkFarm.ASIN); Assert.AreEqual("Farmhand", linkFarm.Title); - Assert.IsTrue(Regex.IsMatch(linkFarm.SerieDisplayText, @"Farmhand \(\d+? book series\)")); + //Assert.IsTrue(Regex.IsMatch(linkFarm.SerieDisplayText, @"Farmhand \(\d+ book series\)")); Assert.AreEqual(@"https://www.amazon.com/dp/B07JJ7S3BR", linkFarm.Link); } }