Add project files.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using MangaReader.Core.WebCrawlers.NatoManga;
|
||||
using Shouldly;
|
||||
|
||||
namespace MangaReader.Tests.WebCrawlers.NatoManga;
|
||||
|
||||
public class NatoMangaWebCrawlerTests
|
||||
{
|
||||
[Fact]
|
||||
public void Get_Manga()
|
||||
{
|
||||
string sampleFilePath = Path.Combine(AppContext.BaseDirectory, "WebCrawlers", "NatoManga", "SampleMangaPage.html");
|
||||
|
||||
var webCrawler = new NatoMangaWebCrawler();
|
||||
var manga = webCrawler.GetManga(sampleFilePath);
|
||||
|
||||
manga.ShouldNotBeNull();
|
||||
|
||||
manga.Title.ShouldBe("Gal Can’t Be Kind to Otaku!?");
|
||||
|
||||
//manga.AlternateTitles.ShouldBe([
|
||||
// "Kaette kudasai! Akutsu-san",
|
||||
// "Yankee Musume",
|
||||
// "ヤンキー娘",
|
||||
// "帰ってください! 阿久津さん"]);
|
||||
|
||||
//manga.Authors.ShouldBe(["Nagaoka Taichi"]);
|
||||
//manga.Status.ShouldBe(MangaStatus.Ongoing);
|
||||
manga.Genres.ShouldBe(["Comedy", "Harem", "Romance", "School life", "Seinen", "Slice of life"]);
|
||||
//manga.UpdateDate.ShouldBe(new DateTime(2024, 9, 26, 0, 12, 0));
|
||||
//manga.Views.ShouldBe(93_300_000);
|
||||
//manga.RatingPercent.ShouldBe(97);
|
||||
//manga.Votes.ShouldBe(15979);
|
||||
|
||||
////manga.Description.ShouldStartWith("Ooyama-kun normally doesn’t get involved with Akutsu-san, a delinquent girl in his class");
|
||||
//manga.Description.ShouldStartWith("Ooyama-kun normally doesn’t get involved with Akutsu-san, a delinquent girl in his class");
|
||||
//manga.Description.ShouldEndWith("Artist's Pixiv: https://www.pixiv.net/member.php?id=133935");
|
||||
|
||||
manga.Chapters.Count.ShouldBe(83);
|
||||
|
||||
manga.Chapters[0].Url.ShouldBe("https://www.natomanga.com/manga/gal-cant-be-kind-to-otaku/chapter-69");
|
||||
manga.Chapters[0].Number.ShouldBe(69);
|
||||
manga.Chapters[0].Name.ShouldBe("Chapter 69");
|
||||
manga.Chapters[0].Views.ShouldBe(8146);
|
||||
//manga.Chapters[0].UploadDate.ShouldBe(new DateTime(2025, 4, 23, 17, 17, 0));
|
||||
|
||||
//manga.Chapters[235].URL.ShouldBe("https://chapmanganato.to/manga-hf984788/chapter-0.1");
|
||||
//manga.Chapters[235].Number.ShouldBe(0.1f);
|
||||
//manga.Chapters[235].Name.ShouldBe("Vol.0 Chapter : Oneshot");
|
||||
//manga.Chapters[235].Views.ShouldBe(232_200);
|
||||
//manga.Chapters[235].UploadDate.ShouldBe(new DateTime(2021, 8, 24, 1, 8, 0));
|
||||
}
|
||||
}
|
||||
3112
MangaReader.Tests/WebCrawlers/NatoManga/SampleMangaPage.html
Normal file
3112
MangaReader.Tests/WebCrawlers/NatoManga/SampleMangaPage.html
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
60
MangaReader.Tests/WebCrawlers/UnitTest1.cs
Normal file
60
MangaReader.Tests/WebCrawlers/UnitTest1.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using MangaReader.Core.WebCrawlers;
|
||||
using MangaReader.Core.WebCrawlers.MangaNato;
|
||||
using Shouldly;
|
||||
|
||||
namespace MangaReader.Tests.WebCrawlers;
|
||||
|
||||
public class UnitTest1
|
||||
{
|
||||
private readonly string samplesPath;
|
||||
private readonly string mangaNatoSampleFilePath;
|
||||
|
||||
public UnitTest1()
|
||||
{
|
||||
samplesPath = Path.Combine(AppContext.BaseDirectory, "WebCrawlers", "Samples");
|
||||
mangaNatoSampleFilePath = Path.Combine(samplesPath, "MangaNato - Please Go Home, Akutsu-San!.htm");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Get_Manga()
|
||||
{
|
||||
var webCrawler = new MangaNatoWebCrawler();
|
||||
var manga = webCrawler.GetManga(mangaNatoSampleFilePath);
|
||||
|
||||
manga.ShouldNotBeNull();
|
||||
|
||||
manga.Title.ShouldBe("Please Go Home, Akutsu-San!");
|
||||
|
||||
manga.AlternateTitles.ShouldBe([
|
||||
"Kaette kudasai! Akutsu-san",
|
||||
"Yankee Musume",
|
||||
"ヤンキー娘",
|
||||
"帰ってください! 阿久津さん"]);
|
||||
|
||||
manga.Authors.ShouldBe(["Nagaoka Taichi"]);
|
||||
manga.Status.ShouldBe(MangaStatus.Ongoing);
|
||||
manga.Genres.ShouldBe(["Comedy", "Romance", "School life"]);
|
||||
manga.UpdateDate.ShouldBe(new DateTime(2024, 9, 26, 0, 12, 0));
|
||||
manga.Views.ShouldBe(93_300_000);
|
||||
manga.RatingPercent.ShouldBe(97);
|
||||
manga.Votes.ShouldBe(15979);
|
||||
|
||||
//manga.Description.ShouldStartWith("Ooyama-kun normally doesn’t get involved with Akutsu-san, a delinquent girl in his class");
|
||||
manga.Description.ShouldStartWith("Ooyama-kun normally doesn’t get involved with Akutsu-san, a delinquent girl in his class");
|
||||
manga.Description.ShouldEndWith("Artist's Pixiv: https://www.pixiv.net/member.php?id=133935");
|
||||
|
||||
manga.Chapters.Count.ShouldBe(236);
|
||||
|
||||
manga.Chapters[0].Url.ShouldBe("https://chapmanganato.to/manga-hf984788/chapter-186");
|
||||
manga.Chapters[0].Number.ShouldBe(186);
|
||||
manga.Chapters[0].Name.ShouldBe("Chapter 186");
|
||||
manga.Chapters[0].Views.ShouldBe(37_900);
|
||||
manga.Chapters[0].UploadDate.ShouldBe(new DateTime(2024, 9, 26, 0, 9, 0));
|
||||
|
||||
manga.Chapters[235].Url.ShouldBe("https://chapmanganato.to/manga-hf984788/chapter-0.1");
|
||||
manga.Chapters[235].Number.ShouldBe(0.1f);
|
||||
manga.Chapters[235].Name.ShouldBe("Vol.0 Chapter : Oneshot");
|
||||
manga.Chapters[235].Views.ShouldBe(232_200);
|
||||
manga.Chapters[235].UploadDate.ShouldBe(new DateTime(2021, 8, 24, 1, 8, 0));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user