mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 17: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
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary.BookLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.WrittenContentLibrary.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="UpdateBookCoverDto"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateBookCoverDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UpdateBookCoverDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="coverPath">Optional. The relative path of the stored cover image.</param>
|
||||
/// <returns>A configured <see cref="UpdateBookCoverDto"/> instance.</returns>
|
||||
public UpdateBookCoverDto Create(string? coverPath = null)
|
||||
{
|
||||
return new UpdateBookCoverDto
|
||||
{
|
||||
CoverPath = coverPath ?? _faker.System.FilePath()
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="UpdateBookCoverDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="UpdateBookCoverDto"/> instances.</returns>
|
||||
public List<UpdateBookCoverDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -18,11 +18,13 @@ public class GetBookRequestFixture
|
||||
/// Creates a new <see cref="GetBookRequest"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional unique identifier of the book to retrieve.</param>
|
||||
/// <param name="libraryId">Optional unique identifier of the media library the book belongs to.</param>
|
||||
/// <returns>A configured <see cref="GetBookRequest"/> instance.</returns>
|
||||
public GetBookRequest Create(
|
||||
Guid? id = null)
|
||||
Guid? id = null,
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new GetBookRequest(id?.ToString() ?? Guid.NewGuid().ToString());
|
||||
return new GetBookRequest(id?.ToString() ?? Guid.NewGuid().ToString(), libraryId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+4
-2
@@ -18,11 +18,13 @@ public class GetBookReadingAvailabilityRequestFixture
|
||||
/// Creates a random valid <see cref="GetBookReadingAvailabilityRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="bookId">Optional. The Id of the book whose reading availability is checked.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the book belongs to.</param>
|
||||
/// <returns>The created <see cref="GetBookReadingAvailabilityRequest"/>.</returns>
|
||||
public GetBookReadingAvailabilityRequest Create(
|
||||
Guid? bookId = null)
|
||||
Guid? bookId = null,
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new GetBookReadingAvailabilityRequest(bookId ?? Guid.NewGuid());
|
||||
return new GetBookReadingAvailabilityRequest(bookId ?? Guid.NewGuid(), libraryId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+4
-2
@@ -18,11 +18,13 @@ public class GetBookReadingManifestRequestFixture
|
||||
/// Creates a random valid <see cref="GetBookReadingManifestRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="bookId">Optional. The Id of the book whose reading manifest is retrieved.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the book belongs to.</param>
|
||||
/// <returns>The created <see cref="GetBookReadingManifestRequest"/>.</returns>
|
||||
public GetBookReadingManifestRequest Create(
|
||||
Guid? bookId = null)
|
||||
Guid? bookId = null,
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new GetBookReadingManifestRequest(bookId ?? Guid.NewGuid());
|
||||
return new GetBookReadingManifestRequest(bookId ?? Guid.NewGuid(), libraryId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+4
-2
@@ -19,12 +19,14 @@ public class GetBookReadingResourceRequestFixture
|
||||
/// </summary>
|
||||
/// <param name="bookId">Optional. The Id of the book whose resource is retrieved.</param>
|
||||
/// <param name="resourceKey">Optional. The opaque resource key of the resource.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the book belongs to.</param>
|
||||
/// <returns>The created <see cref="GetBookReadingResourceRequest"/>.</returns>
|
||||
public GetBookReadingResourceRequest Create(
|
||||
Guid? bookId = null,
|
||||
string? resourceKey = null)
|
||||
string? resourceKey = null,
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new GetBookReadingResourceRequest(bookId ?? Guid.NewGuid(), resourceKey ?? $"resource-{Guid.NewGuid():N}");
|
||||
return new GetBookReadingResourceRequest(bookId ?? Guid.NewGuid(), resourceKey ?? $"resource-{Guid.NewGuid():N}", libraryId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+4
-2
@@ -19,12 +19,14 @@ public class GetBookReadingSectionRequestFixture
|
||||
/// </summary>
|
||||
/// <param name="bookId">Optional. The Id of the book whose reading section is retrieved.</param>
|
||||
/// <param name="locationRef">Optional. The opaque location reference of the reading section.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the book belongs to.</param>
|
||||
/// <returns>The created <see cref="GetBookReadingSectionRequest"/>.</returns>
|
||||
public GetBookReadingSectionRequest Create(
|
||||
Guid? bookId = null,
|
||||
string? locationRef = null)
|
||||
string? locationRef = null,
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new GetBookReadingSectionRequest(bookId ?? Guid.NewGuid(), locationRef ?? $"section-{Guid.NewGuid():N}");
|
||||
return new GetBookReadingSectionRequest(bookId ?? Guid.NewGuid(), locationRef ?? $"section-{Guid.NewGuid():N}", libraryId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+4
-2
@@ -18,11 +18,13 @@ public class ReadBookViewRequestFixture
|
||||
/// Creates a random valid <see cref="ReadBookViewRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="bookId">Optional. The Id of the book to read.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the book belongs to.</param>
|
||||
/// <returns>The created <see cref="ReadBookViewRequest"/>.</returns>
|
||||
public ReadBookViewRequest Create(
|
||||
Guid? bookId = null)
|
||||
Guid? bookId = null,
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new ReadBookViewRequest(bookId ?? Guid.NewGuid());
|
||||
return new ReadBookViewRequest(bookId ?? Guid.NewGuid(), libraryId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user