Added more UI logic. Added a manga pipeline test.

This commit is contained in:
2025-06-04 02:21:30 -04:00
parent 7dbcdc6169
commit 70513559cb
21 changed files with 264 additions and 73 deletions

View File

@@ -0,0 +1,53 @@
using MangaReader.Core.Data;
using MangaReader.Core.Metadata;
using MangaReader.Core.Pipeline;
using MangaReader.Tests.Utilities;
namespace MangaReader.Tests.Pipeline;
public class MangaPipelineTests(TestDbContextFactory factory) : IClassFixture<TestDbContextFactory>
{
[Fact]
public async Task RunAsync_SavesMangaTitlesChaptersGenres()
{
using MangaContext context = factory.CreateContext();
var pipeline = new MangaPipeline(context);
var sourceManga = new SourceManga
{
Title = "Fullmetal Alchemist",
AlternateTitles =
[
new()
{
Title = "Hagane no Renkinjutsushi",
Language = SourceMangaLanguage.Romanji
}
],
Genres = ["Action", "Adventure"],
Chapters =
[
new()
{
Number = 1,
Title = "The Two Alchemists",
Volume = 1,
Url = string.Empty
}
]
};
MangaPipelineRequest request = new()
{
SourceName = "MySource",
SourceManga = sourceManga
};
await pipeline.RunAsync(request);
Assert.Single(context.Mangas);
Assert.Single(context.MangaTitles);
Assert.Equal(2, context.Genres.Count());
Assert.Single(context.MangaChapters);
}
}