Add project files.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using MangaReader.Core.HttpService;
|
||||
using MangaReader.Core.WebSearch;
|
||||
using MangaReader.Core.WebSearch.NatoManga;
|
||||
using MangaReader.Tests.Utilities;
|
||||
using NSubstitute;
|
||||
using Shouldly;
|
||||
|
||||
namespace MangaReader.Tests.WebSearch.NatoManga;
|
||||
|
||||
public class NatoMangaWebSearchTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task Get_Search_Result()
|
||||
{
|
||||
string resourceName = "MangaReader.Tests.WebSearch.NatoManga.SampleSearchResult.json";
|
||||
string searchResultJson = await ResourceHelper.ReadJsonResourceAsync(resourceName);
|
||||
|
||||
IHttpService httpService = Substitute.For<IHttpService>();
|
||||
|
||||
httpService.GetStringAsync(Arg.Any<string>())
|
||||
.Returns(Task.FromResult(searchResultJson));
|
||||
|
||||
NatoMangaWebSearch webSearch = new(httpService);
|
||||
MangaSearchResult[] searchResult = await webSearch.SearchAsync("Gals Can't Be Kind");
|
||||
|
||||
searchResult.Length.ShouldBe(2);
|
||||
searchResult[0].Title.ShouldBe("Gal Can't Be Kind to Otaku!");
|
||||
searchResult[1].Title.ShouldBe("Gal Can’t Be Kind to Otaku!?");
|
||||
searchResult[0].Url.ShouldBe("https://www.natomanga.com/manga/gal-can-t-be-kind-to-otaku");
|
||||
searchResult[1].Url.ShouldBe("https://www.natomanga.com/manga/gal-cant-be-kind-to-otaku");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
[
|
||||
{
|
||||
"id": 51811,
|
||||
"author": "Norishiro-chan, Sakana Uozumi",
|
||||
"name": "Gal Can't Be Kind to Otaku!",
|
||||
"chapterLatest": "Chapter 69",
|
||||
"url": "https:\/\/www.natomanga.com\/manga\/gal-can-t-be-kind-to-otaku",
|
||||
"thumb": "https:\/\/img-r1.2xstorage.com\/thumb\/gal-can-t-be-kind-to-otaku.webp",
|
||||
"slug": "gal-can-t-be-kind-to-otaku"
|
||||
},
|
||||
{
|
||||
"id": 38065,
|
||||
"author": "Norishiro-chan,Sakana Uozimi",
|
||||
"name": "Gal Can\u2019t Be Kind to Otaku!?",
|
||||
"chapterLatest": "Chapter 69",
|
||||
"url": "https:\/\/www.natomanga.com\/manga\/gal-cant-be-kind-to-otaku",
|
||||
"thumb": "https:\/\/img-r1.2xstorage.com\/thumb\/gal-cant-be-kind-to-otaku.webp",
|
||||
"slug": "gal-cant-be-kind-to-otaku"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user