Added UI app.

This commit is contained in:
2025-06-01 22:29:14 -04:00
parent 1348684144
commit 7dbcdc6169
36 changed files with 1645 additions and 25 deletions

View File

@@ -70,6 +70,68 @@ public class MangaDexClientTests
coverArtEntity.Attributes.FileName.ShouldBe("6b3073de-bb65-4723-8113-6068bf8c6eb4.jpg");
}
[Fact]
public async Task Search_Manga_2()
{
string searchResultJson = await ReadJsonResourceAsync("Manga-Search-Response-2.json");
IHttpService httpService = Substitute.For<IHttpService>();
httpService.GetStringAsync(Arg.Any<string>(), CancellationToken.None)
.Returns(Task.FromResult(searchResultJson));
MangaDexClient mangaDexClient = new(httpService);
MangaDexResponse? mangaDexResponse = await mangaDexClient.SearchMangaByTitleAsync("Some random text", CancellationToken.None);
// Testing here
mangaDexResponse.ShouldNotBeNull();
mangaDexResponse.Response.ShouldBe("collection");
mangaDexResponse.ShouldBeOfType<MangaDexCollectionResponse>();
MangaDexCollectionResponse mangaDexCollectionResponse = (mangaDexResponse as MangaDexCollectionResponse)!;
mangaDexCollectionResponse.Data.Count.ShouldBe(5);
mangaDexCollectionResponse.Data[3].ShouldBeOfType<MangaEntity>();
MangaEntity mangaEntity = (mangaDexCollectionResponse.Data[3] as MangaEntity)!;
mangaEntity.Attributes.ShouldNotBeNull();
mangaEntity.Attributes.Title.ShouldContainKey("en");
mangaEntity.Attributes.Title["en"].ShouldBe("Gal Yome no Himitsu");
mangaEntity.Attributes.Description.ShouldContainKey("en");
mangaEntity.Attributes.Description["en"].ShouldBe("Fuyuki is a beautiful and cool gal! But there's a secret side of her that she only shows in front of her husband...?");
mangaEntity.Attributes.Tags.Count.ShouldBe(5);
//mangaEntity.Attributes.Tags[0].Attributes.ShouldNotBeNull();
//mangaEntity.Attributes.Tags[0].Attributes!.Name.ShouldContainKey("en");
//mangaEntity.Attributes.Tags[0].Attributes!.Name["en"].ShouldBe("Romance");
//mangaEntity.Attributes.Tags[1].Attributes.ShouldNotBeNull();
//mangaEntity.Attributes.Tags[1].Attributes!.Name.ShouldContainKey("en");
//mangaEntity.Attributes.Tags[1].Attributes!.Name["en"].ShouldBe("Comedy");
//mangaEntity.Attributes.Tags[2].Attributes.ShouldNotBeNull();
//mangaEntity.Attributes.Tags[2].Attributes!.Name.ShouldContainKey("en");
//mangaEntity.Attributes.Tags[2].Attributes!.Name["en"].ShouldBe("School Life");
//mangaEntity.Attributes.Tags[3].Attributes.ShouldNotBeNull();
//mangaEntity.Attributes.Tags[3].Attributes!.Name.ShouldContainKey("en");
//mangaEntity.Attributes.Tags[3].Attributes!.Name["en"].ShouldBe("Slice of Life");
//mangaEntity.Attributes.Tags[4].Attributes.ShouldNotBeNull();
//mangaEntity.Attributes.Tags[4].Attributes!.Name.ShouldContainKey("en");
//mangaEntity.Attributes.Tags[4].Attributes!.Name["en"].ShouldBe("Gyaru");
mangaEntity.Relationships.Count.ShouldBe(4);
mangaEntity.Relationships[2].ShouldBeOfType<CoverArtEntity>();
CoverArtEntity coverArtEntity = (mangaEntity.Relationships[2] as CoverArtEntity)!;
coverArtEntity.Attributes.ShouldNotBeNull();
coverArtEntity.Attributes.FileName.ShouldBe("07d02b26-cbd0-4323-8774-9d83579863d5.jpg");
}
[Fact]
public async Task Get_Manga_Metadata()
{