Refactors the book, artist, and album slices across the stack

This commit is contained in:
BinaryAlley committed 2026-09-17 13:30:48 -07:00
1 parent 8aaf9fe64e
commit ea6eb9f796
439 files changed
+28235 -3156

No files matched your search

@@ -19,19 +19,22 @@ public class UpdateBookCoverCommandFixture
/// <summary>
/// Creates a random valid <see cref="UpdateBookCoverCommand"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library the book belongs to.</param>
/// <param name="bookId">Optional. The Id of the book whose cover is updated.</param>
/// <param name="cover">Optional. The stream of the uploaded cover image file.</param>
/// <param name="fileName">Optional. The name of the uploaded cover image file.</param>
/// <param name="includeCover">Whether the cover stream should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="UpdateBookCoverCommand"/>.</returns>
public UpdateBookCoverCommand Create(
Guid? bookId = null,
string? libraryId = null,
string? bookId = null,
Stream? cover = null,
string? fileName = null,
bool includeCover = true)
{
return new UpdateBookCoverCommand(
bookId ?? Guid.NewGuid(),
libraryId ?? Guid.NewGuid().ToString(),
bookId ?? Guid.NewGuid().ToString(),
includeCover ? (cover ?? CreateCoverStream()) : null,
fileName ?? "cover.jpg"
);
@@ -17,12 +17,14 @@ public class GetReadingAvailabilityQueryFixture
/// <summary>
/// Creates a random valid query to check the reading availability of a book.
/// </summary>
/// <param name="libraryId">Optional. The Id of the library the book belongs to.</param>
/// <param name="bookId">Optional. The Id of the book whose reading availability is checked.</param>
/// <returns>The created <see cref="GetReadingAvailabilityQuery"/>.</returns>
public GetReadingAvailabilityQuery Create(
Guid? bookId = null)
string? libraryId = null,
string? bookId = null)
{
return new GetReadingAvailabilityQuery(bookId ?? Guid.NewGuid());
return new GetReadingAvailabilityQuery(libraryId ?? Guid.NewGuid().ToString(), bookId ?? Guid.NewGuid().ToString());
}
/// <summary>
@@ -17,12 +17,14 @@ public class GetReadingManifestQueryFixture
/// <summary>
/// Creates a random valid query to get the reading manifest of a book.
/// </summary>
/// <param name="libraryId">Optional. The Id of the library the book belongs to.</param>
/// <param name="bookId">Optional. The Id of the book whose reading manifest is retrieved.</param>
/// <returns>The created <see cref="GetReadingManifestQuery"/>.</returns>
public GetReadingManifestQuery Create(
Guid? bookId = null)
string? libraryId = null,
string? bookId = null)
{
return new GetReadingManifestQuery(bookId ?? Guid.NewGuid());
return new GetReadingManifestQuery(libraryId ?? Guid.NewGuid().ToString(), bookId ?? Guid.NewGuid().ToString());
}
/// <summary>
@@ -17,14 +17,16 @@ public class GetReadingResourceQueryFixture
/// <summary>
/// Creates a random valid query to get a resource of a book.
/// </summary>
/// <param name="libraryId">Optional. The Id of the library the book belongs to.</param>
/// <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>
/// <returns>The created <see cref="GetReadingResourceQuery"/>.</returns>
public GetReadingResourceQuery Create(
Guid? bookId = null,
string? libraryId = null,
string? bookId = null,
string? resourceKey = null)
{
return new GetReadingResourceQuery(bookId ?? Guid.NewGuid(), resourceKey ?? $"resource-{Guid.NewGuid():N}");
return new GetReadingResourceQuery(libraryId ?? Guid.NewGuid().ToString(), bookId ?? Guid.NewGuid().ToString(), resourceKey ?? $"resource-{Guid.NewGuid():N}");
}
/// <summary>
@@ -17,14 +17,16 @@ public class GetReadingSectionQueryFixture
/// <summary>
/// Creates a random valid query to get the content of a reading section of a book.
/// </summary>
/// <param name="libraryId">Optional. The Id of the library the book belongs to.</param>
/// <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>
/// <returns>The created <see cref="GetReadingSectionQuery"/>.</returns>
public GetReadingSectionQuery Create(
Guid? bookId = null,
string? libraryId = null,
string? bookId = null,
string? locationRef = null)
{
return new GetReadingSectionQuery(bookId ?? Guid.NewGuid(), locationRef ?? $"section-{Guid.NewGuid():N}");
return new GetReadingSectionQuery(libraryId ?? Guid.NewGuid().ToString(), bookId ?? Guid.NewGuid().ToString(), locationRef ?? $"section-{Guid.NewGuid():N}");
}
/// <summary>
@@ -1,37 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Reading;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Reading;
/// <summary>
/// Fixture class for the <see cref="GetReadingAvailabilityRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetReadingAvailabilityRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="GetReadingAvailabilityRequest"/>.
/// </summary>
/// <param name="bookId">Optional. The Id of the book whose reading availability is checked.</param>
/// <returns>The created <see cref="GetReadingAvailabilityRequest"/>.</returns>
public GetReadingAvailabilityRequest Create(
Guid? bookId = null)
{
return new GetReadingAvailabilityRequest(bookId ?? Guid.NewGuid());
}
/// <summary>
/// Creates a list of <see cref="GetReadingAvailabilityRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetReadingAvailabilityRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,37 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Reading;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Reading;
/// <summary>
/// Fixture class for the <see cref="GetReadingManifestRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetReadingManifestRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="GetReadingManifestRequest"/>.
/// </summary>
/// <param name="bookId">Optional. The Id of the book whose reading manifest is retrieved.</param>
/// <returns>The created <see cref="GetReadingManifestRequest"/>.</returns>
public GetReadingManifestRequest Create(
Guid? bookId = null)
{
return new GetReadingManifestRequest(bookId ?? Guid.NewGuid());
}
/// <summary>
/// Creates a list of <see cref="GetReadingManifestRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetReadingManifestRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,39 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Reading;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Reading;
/// <summary>
/// Fixture class for the <see cref="GetReadingResourceRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetReadingResourceRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="GetReadingResourceRequest"/>.
/// </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>
/// <returns>The created <see cref="GetReadingResourceRequest"/>.</returns>
public GetReadingResourceRequest Create(
Guid? bookId = null,
string? resourceKey = null)
{
return new GetReadingResourceRequest(bookId ?? Guid.NewGuid(), resourceKey ?? $"resource-{Guid.NewGuid():N}");
}
/// <summary>
/// Creates a list of <see cref="GetReadingResourceRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetReadingResourceRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,39 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Reading;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Reading;
/// <summary>
/// Fixture class for the <see cref="GetReadingSectionRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetReadingSectionRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="GetReadingSectionRequest"/>.
/// </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>
/// <returns>The created <see cref="GetReadingSectionRequest"/>.</returns>
public GetReadingSectionRequest Create(
Guid? bookId = null,
string? locationRef = null)
{
return new GetReadingSectionRequest(bookId ?? Guid.NewGuid(), locationRef ?? $"section-{Guid.NewGuid():N}");
}
/// <summary>
/// Creates a list of <see cref="GetReadingSectionRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetReadingSectionRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,40 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
/// <summary>
/// Fixture class for the <see cref="UpdateBookCoverResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class UpdateBookCoverResponseFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="UpdateBookCoverResponse"/>.
/// </summary>
/// <param name="coverPath">Optional. The relative path of the stored cover image.</param>
/// <returns>The created <see cref="UpdateBookCoverResponse"/>.</returns>
public UpdateBookCoverResponse Create(string? coverPath = null)
{
return new UpdateBookCoverResponse(
coverPath ?? _faker.System.FilePath()
);
}
/// <summary>
/// Creates a list of <see cref="UpdateBookCoverResponse"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<UpdateBookCoverResponse> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,37 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Domain.Fixtures.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
/// <summary>
/// Fixture class for the <see cref="BookLibraryId"/> domain value object.
/// </summary>
[ExcludeFromCodeCoverage]
public class BookLibraryIdFixture
{
/// <summary>
/// Creates a random valid <see cref="BookLibraryId"/>.
/// </summary>
/// <param name="value">Optional. The value used to create the <see cref="BookLibraryId"/>. If not provided, a random value is generated.</param>
/// <returns>The created <see cref="BookLibraryId"/>.</returns>
public BookLibraryId Create(Guid? value = null)
{
return value is null ? BookLibraryId.CreateUnique().Value : BookLibraryId.Create(value.Value).Value;
}
/// <summary>
/// Creates multiple <see cref="BookLibraryId"/> instances with randomized test data.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="BookLibraryId"/> instances.</returns>
public List<BookLibraryId> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -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())];
}
}
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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>