mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 09:11:10 +00:00
Refactors the book, artist, and album slices across the stack
This commit is contained in:
1 parent
8aaf9fe64e
commit
ea6eb9f796
439 files changed
+28235
-3156
No files matched your search
+8
-8
@@ -1,7 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.DataAccess.Core.Repositories.Books;
|
||||
using Lumina.DataAccess.Core.Repositories.BookLibrary;
|
||||
using Lumina.DataAccess.Core.UoW;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
@@ -16,7 +16,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.DataAccess.IntegrationTests.Core.Repositories.Books;
|
||||
namespace Lumina.DataAccess.IntegrationTests.Core.Repositories.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Contains integration tests for the <see cref="BookRepository"/> class, exercising it against a real SQLite database.
|
||||
@@ -43,12 +43,12 @@ public class BookRepositoryTests
|
||||
changedBook.LibraryId = libraryId;
|
||||
changedBook.Path = "/books/changed.epub";
|
||||
changedBook.MetadataStatus = MetadataStatus.Enriched;
|
||||
changedBook.BookArtwork = [_bookArtworkEntityFixture.Create(bookId: changedBook.Id, artworkType: ArtworkType.Cover, ordinal: 0, status: ArtworkStatus.Enriched)];
|
||||
changedBook.Artwork = [_bookArtworkEntityFixture.Create(bookId: changedBook.Id, artworkType: ArtworkType.Cover, ordinal: 0, status: ArtworkStatus.Enriched)];
|
||||
BookEntity unchangedBook = _bookEntityFixture.Create();
|
||||
unchangedBook.LibraryId = libraryId;
|
||||
unchangedBook.Path = "/books/unchanged.epub";
|
||||
unchangedBook.MetadataStatus = MetadataStatus.Enriched;
|
||||
unchangedBook.BookArtwork = [_bookArtworkEntityFixture.Create(bookId: unchangedBook.Id, artworkType: ArtworkType.Cover, ordinal: 0, status: ArtworkStatus.Enriched)];
|
||||
unchangedBook.Artwork = [_bookArtworkEntityFixture.Create(bookId: unchangedBook.Id, artworkType: ArtworkType.Cover, ordinal: 0, status: ArtworkStatus.Enriched)];
|
||||
context.Books.AddRange(changedBook, unchangedBook);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
@@ -58,10 +58,10 @@ public class BookRepositoryTests
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.Equal(Result.Updated, result.Value);
|
||||
BookEntity? resetBook = await context.Books.AsNoTracking().Include(book => book.BookArtwork).FirstOrDefaultAsync(book => book.Id == changedBook.Id);
|
||||
BookEntity? resetBook = await context.Books.AsNoTracking().Include(book => book.Artwork).FirstOrDefaultAsync(book => book.Id == changedBook.Id);
|
||||
Assert.NotNull(resetBook);
|
||||
Assert.Equal(MetadataStatus.Pending, resetBook!.MetadataStatus);
|
||||
Assert.Equal(ArtworkStatus.Pending, resetBook.BookArtwork.Single().Status);
|
||||
Assert.Equal(ArtworkStatus.Pending, resetBook.Artwork.Single().Status);
|
||||
BookEntity? keptBook = await context.Books.AsNoTracking().FirstOrDefaultAsync(book => book.Id == unchangedBook.Id);
|
||||
Assert.NotNull(keptBook);
|
||||
Assert.Equal(MetadataStatus.Enriched, keptBook!.MetadataStatus);
|
||||
@@ -116,10 +116,10 @@ public class BookRepositoryTests
|
||||
Guid libraryId = Guid.NewGuid();
|
||||
BookEntity book = _bookEntityFixture.Create();
|
||||
book.LibraryId = libraryId;
|
||||
book.BookArtwork = [_bookArtworkEntityFixture.Create(bookId: book.Id, artworkType: ArtworkType.Cover, ordinal: 0, status: ArtworkStatus.Enriched)];
|
||||
book.Artwork = [_bookArtworkEntityFixture.Create(bookId: book.Id, artworkType: ArtworkType.Cover, ordinal: 0, status: ArtworkStatus.Enriched)];
|
||||
BookEntity bookOfAnotherLibrary = _bookEntityFixture.Create();
|
||||
bookOfAnotherLibrary.LibraryId = Guid.NewGuid();
|
||||
bookOfAnotherLibrary.BookArtwork = [_bookArtworkEntityFixture.Create(bookId: bookOfAnotherLibrary.Id, artworkType: ArtworkType.Cover, ordinal: 0, status: ArtworkStatus.Enriched)];
|
||||
bookOfAnotherLibrary.Artwork = [_bookArtworkEntityFixture.Create(bookId: bookOfAnotherLibrary.Id, artworkType: ArtworkType.Cover, ordinal: 0, status: ArtworkStatus.Enriched)];
|
||||
context.Books.AddRange(book, bookOfAnotherLibrary);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
Reference in new issue
Block a user