diff --git a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/Authorization/RoleEntityFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/Authorization/RoleEntityFixture.cs
index 3ffee2c1..234cc401 100644
--- a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/Authorization/RoleEntityFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/Authorization/RoleEntityFixture.cs
@@ -23,7 +23,7 @@ public class RoleEntityFixture
/// Optional. The Id of the role.
/// Optional. The name of the role.
/// Optional. The role permission associations of the role.
- /// Whether the role should include role permission associations or not.
+ /// Whether the role permission associations should be included, or forced to an empty collection.
/// Optional. The Id of the user that created the role.
/// Optional. The time and date when the role was added.
/// The created .
diff --git a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntityFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntityFixture.cs
index ecc55b88..4d7afec4 100644
--- a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntityFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntityFixture.cs
@@ -87,9 +87,10 @@ public class LibraryEntityFixture
/// Creates a list of instances with randomized test data.
///
/// Number of instances to create.
+ /// Optional. The Id of the user that owns the created media libraries.
/// List of configured instances.
- public List CreateMany(int count = 3)
+ public List CreateMany(int count = 3, Guid? userId = null)
{
- return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ return [.. Enumerable.Range(0, count).Select(_ => Create(userId: userId))];
}
}
diff --git a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookEntityFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookEntityFixture.cs
index fe191177..0a4ed757 100644
--- a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookEntityFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookEntityFixture.cs
@@ -28,7 +28,7 @@ public class BookEntityFixture
/// Optional. The file system path of the book.
/// Optional. The title of the book.
/// Optional. The original title of the book.
- /// Whether the book should include its owned metadata collections (Tags, Genres, ISBNs, Ratings) or not.
+ /// Whether the owned metadata collections (Tags, Genres, ISBNs, Ratings) should be included, or forced to empty collections.
/// The created .
public BookEntity Create(
Guid? id = null,
diff --git a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookRatingEntityFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookRatingEntityFixture.cs
index e06ad74d..c5c2ddda 100644
--- a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookRatingEntityFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookRatingEntityFixture.cs
@@ -26,7 +26,7 @@ public class BookRatingEntityFixture
/// Optional. The maximum possible rating value.
/// Optional. The rating source.
/// Optional. The number of votes.
- /// Whether the rating properties should be populated. Set to to create an invalid entity.
+ /// Whether the rating properties should be included, or forced to .
/// The created book rating entity.
public BookRatingEntity Create(
decimal? value = null,
diff --git a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/Themes/ThemeEntityFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/Themes/ThemeEntityFixture.cs
index f51fec10..6208cb12 100644
--- a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/Themes/ThemeEntityFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/Themes/ThemeEntityFixture.cs
@@ -26,18 +26,18 @@ public class ThemeEntityFixture
/// Optional author of the theme.
/// Optional version of the theme.
/// Optional preview image path of the theme, or when the theme has no preview.
- /// Whether to set , or when .
+ /// Whether the preview path should be included, or forced to .
/// Optional source the theme was installed from.
/// Optional value indicating whether the theme is the currently active one.
- /// Whether to set , or when .
+ /// Whether the currently active flag should be included, or forced to .
/// Optional value indicating whether the theme was soft deleted.
/// Optional UTC timestamp when the theme was installed.
/// Optional UTC timestamp when the entity was created.
/// Optional Id of the user that created the entity.
/// Optional UTC timestamp when the entity was updated.
- /// Whether to set , or when .
+ /// Whether the updated-on timestamp should be included, or forced to .
/// Optional Id of the user that updated the entity.
- /// Whether to set , or when .
+ /// Whether the updated-by user Id should be included, or forced to .
/// A configured instance.
public ThemeEntity Create(
Guid? id = null,
diff --git a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserEntityFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserEntityFixture.cs
index ee757fb6..61710769 100644
--- a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserEntityFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserEntityFixture.cs
@@ -3,7 +3,7 @@ using Bogus;
using Lumina.Application.Common.DataAccess.Entities.Authorization;
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
-using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
+using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -18,6 +18,8 @@ namespace Lumina.Application.Fixtures.Common.DataAccess.Entities.UsersManagement
[ExcludeFromCodeCoverage]
public class UserEntityFixture
{
+ private readonly LibraryEntityFixture _libraryEntityFixture = new();
+
///
/// Creates a random valid .
///
@@ -27,8 +29,8 @@ public class UserEntityFixture
/// Optional Id to pin, or to generate a random one.
/// Optional user role association to pin when including it.
/// Optional user permission associations to pin when including them.
- /// Whether the user should include a user role association or not.
- /// Whether the user should include user permission associations or not.
+ /// Whether the user role association should be included, or forced to .
+ /// Whether the user permission associations should be included, or forced to an empty collection.
/// Optional collection of libraries to pin for the user, or to generate them based on .
/// The created user entity.
public UserEntity Create(
@@ -44,7 +46,7 @@ public class UserEntityFixture
{
Guid userId = id ?? Guid.NewGuid();
ICollection resolvedLibraries = libraries ?? (libraryCount > 0
- ? CreateLibraries(libraryCount, userId)
+ ? _libraryEntityFixture.CreateMany(libraryCount, userId)
: []);
return new Faker()
@@ -77,28 +79,4 @@ public class UserEntityFixture
{
return [.. Enumerable.Range(0, count).Select(_ => Create(libraryCount))];
}
-
- ///
- /// Creates a valid collection of user libraries.
- ///
- /// The number of user libraries to create.
- /// The unique identifier of the user for whom to create the libraries.
- /// A collection of .
- private static List CreateLibraries(int count, Guid userId)
- {
- return new Faker()
- .CustomInstantiator(f => new LibraryEntity
- {
- Id = Guid.NewGuid(),
- UserId = userId,
- Title = f.Commerce.ProductName(),
- LibraryType = f.PickRandom(),
- ContentLocations = [],
- CreatedOnUtc = f.Date.Past(),
- CreatedBy = userId,
- UpdatedOnUtc = null,
- UpdatedBy = null
- })
- .Generate(count);
- }
}
diff --git a/tests/Common/Lumina.Application.Fixtures/Common/Infrastructure/Models/DTO/Themes/ThemeManifestDtoFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/Infrastructure/Models/DTO/Themes/ThemeManifestDtoFixture.cs
index de55b6c4..2e912ee2 100644
--- a/tests/Common/Lumina.Application.Fixtures/Common/Infrastructure/Models/DTO/Themes/ThemeManifestDtoFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Common/Infrastructure/Models/DTO/Themes/ThemeManifestDtoFixture.cs
@@ -25,7 +25,7 @@ public class ThemeManifestDtoFixture
/// Optional author of the theme.
/// Optional version of the theme.
/// Optional preview image path of the theme, or when the theme has no preview.
- /// Whether to set , or when .
+ /// Whether the preview path should be included, or forced to .
/// Optional template mappings of the theme.
/// A configured instance.
public ThemeManifestDto Create(
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/AddBook/AddBookCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/AddBook/AddBookCommandFixture.cs
index a327cea3..86eabf20 100644
--- a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/AddBook/AddBookCommandFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/AddBook/AddBookCommandFixture.cs
@@ -1,15 +1,15 @@
#region ========================================================================= USING =====================================================================================
-using AutoFixture;
using Bogus;
using Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Commands.AddBook;
-using Lumina.Application.Fixtures.Common.Setup;
-using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary;
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
-using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
using System;
+using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
@@ -22,173 +22,59 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.WrittenContentLibrary.Bo
[ExcludeFromCodeCoverage]
public class AddBookCommandFixture
{
- private readonly Fixture _fixture = new();
- private readonly Random _random = new();
- private readonly Faker _faker = new();
-
- ///
- /// Initializes a new instance of the class.
- ///
- public AddBookCommandFixture()
- {
- _fixture.Customizations.Add(new DateOnlySpecimenBuilder());
- _fixture.Customizations.Add(new NullableDateOnlySpecimenBuilder());
- }
+ private readonly IsbnDtoFixture _isbnDtoFixture = new();
+ private readonly BookRatingDtoFixture _bookRatingDtoFixture = new();
+ private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
+ private readonly WrittenContentMetadataDtoFixture _writtenContentMetadataDtoFixture = new();
///
/// Creates a random valid command to add a book.
///
+ /// Optional. The Id of the media library the book belongs to.
+ /// Optional. The file system path of the book.
+ /// Optional. The written content metadata of the book.
+ /// Optional. The format of the book.
+ /// Optional. The edition of the book.
+ /// Optional. The volume or book number in the series.
+ /// Optional. The series the book is part of.
+ /// Optional. The ASIN of the book.
+ /// Optional. The Goodreads Id of the book.
+ /// Optional. The LCCN of the book.
+ /// Optional. The OCLC number of the book.
+ /// Optional. The Open Library Id of the book.
+ /// Optional. The LibraryThing Id of the book.
+ /// Optional. The Google Books Id of the book.
+ /// Optional. The Barnes and Noble Id of the book.
+ /// Optional. The Apple Books Id of the book.
+ /// Optional. The ISBNs of the book.
+ /// Optional. The contributors of the book.
+ /// Optional. The ratings of the book.
+ /// Whether the metadata should be included, or forced to .
+ /// Whether the properties that are not explicitly provided should be randomized, or forced to .
/// The created command to add a book.
- public AddBookCommand Create()
+ public AddBookCommand Create(
+ Guid? libraryId = null,
+ string? path = null,
+ WrittenContentMetadataDto? metadata = null,
+ BookFormat? format = null,
+ string? edition = null,
+ float? volumeNumber = null,
+ BookSeriesDto? series = null,
+ string? asin = null,
+ string? goodreadsId = null,
+ string? lccn = null,
+ string? oclcNumber = null,
+ string? openLibraryId = null,
+ string? libraryThingId = null,
+ string? googleBooksId = null,
+ string? barnesAndNobleId = null,
+ string? appleBooksId = null,
+ List? isbns = null,
+ List? contributors = null,
+ List? ratings = null,
+ bool includeMetadata = true,
+ bool includeOptionalProperties = true)
{
- int releaseYear = _random.Next(2000, 2010);
- int reReleaseYear = _random.Next(2010, 2020);
-
- ReleaseInfoDto releaseInfo = new Faker()
- .CustomInstantiator(f => new ReleaseInfoDto(
- default,
- default,
- default,
- default,
- default,
- default
- ))
- .RuleFor(x => x.OriginalReleaseDate, _faker.DateOnlyBetween(new DateOnly(releaseYear, 1, 1), new DateOnly(releaseYear, 12, 31)))
- .RuleFor(x => x.OriginalReleaseYear, releaseYear)
- .RuleFor(x => x.ReReleaseDate, _faker.DateOnlyBetween(new DateOnly(reReleaseYear, 1, 1), new DateOnly(reReleaseYear, 12, 31)))
- .RuleFor(x => x.ReReleaseYear, reReleaseYear)
- .RuleFor(x => x.ReleaseCountry, f => f.Random.String2(2))
- .RuleFor(x => x.ReleaseVersion, f => f.Random.String2(f.Random.Number(1, 50)))
- .Generate();
-
- Faker genre = new Faker()
- .CustomInstantiator(f => new GenreDto(
- default!
- ))
- .RuleFor(e => e.Name, f => f.Random.String2(f.Random.Number(1, 50)));
-
- Faker tag = new Faker()
- .CustomInstantiator(f => new TagDto(
- default!
- ))
- .RuleFor(e => e.Name, f => f.Random.String2(f.Random.Number(1, 50)));
-
- Faker mediaContributorRole = new Faker()
- .CustomInstantiator(f => new MediaContributorRoleDto(
- default!,
- default!
- ))
- .RuleFor(e => e.Name, f => f.Random.String2(f.Random.Number(1, 50)))
- .RuleFor(e => e.Category, f => f.PickRandom());
-
- Faker mediaContributorName = new Faker()
- .CustomInstantiator(f => new MediaContributorNameDto(
- default!,
- default!
- ))
- .RuleFor(e => e.DisplayName, f => f.Random.String2(f.Random.Number(1, 50)))
- .RuleFor(e => e.LegalName, f => f.Random.String2(f.Random.Number(1, 50)));
-
- Faker mediaContributor = new Faker()
- .CustomInstantiator(f => new MediaContributorDto(
- default!,
- default!
- ))
- .RuleFor(e => e.Name, mediaContributorName)
- .RuleFor(e => e.Role, mediaContributorRole);
-
- Faker rating = new Faker()
- .CustomInstantiator(f => new BookRatingDto(
- default,
- default,
- default,
- default
- ))
- .RuleFor(e => e.Value, _random.Next(1, 5))
- .RuleFor(e => e.MaxValue, 5)
- .RuleFor(e => e.Source, _fixture.Create())
- .RuleFor(e => e.VoteCount, _random.Next(1, 1000));
-
- Faker language = new Faker()
- .CustomInstantiator(f => new LanguageInfoDto(
- default!,
- default!,
- default
- ))
- .RuleFor(e => e.LanguageName, f => f.Random.String2(f.Random.Number(1, 50)))
- .RuleFor(e => e.LanguageCode, f => f.Random.String2(2))
- .RuleFor(e => e.NativeName, f => f.Random.String2(f.Random.Number(1, 50)));
-
- Faker originalLanguage = new Faker()
- .CustomInstantiator(f => new LanguageInfoDto(
- default!,
- default!,
- default
- ))
- .RuleFor(e => e.LanguageName, f => f.Random.String2(f.Random.Number(1, 50)))
- .RuleFor(e => e.LanguageCode, f => f.Random.String2(2))
- .RuleFor(e => e.NativeName, f => f.Random.String2(f.Random.Number(1, 50)));
-
- Faker metadata = new Faker()
- .CustomInstantiator(f => new WrittenContentMetadataDto(
- default!,
- default,
- default,
- default!,
- default!,
- default!,
- default,
- default,
- default,
- default
- ))
- .RuleFor(x => x.Title, f => f.Random.String2(f.Random.Number(1, 255)))
- .RuleFor(x => x.OriginalTitle, f => f.Random.String2(f.Random.Number(1, 255)))
- .RuleFor(x => x.Description, f => f.Random.String2(f.Random.Number(1, 2000)))
- .RuleFor(x => x.ReleaseInfo, releaseInfo)
- .RuleFor(p => p.Genres, f => genre.Generate(f.Random.Number(1, 5)))
- .RuleFor(x => x.Tags, f => tag.Generate(f.Random.Number(1, 5)))
- .RuleFor(x => x.Language, language)
- .RuleFor(x => x.OriginalLanguage, originalLanguage)
- .RuleFor(x => x.Publisher, f => f.Random.String2(f.Random.Number(1, 100)))
- .RuleFor(x => x.PageCount, _random.Next(100, 300));
-
- Faker isbn = new Faker()
- .CustomInstantiator(f => new IsbnDto(
- default!,
- default
- ))
- .RuleFor(i => i.Value, f =>
- {
- bool isIsbn13 = f.Random.Bool();
- if (isIsbn13)
- {
- string prefix = f.Random.Bool() ? "978" : "979";
- string group = f.Random.Number(0, 99999).ToString().PadLeft(5, '0');
- string publisher = f.Random.Number(0, 999999).ToString().PadLeft(6, '0');
- string title = f.Random.Number(0, 99).ToString().PadLeft(2, '0');
- string isbn = $"{prefix}{group[..1]}{publisher}{title}";
- int sum = 0;
- for (int i = 0; i < 12; i++)
- sum += (i % 2 == 0 ? 1 : 3) * int.Parse(isbn[i].ToString());
- int checkDigit = (10 - sum % 10) % 10;
- return $"{prefix}-{group[..1]}-{publisher}-{title}-{checkDigit}";
- }
- else
- {
- int[] digits = new int[9];
- for (int i = 0; i < 9; i++)
- digits[i] = f.Random.Number(0, 9);
- int sum = 0;
- for (int i = 0; i < 9; i++)
- sum += (10 - i) * digits[i];
- int checkDigit = (11 - sum % 11) % 11;
- string checkChar = checkDigit == 10 ? "X" : checkDigit.ToString();
- return $"{digits[0]}-{digits[1]}{digits[2]}-{digits[3]}{digits[4]}{digits[5]}{digits[6]}{digits[7]}{digits[8]}-{checkChar}";
- }
- })
- .RuleFor(i => i.Format, (f, i) => i.Value!.Length > 13 ? IsbnFormat.Isbn13 : IsbnFormat.Isbn10);
-
return new Faker()
.CustomInstantiator(f => new AddBookCommand(
default,
@@ -211,62 +97,101 @@ public class AddBookCommandFixture
default!,
default!
))
- .RuleFor(x => x.LibraryId, _fixture.Create())
- .RuleFor(x => x.Path, f => f.System.FilePath())
- .RuleFor(x => x.Metadata, metadata)
- .RuleFor(x => x.Format, _fixture.Create())
- .RuleFor(x => x.Edition, f => f.Random.String2(f.Random.Number(1, 50)))
- .RuleFor(x => x.VolumeNumber, _random.Next(1, 3))
- .RuleFor(x => x.ASIN, f => f.Random.String2(10))
- .RuleFor(x => x.GoodreadsId, _random.Next(100000, 500000).ToString())
- .RuleFor(x => x.LCCN, f =>
- {
- string letters = new([.. Enumerable.Range(0, f.Random.Number(0, 3)).Select(_ => f.Random.Char('a', 'z'))]);
- string digits = f.Random.String2(f.Random.Number(8, 10), "0123456789");
- return letters + digits;
- })
- .RuleFor(x => x.OCLCNumber, f =>
- {
- string[] prefixes = ["ocm", "ocn", "on", "(OCoLC)"];
- string prefix = f.Random.ArrayElement(prefixes);
- string number;
- switch (prefix)
- {
- case "ocm":
- number = f.Random.String2(8, "0123456789");
- break;
- case "ocn":
- number = f.Random.String2(f.Random.Number(9, 11), "0123456789");
- break;
- case "on":
- number = f.Random.String2(10, "0123456789");
- break;
- case "(OCoLC)":
- number = f.Random.String2(f.Random.Number(8, 10), "0123456789");
- break;
- default:
- number = f.Random.String2(f.Random.Number(8, 10), "0123456789");
- return number;
- }
- return prefix + number;
- })
- .RuleFor(x => x.OpenLibraryId, f =>
- {
- int firstDigit = f.Random.Number(1, 9);
- string remainingDigits = f.Random.String2(f.Random.Number(0, 6), "0123456789");
- char suffix = f.Random.ArrayElement(['A', 'M', 'W']);
- return $"OL{firstDigit}{remainingDigits}{suffix}";
- })
- .RuleFor(x => x.LibraryThingId, f => f.Random.String2(f.Random.Number(1, 50)))
- .RuleFor(x => x.GoogleBooksId, f =>
- {
- const string VALID_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
- return new string([.. Enumerable.Repeat(VALID_CHARS, 12).Select(s => s[f.Random.Number(VALID_CHARS.Length - 1)])]);
- })
- .RuleFor(x => x.BarnesAndNobleId, f => f.Random.String2(10, "0123456789"))
- .RuleFor(x => x.AppleBooksId, f => $"id{f.Random.Number(1, 999999)}")
- .RuleFor(p => p.ISBNs, f => isbn.Generate(f.Random.Number(1, 5)))
- .RuleFor(p => p.Ratings, f => rating.Generate(f.Random.Number(1, 5)))
- .RuleFor(x => x.Contributors, f => mediaContributor.Generate(f.Random.Number(1, 5)));
+ .RuleFor(x => x.LibraryId, libraryId ?? Guid.NewGuid())
+ .RuleFor(x => x.Path, f => path ?? f.System.FilePath())
+ .RuleFor(x => x.Metadata, includeMetadata ? (metadata ?? _writtenContentMetadataDtoFixture.Create()) : null)
+ .RuleFor(x => x.Format, f => format ?? (includeOptionalProperties ? f.PickRandom() : null))
+ .RuleFor(x => x.Edition, f => edition ?? (includeOptionalProperties ? f.Random.String2(f.Random.Number(1, 50)) : null))
+ .RuleFor(x => x.VolumeNumber, f => volumeNumber ?? (includeOptionalProperties ? (float?)f.Random.Number(1, 3) : null))
+ .RuleFor(x => x.Series, series)
+ .RuleFor(x => x.ASIN, f => asin ?? (includeOptionalProperties ? f.Random.String2(10) : null))
+ .RuleFor(x => x.GoodreadsId, f => goodreadsId ?? (includeOptionalProperties ? f.Random.Number(100000, 500000).ToString() : null))
+ .RuleFor(x => x.LCCN, f => lccn ?? (includeOptionalProperties ? CreateLccn(f) : null))
+ .RuleFor(x => x.OCLCNumber, f => oclcNumber ?? (includeOptionalProperties ? CreateOclcNumber(f) : null))
+ .RuleFor(x => x.OpenLibraryId, f => openLibraryId ?? (includeOptionalProperties ? CreateOpenLibraryId(f) : null))
+ .RuleFor(x => x.LibraryThingId, f => libraryThingId ?? (includeOptionalProperties ? f.Random.String2(f.Random.Number(1, 50)) : null))
+ .RuleFor(x => x.GoogleBooksId, f => googleBooksId ?? (includeOptionalProperties ? CreateGoogleBooksId(f) : null))
+ .RuleFor(x => x.BarnesAndNobleId, f => barnesAndNobleId ?? (includeOptionalProperties ? f.Random.String2(10, "0123456789") : null))
+ .RuleFor(x => x.AppleBooksId, f => appleBooksId ?? (includeOptionalProperties ? $"id{f.Random.Number(1, 999999)}" : null))
+ .RuleFor(p => p.ISBNs, f => isbns ?? (includeOptionalProperties ? [.. _isbnDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
+ .RuleFor(p => p.Ratings, f => ratings ?? (includeOptionalProperties ? [.. _bookRatingDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
+ .RuleFor(x => x.Contributors, f => contributors ?? (includeOptionalProperties ? [.. _mediaContributorDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
+ }
+
+ ///
+ /// Creates a list of .
+ ///
+ /// The number of elements to create.
+ /// The created list.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+
+ ///
+ /// Generates a random LCCN (Library of Congress Control Number).
+ ///
+ /// The faker used to generate the value.
+ /// The generated LCCN.
+ private static string CreateLccn(Faker faker)
+ {
+ string letters = new([.. Enumerable.Range(0, faker.Random.Number(0, 3)).Select(_ => faker.Random.Char('a', 'z'))]);
+ string digits = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
+ return letters + digits;
+ }
+
+ ///
+ /// Generates a random OCLC number (WorldCat identifier).
+ ///
+ /// The faker used to generate the value.
+ /// The generated OCLC number.
+ private static string CreateOclcNumber(Faker faker)
+ {
+ string[] prefixes = ["ocm", "ocn", "on", "(OCoLC)"];
+ string prefix = faker.Random.ArrayElement(prefixes);
+ string number;
+ switch (prefix)
+ {
+ case "ocm":
+ number = faker.Random.String2(8, "0123456789");
+ break;
+ case "ocn":
+ number = faker.Random.String2(faker.Random.Number(9, 11), "0123456789");
+ break;
+ case "on":
+ number = faker.Random.String2(10, "0123456789");
+ break;
+ case "(OCoLC)":
+ number = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
+ break;
+ default:
+ number = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
+ return number;
+ }
+ return prefix + number;
+ }
+
+ ///
+ /// Generates a random Open Library Id.
+ ///
+ /// The faker used to generate the value.
+ /// The generated Open Library Id.
+ private static string CreateOpenLibraryId(Faker faker)
+ {
+ int firstDigit = faker.Random.Number(1, 9);
+ string remainingDigits = faker.Random.String2(faker.Random.Number(0, 6), "0123456789");
+ char suffix = faker.Random.ArrayElement(['A', 'M', 'W']);
+ return $"OL{firstDigit}{remainingDigits}{suffix}";
+ }
+
+ ///
+ /// Generates a random Google Books Id.
+ ///
+ /// The faker used to generate the value.
+ /// The generated Google Books Id.
+ private static string CreateGoogleBooksId(Faker faker)
+ {
+ const string VALID_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
+ return new string([.. Enumerable.Repeat(VALID_CHARS, 12).Select(s => s[faker.Random.Number(VALID_CHARS.Length - 1)])]);
}
}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/UpdateBook/UpdateBookCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/UpdateBook/UpdateBookCommandFixture.cs
new file mode 100644
index 00000000..ffe50efa
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/UpdateBook/UpdateBookCommandFixture.cs
@@ -0,0 +1,194 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Commands.UpdateBook;
+using Lumina.Contracts.DTO.Common;
+using Lumina.Contracts.DTO.MediaContributors;
+using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary;
+using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Application.Fixtures.Core.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Commands.UpdateBook;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class UpdateBookCommandFixture
+{
+ private readonly IsbnDtoFixture _isbnDtoFixture = new();
+ private readonly BookRatingDtoFixture _bookRatingDtoFixture = new();
+ private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
+ private readonly WrittenContentMetadataDtoFixture _writtenContentMetadataDtoFixture = new();
+
+ ///
+ /// Creates a random valid command to update a book.
+ ///
+ /// Optional. The Id of the book to update.
+ /// Optional. The written content metadata of the book.
+ /// Optional. The format of the book.
+ /// Optional. The edition of the book.
+ /// Optional. The volume or book number in the series.
+ /// Optional. The series the book is part of.
+ /// Optional. The ASIN of the book.
+ /// Optional. The Goodreads Id of the book.
+ /// Optional. The LCCN of the book.
+ /// Optional. The OCLC number of the book.
+ /// Optional. The Open Library Id of the book.
+ /// Optional. The LibraryThing Id of the book.
+ /// Optional. The Google Books Id of the book.
+ /// Optional. The Barnes and Noble Id of the book.
+ /// Optional. The Apple Books Id of the book.
+ /// Optional. The ISBNs of the book.
+ /// Optional. The contributors of the book.
+ /// Optional. The ratings of the book.
+ /// Whether the metadata should be included, or forced to .
+ /// Whether the properties that are not explicitly provided should be randomized, or forced to .
+ /// The created command to update a book.
+ public UpdateBookCommand Create(
+ Guid? id = null,
+ WrittenContentMetadataDto? metadata = null,
+ BookFormat? format = null,
+ string? edition = null,
+ float? volumeNumber = null,
+ BookSeriesDto? series = null,
+ string? asin = null,
+ string? goodreadsId = null,
+ string? lccn = null,
+ string? oclcNumber = null,
+ string? openLibraryId = null,
+ string? libraryThingId = null,
+ string? googleBooksId = null,
+ string? barnesAndNobleId = null,
+ string? appleBooksId = null,
+ List? isbns = null,
+ List? contributors = null,
+ List? ratings = null,
+ bool includeMetadata = true,
+ bool includeOptionalProperties = true)
+ {
+ return new Faker()
+ .CustomInstantiator(f => new UpdateBookCommand(
+ default,
+ default!,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default!,
+ default!,
+ default!
+ ))
+ .RuleFor(x => x.Id, id ?? Guid.NewGuid())
+ .RuleFor(x => x.Metadata, includeMetadata ? (metadata ?? _writtenContentMetadataDtoFixture.Create()) : null)
+ .RuleFor(x => x.Format, f => format ?? (includeOptionalProperties ? f.PickRandom() : null))
+ .RuleFor(x => x.Edition, f => edition ?? (includeOptionalProperties ? f.Random.String2(f.Random.Number(1, 50)) : null))
+ .RuleFor(x => x.VolumeNumber, f => volumeNumber ?? (includeOptionalProperties ? (float?)f.Random.Number(1, 3) : null))
+ .RuleFor(x => x.Series, series)
+ .RuleFor(x => x.ASIN, f => asin ?? (includeOptionalProperties ? f.Random.String2(10) : null))
+ .RuleFor(x => x.GoodreadsId, f => goodreadsId ?? (includeOptionalProperties ? f.Random.Number(100000, 500000).ToString() : null))
+ .RuleFor(x => x.LCCN, f => lccn ?? (includeOptionalProperties ? CreateLccn(f) : null))
+ .RuleFor(x => x.OCLCNumber, f => oclcNumber ?? (includeOptionalProperties ? CreateOclcNumber(f) : null))
+ .RuleFor(x => x.OpenLibraryId, f => openLibraryId ?? (includeOptionalProperties ? CreateOpenLibraryId(f) : null))
+ .RuleFor(x => x.LibraryThingId, f => libraryThingId ?? (includeOptionalProperties ? f.Random.String2(f.Random.Number(1, 50)) : null))
+ .RuleFor(x => x.GoogleBooksId, f => googleBooksId ?? (includeOptionalProperties ? CreateGoogleBooksId(f) : null))
+ .RuleFor(x => x.BarnesAndNobleId, f => barnesAndNobleId ?? (includeOptionalProperties ? f.Random.String2(10, "0123456789") : null))
+ .RuleFor(x => x.AppleBooksId, f => appleBooksId ?? (includeOptionalProperties ? $"id{f.Random.Number(1, 999999)}" : null))
+ .RuleFor(p => p.ISBNs, f => isbns ?? (includeOptionalProperties ? [.. _isbnDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
+ .RuleFor(p => p.Ratings, f => ratings ?? (includeOptionalProperties ? [.. _bookRatingDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
+ .RuleFor(x => x.Contributors, f => contributors ?? (includeOptionalProperties ? [.. _mediaContributorDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
+ }
+
+ ///
+ /// Creates a list of .
+ ///
+ /// The number of elements to create.
+ /// The created list.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+
+ ///
+ /// Generates a random LCCN (Library of Congress Control Number).
+ ///
+ /// The faker used to generate the value.
+ /// The generated LCCN.
+ private static string CreateLccn(Faker faker)
+ {
+ string letters = new([.. Enumerable.Range(0, faker.Random.Number(0, 3)).Select(_ => faker.Random.Char('a', 'z'))]);
+ string digits = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
+ return letters + digits;
+ }
+
+ ///
+ /// Generates a random OCLC number (WorldCat identifier).
+ ///
+ /// The faker used to generate the value.
+ /// The generated OCLC number.
+ private static string CreateOclcNumber(Faker faker)
+ {
+ string[] prefixes = ["ocm", "ocn", "on", "(OCoLC)"];
+ string prefix = faker.Random.ArrayElement(prefixes);
+ string number;
+ switch (prefix)
+ {
+ case "ocm":
+ number = faker.Random.String2(8, "0123456789");
+ break;
+ case "ocn":
+ number = faker.Random.String2(faker.Random.Number(9, 11), "0123456789");
+ break;
+ case "on":
+ number = faker.Random.String2(10, "0123456789");
+ break;
+ case "(OCoLC)":
+ number = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
+ break;
+ default:
+ number = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
+ return number;
+ }
+ return prefix + number;
+ }
+
+ ///
+ /// Generates a random Open Library Id.
+ ///
+ /// The faker used to generate the value.
+ /// The generated Open Library Id.
+ private static string CreateOpenLibraryId(Faker faker)
+ {
+ int firstDigit = faker.Random.Number(1, 9);
+ string remainingDigits = faker.Random.String2(faker.Random.Number(0, 6), "0123456789");
+ char suffix = faker.Random.ArrayElement(['A', 'M', 'W']);
+ return $"OL{firstDigit}{remainingDigits}{suffix}";
+ }
+
+ ///
+ /// Generates a random Google Books Id.
+ ///
+ /// The faker used to generate the value.
+ /// The generated Google Books Id.
+ private static string CreateGoogleBooksId(Faker faker)
+ {
+ const string VALID_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
+ return new string([.. Enumerable.Repeat(VALID_CHARS, 12).Select(s => s[faker.Random.Number(VALID_CHARS.Length - 1)])]);
+ }
+}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/UpdateBookCover/UpdateBookCoverCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/UpdateBookCover/UpdateBookCoverCommandFixture.cs
new file mode 100644
index 00000000..c86d20d4
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/UpdateBookCover/UpdateBookCoverCommandFixture.cs
@@ -0,0 +1,59 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Commands.UpdateBookCover;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.IO;
+using System.Linq;
+using System.Text;
+#endregion
+
+namespace Lumina.Application.Fixtures.Core.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Commands.UpdateBookCover;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class UpdateBookCoverCommandFixture
+{
+ ///
+ /// Creates a random valid .
+ ///
+ /// Optional. The Id of the book whose cover is updated.
+ /// Optional. The stream of the uploaded cover image file.
+ /// Optional. The name of the uploaded cover image file.
+ /// Whether the cover stream should be included, or forced to .
+ /// The created .
+ public UpdateBookCoverCommand Create(
+ Guid? bookId = null,
+ Stream? cover = null,
+ string? fileName = null,
+ bool includeCover = true)
+ {
+ return new UpdateBookCoverCommand(
+ bookId ?? Guid.NewGuid(),
+ includeCover ? (cover ?? CreateCoverStream()) : null,
+ fileName ?? "cover.jpg"
+ );
+ }
+
+ ///
+ /// Creates a list of instances with randomized test data.
+ ///
+ /// Number of instances to create.
+ /// List of configured instances.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+
+ ///
+ /// Creates an in-memory stream carrying a minimal file payload.
+ ///
+ /// A non-empty in-memory stream.
+ private static Stream CreateCoverStream()
+ {
+ byte[] payload = Encoding.UTF8.GetBytes("fake cover payload");
+ return new MemoryStream(payload);
+ }
+}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBook/GetBookQueryFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBook/GetBookQueryFixture.cs
new file mode 100644
index 00000000..70635887
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBook/GetBookQueryFixture.cs
@@ -0,0 +1,37 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Queries.GetBook;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Application.Fixtures.Core.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Queries.GetBook;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class GetBookQueryFixture
+{
+ ///
+ /// Creates a random valid .
+ ///
+ /// Optional. The Id of the book to get.
+ /// The created .
+ public GetBookQuery Create(
+ Guid? id = null)
+ {
+ return new GetBookQuery(id ?? Guid.NewGuid());
+ }
+
+ ///
+ /// Creates a list of instances with randomized test data.
+ ///
+ /// Number of instances to create.
+ /// List of configured instances.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooks/GetBooksQueryFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooks/GetBooksQueryFixture.cs
index 1c105e6c..c57cfff0 100644
--- a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooks/GetBooksQueryFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooks/GetBooksQueryFixture.cs
@@ -28,7 +28,7 @@ public class GetBooksQueryFixture
/// Optional. The search term used to filter results.
/// Optional. The name of the field by which to sort the results.
/// Optional. The direction in which to sort the results.
- /// Whether the query should include pagination data or not.
+ /// Whether the pagination data should be included, or forced to .
/// The created query to get books.
public GetBooksQuery Create(
Guid? libraryId = null,
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooksLite/GetBooksLiteQueryFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooksLite/GetBooksLiteQueryFixture.cs
index 5949d253..1f2fce3c 100644
--- a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooksLite/GetBooksLiteQueryFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooksLite/GetBooksLiteQueryFixture.cs
@@ -30,7 +30,7 @@ public class GetBooksLiteQueryFixture
/// Optional. Whether the leading "The " prefix of a title should be ignored when computing the alpha key, or not.
/// Optional. The name of the field by which to sort the results.
/// Optional. The direction in which to sort the results.
- /// Whether the query should include pagination data or not.
+ /// Whether the pagination data should be included, or forced to .
/// The created query to get the lightweight details of books.
public GetBooksLiteQuery Create(
Guid? libraryId = null,
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/Scheduling/Queries/GetScheduledJobHistory/GetScheduledJobHistoryQueryFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/Scheduling/Queries/GetScheduledJobHistory/GetScheduledJobHistoryQueryFixture.cs
index 30778a36..bd8736b2 100644
--- a/tests/Common/Lumina.Application.Fixtures/Core/Scheduling/Queries/GetScheduledJobHistory/GetScheduledJobHistoryQueryFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Core/Scheduling/Queries/GetScheduledJobHistory/GetScheduledJobHistoryQueryFixture.cs
@@ -20,8 +20,8 @@ public class GetScheduledJobHistoryQueryFixture
///
/// Optional. The inclusive lower bound of the requested interval.
/// Optional. The inclusive upper bound of the requested interval.
- /// Whether to include the lower bound in the query. When false, the lower bound is left unset.
- /// Whether to include the upper bound in the query. When false, the upper bound is left unset.
+ /// Whether the lower bound should be included, or forced to .
+ /// Whether the upper bound should be included, or forced to .
/// The created query.
public GetScheduledJobHistoryQuery Create(
DateTime? from = null,
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryFixture.cs
index 35832e33..30a02076 100644
--- a/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryFixture.cs
+++ b/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryFixture.cs
@@ -19,7 +19,7 @@ public class LoginUserQueryFixture
///
/// Optional. The username.
/// Optional. The password.
- /// Whether to include a TOTP code in the query.
+ /// Whether the TOTP code should be included, or forced to .
/// The created query.
public LoginUserQuery Create(
string? username = null,
diff --git a/tests/Common/Lumina.Application.Fixtures/Lumina.Application.Fixtures.csproj b/tests/Common/Lumina.Application.Fixtures/Lumina.Application.Fixtures.csproj
index 28395911..595cbfba 100644
--- a/tests/Common/Lumina.Application.Fixtures/Lumina.Application.Fixtures.csproj
+++ b/tests/Common/Lumina.Application.Fixtures/Lumina.Application.Fixtures.csproj
@@ -20,5 +20,6 @@
+
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/LanguageInfoDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/LanguageInfoDtoFixture.cs
index e67f358d..a07ef2d2 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/LanguageInfoDtoFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/LanguageInfoDtoFixture.cs
@@ -22,16 +22,22 @@ public class LanguageInfoDtoFixture
/// Optional. The ISO code of the language.
/// Optional. The name of the language in English.
/// Optional. The native name of the language.
+ /// Whether the language code should be included, or forced to .
+ /// Whether the language name should be included, or forced to .
+ /// Whether the native name should be included, or forced to .
/// The created .
public LanguageInfoDto Create(
- string? languageCode = null,
- string? languageName = null,
- string? nativeName = null)
+ string? languageCode = null,
+ string? languageName = null,
+ string? nativeName = null,
+ bool includeLanguageCode = true,
+ bool includeLanguageName = true,
+ bool includeNativeName = true)
{
return new LanguageInfoDto(
- languageCode ?? _faker.Random.String2(2),
- languageName ?? _faker.Lorem.Word(),
- nativeName ?? _faker.Lorem.Word());
+ includeLanguageCode ? (languageCode ?? _faker.Random.String2(2)) : null,
+ includeLanguageName ? (languageName ?? _faker.Lorem.Word()) : null,
+ includeNativeName ? (nativeName ?? _faker.Lorem.Word()) : null);
}
///
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/ReleaseInfoDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/ReleaseInfoDtoFixture.cs
index 6de91897..656735e2 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/ReleaseInfoDtoFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/ReleaseInfoDtoFixture.cs
@@ -15,7 +15,7 @@ namespace Lumina.Contracts.Fixtures.Core.DTO.Common;
public class ReleaseInfoDtoFixture
{
///
- /// Creates an , preserving the values that are not provided as .
+ /// Creates a , preserving the values that are not provided as .
///
/// Optional. The original release date of the content.
/// Optional. The original release year of the content.
@@ -23,6 +23,12 @@ public class ReleaseInfoDtoFixture
/// Optional. The re-release year of the content.
/// Optional. The country where the content was released.
/// Optional. The version or edition of the content's release.
+ /// Whether the original release date should be included, or forced to .
+ /// Whether the original release year should be included, or forced to .
+ /// Whether the re-release date should be included, or forced to .
+ /// Whether the re-release year should be included, or forced to .
+ /// Whether the release country should be included, or forced to .
+ /// Whether the release version should be included, or forced to .
/// The created .
public ReleaseInfoDto Create(
DateOnly? originalReleaseDate = null,
@@ -30,15 +36,21 @@ public class ReleaseInfoDtoFixture
DateOnly? reReleaseDate = null,
int? reReleaseYear = null,
string? releaseCountry = null,
- string? releaseVersion = null)
+ string? releaseVersion = null,
+ bool includeOriginalReleaseDate = true,
+ bool includeOriginalReleaseYear = true,
+ bool includeReReleaseDate = true,
+ bool includeReReleaseYear = true,
+ bool includeReleaseCountry = true,
+ bool includeReleaseVersion = true)
{
return new ReleaseInfoDto(
- originalReleaseDate,
- originalReleaseYear,
- reReleaseDate,
- reReleaseYear,
- releaseCountry,
- releaseVersion);
+ includeOriginalReleaseDate ? originalReleaseDate : null,
+ includeOriginalReleaseYear ? originalReleaseYear : null,
+ includeReReleaseDate ? reReleaseDate : null,
+ includeReReleaseYear ? reReleaseYear : null,
+ includeReleaseCountry ? releaseCountry : null,
+ includeReleaseVersion ? releaseVersion : null);
}
///
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaContributors/MediaContributorDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaContributors/MediaContributorDtoFixture.cs
index 10440fca..e0f65c2c 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaContributors/MediaContributorDtoFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaContributors/MediaContributorDtoFixture.cs
@@ -23,15 +23,33 @@ public class MediaContributorDtoFixture
/// Optional. The display name of the media contributor.
/// Optional. The name of the role assigned to the media contributor.
/// Optional. The category of the role.
+ /// Optional. The legal name of the media contributor.
+ /// Whether the name should be included, or forced to .
+ /// Whether the display name should be included, or forced to .
+ /// Whether the legal name should be included, or forced to .
+ /// Whether the role should be included, or forced to .
+ /// Whether the role name should be included, or forced to .
+ /// Whether the role category should be included, or forced to .
/// The created .
public MediaContributorDto Create(
string? displayName = null,
string? roleName = null,
- MediaContributorRoleCategory? roleCategory = null)
+ MediaContributorRoleCategory? roleCategory = null,
+ string? legalName = null,
+ bool includeName = true,
+ bool includeDisplayName = true,
+ bool includeLegalName = true,
+ bool includeRole = true,
+ bool includeRoleName = true,
+ bool includeRoleCategory = true)
{
return new MediaContributorDto(
- Name: new MediaContributorNameDto(DisplayName: displayName ?? _faker.Name.FullName(), LegalName: null),
- Role: new MediaContributorRoleDto(Name: roleName ?? _faker.Commerce.Department(), Category: roleCategory ?? _faker.PickRandom()));
+ Name: includeName ? new MediaContributorNameDto(
+ DisplayName: includeDisplayName ? displayName ?? _faker.Name.FullName() : null,
+ LegalName: includeLegalName ? legalName : null) : null,
+ Role: includeRole ? new MediaContributorRoleDto(
+ Name: includeRoleName ? roleName ?? _faker.Commerce.Department() : null,
+ Category: includeRoleCategory ? roleCategory ?? _faker.PickRandom() : null) : null);
}
///
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/BookLibrary/BookMetadataDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/BookLibrary/BookMetadataDtoFixture.cs
index 498147dc..d8cff480 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/BookLibrary/BookMetadataDtoFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/BookLibrary/BookMetadataDtoFixture.cs
@@ -3,6 +3,7 @@ using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
+using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
using System;
using System.Collections.Generic;
@@ -19,6 +20,10 @@ namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.
public class BookMetadataDtoFixture
{
private readonly Faker _faker = new();
+ private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
+ private readonly GenreDtoFixture _genreDtoFixture = new();
+ private readonly TagDtoFixture _tagDtoFixture = new();
+ private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
///
/// Creates a random valid .
@@ -51,7 +56,7 @@ public class BookMetadataDtoFixture
/// Optional. The ratings of the book.
/// Optional. The path of the cover image of the book.
/// Whether the title should be included, or forced to .
- /// Whether the properties that are not explicitly provided should be randomized, or left .
+ /// Whether the properties that are not explicitly provided should be randomized, or forced to .
/// The created .
public BookMetadataDto Create(
string? title = null,
@@ -89,10 +94,13 @@ public class BookMetadataDtoFixture
includeTitle ? title ?? (includeOptionalProperties ? _faker.Lorem.Sentence(3) : null) : null,
originalTitle,
description,
- releaseInfo ?? (includeOptionalProperties ? new ReleaseInfoDto(new DateOnly(releaseYear, 1, 1), releaseYear, null, null, _faker.Address.CountryCode(), null) : null),
- genres ?? (includeOptionalProperties ? [new GenreDto(_faker.Lorem.Word())] : null),
- tags ?? (includeOptionalProperties ? [new TagDto(_faker.Lorem.Word())] : null),
- language ?? (includeOptionalProperties ? new LanguageInfoDto("en", "English", "English") : null),
+ releaseInfo ?? (includeOptionalProperties ? _releaseInfoDtoFixture.Create(
+ originalReleaseDate: new DateOnly(releaseYear, 1, 1),
+ originalReleaseYear: releaseYear,
+ releaseCountry: _faker.Address.CountryCode()) : null),
+ genres ?? (includeOptionalProperties ? [_genreDtoFixture.Create()] : null),
+ tags ?? (includeOptionalProperties ? [_tagDtoFixture.Create()] : null),
+ language ?? (includeOptionalProperties ? _languageInfoDtoFixture.Create() : null),
originalLanguage,
publisher,
pageCount,
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/BookLibrary/BookRatingDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/BookLibrary/BookRatingDtoFixture.cs
index 4b6c7cec..cd594450 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/BookLibrary/BookRatingDtoFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/BookLibrary/BookRatingDtoFixture.cs
@@ -26,7 +26,7 @@ public class BookRatingDtoFixture
/// Optional. The maximum possible rating value.
/// Optional. The rating source.
/// Optional. The number of votes.
- /// Whether the optional source and vote count should be included.
+ /// Whether the optional source and vote count should be randomized, or forced to .
/// The created .
public BookRatingDto Create(
decimal? value = null,
@@ -38,8 +38,8 @@ public class BookRatingDtoFixture
return new BookRatingDto(
value ?? _random.Next(1, 5),
maxValue ?? 5,
- includeOptionalProperties ? (source ?? _fixture.Create()) : null,
- includeOptionalProperties ? (voteCount ?? _random.Next(1, 1000)) : null
+ source ?? (includeOptionalProperties ? _fixture.Create() : null),
+ voteCount ?? (includeOptionalProperties ? _random.Next(1, 1000) : null)
);
}
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/BookLibrary/IsbnDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/BookLibrary/IsbnDtoFixture.cs
index 2b3fd680..33184bca 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/BookLibrary/IsbnDtoFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/BookLibrary/IsbnDtoFixture.cs
@@ -28,7 +28,7 @@ public class IsbnDtoFixture
string resolvedValue = value ?? (format == IsbnFormat.Isbn10 ? GenerateValidIsbn10() : GenerateValidIsbn13());
return new IsbnDto(
resolvedValue,
- format
+ format ?? (resolvedValue.Length > 13 ? IsbnFormat.Isbn13 : IsbnFormat.Isbn10)
);
}
@@ -42,6 +42,10 @@ public class IsbnDtoFixture
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
+ ///
+ /// Generates a valid ISBN-10 with the correct checksum.
+ ///
+ /// A valid ISBN-10 value.
private string GenerateValidIsbn10()
{
int[] digits = new int[9];
@@ -58,6 +62,10 @@ public class IsbnDtoFixture
return $"{digits[0]}-{digits[1]}{digits[2]}-{digits[3]}{digits[4]}{digits[5]}{digits[6]}{digits[7]}{digits[8]}-{checkChar}";
}
+ ///
+ /// Generates a valid ISBN-13 with the correct checksum.
+ ///
+ /// A valid ISBN-13 value.
private string GenerateValidIsbn13()
{
string prefix = _random.Next(2) == 0 ? "978" : "979";
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/WrittenContentMetadataDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/WrittenContentMetadataDtoFixture.cs
index 6775e3d6..c70b877d 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/WrittenContentMetadataDtoFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/WrittenContentLibrary/WrittenContentMetadataDtoFixture.cs
@@ -1,6 +1,9 @@
#region ========================================================================= USING =====================================================================================
+using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary;
+using Lumina.Contracts.Fixtures.Core.DTO.Common;
+using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
@@ -14,8 +17,14 @@ namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary;
[ExcludeFromCodeCoverage]
public class WrittenContentMetadataDtoFixture
{
+ private readonly Faker _faker = new();
+ private readonly Random _random = new();
+ private readonly GenreDtoFixture _genreDtoFixture = new();
+ private readonly TagDtoFixture _tagDtoFixture = new();
+ private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
+
///
- /// Creates a with the requested values, leaving unspecified properties as .
+ /// Creates a random valid .
///
/// Optional. The title of the written content.
/// Optional. The original title of the written content.
@@ -27,6 +36,16 @@ public class WrittenContentMetadataDtoFixture
/// Optional. The original language of the written content.
/// Optional. The name of the publisher of the written content.
/// Optional. The number of pages in the written content.
+ /// Whether the title should be included, or forced to .
+ /// Whether the original title should be included, or forced to .
+ /// Whether the description should be included, or forced to .
+ /// Whether the release information should be included, or forced to .
+ /// Whether the genres should be included, or forced to .
+ /// Whether the tags should be included, or forced to .
+ /// Whether the language should be included, or forced to .
+ /// Whether the original language should be included, or forced to .
+ /// Whether the publisher should be included, or forced to .
+ /// Whether the page count should be included, or forced to .
/// The created .
public WrittenContentMetadataDto Create(
string? title = null,
@@ -38,19 +57,29 @@ public class WrittenContentMetadataDtoFixture
LanguageInfoDto? language = null,
LanguageInfoDto? originalLanguage = null,
string? publisher = null,
- int? pageCount = null)
+ int? pageCount = null,
+ bool includeTitle = true,
+ bool includeOriginalTitle = true,
+ bool includeDescription = true,
+ bool includeReleaseInfo = true,
+ bool includeGenres = true,
+ bool includeTags = true,
+ bool includeLanguage = true,
+ bool includeOriginalLanguage = true,
+ bool includePublisher = true,
+ bool includePageCount = true)
{
return new WrittenContentMetadataDto(
- title,
- originalTitle,
- description,
- releaseInfo,
- genres,
- tags,
- language,
- originalLanguage,
- publisher,
- pageCount);
+ includeTitle ? (title ?? _faker.Commerce.ProductName()) : null,
+ includeOriginalTitle ? (originalTitle ?? _faker.Commerce.ProductName()) : null,
+ includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null,
+ includeReleaseInfo ? (releaseInfo ?? CreateReleaseInfo()) : null,
+ includeGenres ? (genres ?? [_genreDtoFixture.Create(), _genreDtoFixture.Create()]) : null,
+ includeTags ? (tags ?? [_tagDtoFixture.Create(), _tagDtoFixture.Create()]) : null,
+ includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null,
+ includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null,
+ includePublisher ? (publisher ?? _faker.Company.CompanyName()) : null,
+ includePageCount ? (pageCount ?? _faker.Random.Int(1, 1000)) : null);
}
///
@@ -62,4 +91,21 @@ public class WrittenContentMetadataDtoFixture
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
+
+ ///
+ /// Creates a random valid with consistent dates and years.
+ ///
+ /// The created .
+ private ReleaseInfoDto CreateReleaseInfo()
+ {
+ int originalReleaseYear = _random.Next(1900, 2026);
+ int reReleaseYear = _random.Next(originalReleaseYear, 2026);
+ return new ReleaseInfoDto(
+ new DateOnly(originalReleaseYear, 1, 1),
+ originalReleaseYear,
+ new DateOnly(reReleaseYear, 1, 1),
+ reReleaseYear,
+ _faker.Address.CountryCode(),
+ _faker.Random.String2(_faker.Random.Number(1, 50)));
+ }
}
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Directories/GetDirectoriesRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Directories/GetDirectoriesRequestFixture.cs
index 45ac2a64..683ac580 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Directories/GetDirectoriesRequestFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Directories/GetDirectoriesRequestFixture.cs
@@ -20,9 +20,11 @@ public class GetDirectoriesRequestFixture
/// Creates a with default or random values.
///
/// Optional. The file system path for which to get the directories.
- /// Optional. Whether to include hidden file system elements.
+ /// Whether to include hidden file system elements or not.
/// The created .
- public GetDirectoriesRequest Create(string? path = null, bool? includeHiddenElements = null)
+ public GetDirectoriesRequest Create(
+ string? path = null,
+ bool? includeHiddenElements = null)
{
return new GetDirectoriesRequest(
Path: path ?? _faker.System.FilePath(),
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Files/GetFilesRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Files/GetFilesRequestFixture.cs
index 27b8e0ff..aa139a6d 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Files/GetFilesRequestFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Files/GetFilesRequestFixture.cs
@@ -20,9 +20,11 @@ public class GetFilesRequestFixture
/// Creates a with default or random values.
///
/// Optional. The file system path for which to get the files.
- /// Optional. Whether to include hidden file system elements.
+ /// Whether to include hidden file system elements or not.
/// The created .
- public GetFilesRequest Create(string? path = null, bool? includeHiddenElements = null)
+ public GetFilesRequest Create(
+ string? path = null,
+ bool? includeHiddenElements = null)
{
return new GetFilesRequest(
Path: path ?? _faker.System.FilePath(),
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Files/GetTreeFilesRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Files/GetTreeFilesRequestFixture.cs
index a6892778..6f5c67d2 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Files/GetTreeFilesRequestFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Files/GetTreeFilesRequestFixture.cs
@@ -20,9 +20,11 @@ public class GetTreeFilesRequestFixture
/// Creates a with default or random values.
///
/// Optional. The file system path for which to get the tree files.
- /// Optional. Whether to include hidden file system elements.
+ /// Whether to include hidden file system elements or not.
/// The created .
- public GetTreeFilesRequest Create(string? path = null, bool? includeHiddenElements = null)
+ public GetTreeFilesRequest Create(
+ string? path = null,
+ bool? includeHiddenElements = null)
{
return new GetTreeFilesRequest(
Path: path ?? _faker.System.FilePath(),
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Path/CheckPathExistsRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Path/CheckPathExistsRequestFixture.cs
index 438e7065..41682d4b 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Path/CheckPathExistsRequestFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/FileSystemManagement/Path/CheckPathExistsRequestFixture.cs
@@ -20,9 +20,11 @@ public class CheckPathExistsRequestFixture
/// Creates a with default or random values.
///
/// Optional. The path to check.
- /// Optional. Whether to include hidden elements.
+ /// Whether to include hidden file system elements or not.
/// The created .
- public CheckPathExistsRequest Create(string? path = null, bool? includeHiddenElements = null)
+ public CheckPathExistsRequest Create(
+ string? path = null,
+ bool? includeHiddenElements = null)
{
return new CheckPathExistsRequest(
Path: path ?? _faker.System.FilePath(),
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/AddBookRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/AddBookRequestFixture.cs
index cdc04793..54b7f120 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/AddBookRequestFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/AddBookRequestFixture.cs
@@ -1,14 +1,13 @@
#region ========================================================================= USING =====================================================================================
-using AutoFixture;
using Bogus;
-using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary;
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
-using Lumina.Contracts.Fixtures.Common.Setup;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
-using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -23,18 +22,10 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLib
[ExcludeFromCodeCoverage]
public class AddBookRequestFixture
{
- private readonly Fixture _fixture = new();
- private readonly Random _random = new();
- private readonly Faker _faker = new();
-
- ///
- /// Initializes a new instance of the class.
- ///
- public AddBookRequestFixture()
- {
- _fixture.Customizations.Add(new DateOnlySpecimenBuilder());
- _fixture.Customizations.Add(new NullableDateOnlySpecimenBuilder());
- }
+ private readonly IsbnDtoFixture _isbnDtoFixture = new();
+ private readonly BookRatingDtoFixture _bookRatingDtoFixture = new();
+ private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
+ private readonly WrittenContentMetadataDtoFixture _writtenContentMetadataDtoFixture = new();
///
/// Creates a random valid request to add a book.
@@ -58,7 +49,7 @@ public class AddBookRequestFixture
/// Optional. The ISBNs of the book.
/// Optional. The contributors of the book.
/// Optional. The ratings of the book.
- /// Whether the properties that are not explicitly provided should be randomized, or left .
+ /// Whether the properties that are not explicitly provided should be randomized, or forced to .
/// The created request to add a book.
public AddBookRequest Create(
Guid? libraryId = null,
@@ -82,154 +73,6 @@ public class AddBookRequestFixture
List? ratings = null,
bool includeOptionalProperties = true)
{
- int releaseYear = _random.Next(2000, 2010);
- int reReleaseYear = _random.Next(2010, 2020);
-
- ReleaseInfoDto releaseInfo = new Faker()
- .CustomInstantiator(f => new ReleaseInfoDto(
- default,
- default,
- default,
- default,
- default,
- default
- ))
- .RuleFor(x => x.OriginalReleaseDate, _faker.DateOnlyBetween(new DateOnly(releaseYear, 1, 1), new DateOnly(releaseYear, 12, 31)))
- .RuleFor(x => x.OriginalReleaseYear, releaseYear)
- .RuleFor(x => x.ReReleaseDate, _faker.DateOnlyBetween(new DateOnly(reReleaseYear, 1, 1), new DateOnly(reReleaseYear, 12, 31)))
- .RuleFor(x => x.ReReleaseYear, reReleaseYear)
- .RuleFor(x => x.ReleaseCountry, f => f.Random.String2(2))
- .RuleFor(x => x.ReleaseVersion, f => f.Random.String2(f.Random.Number(1, 50)))
- .Generate();
-
- Faker genre = new Faker()
- .CustomInstantiator(f => new GenreDto(
- default!
- ))
- .RuleFor(e => e.Name, f => f.Random.String2(f.Random.Number(1, 50)));
-
- Faker tag = new Faker()
- .CustomInstantiator(f => new TagDto(
- default!
- ))
- .RuleFor(e => e.Name, f => f.Random.String2(f.Random.Number(1, 50)));
-
- Faker mediaContributorRole = new Faker()
- .CustomInstantiator(f => new MediaContributorRoleDto(
- default!,
- default!
- ))
- .RuleFor(e => e.Name, f => f.Random.String2(f.Random.Number(1, 50)))
- .RuleFor(e => e.Category, f => f.PickRandom());
-
- Faker mediaContributorName = new Faker()
- .CustomInstantiator(f => new MediaContributorNameDto(
- default!,
- default!
- ))
- .RuleFor(e => e.DisplayName, f => f.Random.String2(f.Random.Number(1, 50)))
- .RuleFor(e => e.LegalName, f => f.Random.String2(f.Random.Number(1, 50)));
-
- Faker mediaContributor = new Faker()
- .CustomInstantiator(f => new MediaContributorDto(
- default!,
- default!
- ))
- .RuleFor(e => e.Name, mediaContributorName)
- .RuleFor(e => e.Role, mediaContributorRole);
-
- Faker rating = new Faker()
- .CustomInstantiator(f => new BookRatingDto(
- default,
- default,
- default,
- default
- ))
- .RuleFor(e => e.Value, _random.Next(1, 5))
- .RuleFor(e => e.MaxValue, 5)
- .RuleFor(e => e.Source, _fixture.Create())
- .RuleFor(e => e.VoteCount, _random.Next(1, 1000));
-
- Faker language = new Faker()
- .CustomInstantiator(f => new LanguageInfoDto(
- default!,
- default!,
- default
- ))
- .RuleFor(e => e.LanguageName, f => f.Random.String2(f.Random.Number(1, 50)))
- .RuleFor(e => e.LanguageCode, f => f.Random.String2(2))
- .RuleFor(e => e.NativeName, f => f.Random.String2(f.Random.Number(1, 50)));
-
- Faker originalLanguage = new Faker()
- .CustomInstantiator(f => new LanguageInfoDto(
- default!,
- default!,
- default
- ))
- .RuleFor(e => e.LanguageName, f => f.Random.String2(f.Random.Number(1, 50)))
- .RuleFor(e => e.LanguageCode, f => f.Random.String2(2))
- .RuleFor(e => e.NativeName, f => f.Random.String2(f.Random.Number(1, 50)));
-
- Faker metadataFaker = new Faker()
- .CustomInstantiator(f => new WrittenContentMetadataDto(
- default!,
- default,
- default,
- default!,
- default!,
- default!,
- default,
- default,
- default,
- default
- ))
- .RuleFor(x => x.Title, f => f.Random.String2(f.Random.Number(1, 255)))
- .RuleFor(x => x.OriginalTitle, f => f.Random.String2(f.Random.Number(1, 255)))
- .RuleFor(x => x.Description, f => f.Random.String2(f.Random.Number(1, 2000)))
- .RuleFor(x => x.ReleaseInfo, releaseInfo)
- .RuleFor(p => p.Genres, f => genre.Generate(f.Random.Number(1, 5)))
- .RuleFor(x => x.Tags, f => tag.Generate(f.Random.Number(1, 5)))
- .RuleFor(x => x.Language, language)
- .RuleFor(x => x.OriginalLanguage, originalLanguage)
- .RuleFor(x => x.Publisher, f => f.Random.String2(f.Random.Number(1, 100)))
- .RuleFor(x => x.PageCount, _random.Next(100, 300));
-
- Faker isbn = new Faker()
- .CustomInstantiator(f => new IsbnDto(
- default!,
- default
- ))
- .RuleFor(i => i.Value, f =>
- {
- bool isIsbn13 = f.Random.Bool();
- if (isIsbn13)
- {
- string prefix = f.Random.Bool() ? "978" : "979";
- string group = f.Random.Number(0, 99999).ToString().PadLeft(5, '0');
- string publisher = f.Random.Number(0, 999999).ToString().PadLeft(6, '0');
- string title = f.Random.Number(0, 99).ToString().PadLeft(2, '0');
- string isbn = $"{prefix}{group[..1]}{publisher}{title}";
- int sum = 0;
- for (int i = 0; i < 12; i++)
- sum += (i % 2 == 0 ? 1 : 3) * int.Parse(isbn[i].ToString());
- int checkDigit = (10 - sum % 10) % 10;
- return $"{prefix}-{group[..1]}-{publisher}-{title}-{checkDigit}";
- }
- else
- {
- int[] digits = new int[9];
- for (int i = 0; i < 9; i++)
- digits[i] = f.Random.Number(0, 9);
- int sum = 0;
- for (int i = 0; i < 9; i++)
- sum += (10 - i) * digits[i];
- int checkDigit = (11 - sum % 11) % 11;
- string checkChar = checkDigit == 10 ? "X" : checkDigit.ToString();
- return $"{digits[0]}-{digits[1]}{digits[2]}-{digits[3]}{digits[4]}{digits[5]}{digits[6]}{digits[7]}{digits[8]}-{checkChar}";
- }
- })
- .RuleFor(i => i.Format, (f, i) => i.Value!.Length > 13 ? IsbnFormat.Isbn13 : IsbnFormat.Isbn10);
-
return new Faker()
.CustomInstantiator(f => new AddBookRequest(
default,
@@ -246,21 +89,21 @@ public class AddBookRequestFixture
default,
default,
default,
- default!,
+ default,
default!,
default!,
default!,
default!
))
- .RuleFor(x => x.LibraryId, libraryId ?? _fixture.Create())
+ .RuleFor(x => x.LibraryId, libraryId ?? Guid.NewGuid())
.RuleFor(x => x.Path, f => path ?? f.System.FilePath())
- .RuleFor(x => x.Metadata, metadata ?? metadataFaker)
- .RuleFor(x => x.Format, format ?? (includeOptionalProperties ? _fixture.Create() : null))
+ .RuleFor(x => x.Metadata, metadata ?? _writtenContentMetadataDtoFixture.Create())
+ .RuleFor(x => x.Format, f => format ?? (includeOptionalProperties ? f.PickRandom() : null))
.RuleFor(x => x.Edition, f => edition ?? (includeOptionalProperties ? f.Random.String2(f.Random.Number(1, 50)) : null))
- .RuleFor(x => x.VolumeNumber, volumeNumber ?? (includeOptionalProperties ? (float?)_random.Next(1, 3) : null))
+ .RuleFor(x => x.VolumeNumber, f => volumeNumber ?? (includeOptionalProperties ? (float?)f.Random.Number(1, 3) : null))
.RuleFor(x => x.Series, series)
.RuleFor(x => x.ASIN, f => asin ?? (includeOptionalProperties ? f.Random.String2(10) : null))
- .RuleFor(x => x.GoodreadsId, goodreadsId ?? (includeOptionalProperties ? _random.Next(100000, 500000).ToString() : null))
+ .RuleFor(x => x.GoodreadsId, f => goodreadsId ?? (includeOptionalProperties ? f.Random.Number(100000, 500000).ToString() : null))
.RuleFor(x => x.LCCN, f => lccn ?? (includeOptionalProperties ? CreateLccn(f) : null))
.RuleFor(x => x.OCLCNumber, f => oclcNumber ?? (includeOptionalProperties ? CreateOclcNumber(f) : null))
.RuleFor(x => x.OpenLibraryId, f => openLibraryId ?? (includeOptionalProperties ? CreateOpenLibraryId(f) : null))
@@ -268,9 +111,9 @@ public class AddBookRequestFixture
.RuleFor(x => x.GoogleBooksId, f => googleBooksId ?? (includeOptionalProperties ? CreateGoogleBooksId(f) : null))
.RuleFor(x => x.BarnesAndNobleId, f => barnesAndNobleId ?? (includeOptionalProperties ? f.Random.String2(10, "0123456789") : null))
.RuleFor(x => x.AppleBooksId, f => appleBooksId ?? (includeOptionalProperties ? $"id{f.Random.Number(1, 999999)}" : null))
- .RuleFor(p => p.ISBNs, f => isbns ?? (includeOptionalProperties ? isbn.Generate(f.Random.Number(1, 5)) : null))
- .RuleFor(p => p.Ratings, f => ratings ?? (includeOptionalProperties ? rating.Generate(f.Random.Number(1, 5)) : null))
- .RuleFor(x => x.Contributors, f => contributors ?? (includeOptionalProperties ? mediaContributor.Generate(f.Random.Number(1, 5)) : null));
+ .RuleFor(p => p.ISBNs, f => isbns ?? (includeOptionalProperties ? [.. _isbnDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
+ .RuleFor(p => p.Ratings, f => ratings ?? (includeOptionalProperties ? [.. _bookRatingDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
+ .RuleFor(x => x.Contributors, f => contributors ?? (includeOptionalProperties ? [.. _mediaContributorDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
}
///
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/GetBooksLiteRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/GetBooksLiteRequestFixture.cs
index b7ea3062..d532e90d 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/GetBooksLiteRequestFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/GetBooksLiteRequestFixture.cs
@@ -29,6 +29,8 @@ public class GetBooksLiteRequestFixture
/// Optional. Whether the leading "The " prefix of a title should be ignored when computing the alpha key, or not.
/// Optional. The name of the field by which to sort the results.
/// Optional. The direction in which to sort the results.
+ /// Whether the current page should be included, or forced to .
+ /// Whether the per page count should be included, or forced to .
/// The created .
public GetBooksLiteRequest Create(
Guid? libraryId = null,
@@ -38,12 +40,14 @@ public class GetBooksLiteRequestFixture
string? filterAlphaKey = null,
bool shouldIgnoreThePrefixForAlphaPicker = false,
string? sortBy = null,
- SortOrder? sortOrder = null)
+ SortOrder? sortOrder = null,
+ bool includeCurrentPage = true,
+ bool includePerPage = true)
{
return new GetBooksLiteRequest(
LibraryId: libraryId ?? _faker.Random.Guid(),
- CurrentPage: currentPage ?? _faker.Random.Number(1, 100),
- PerPage: perPage ?? _faker.Random.Number(1, 200),
+ CurrentPage: includeCurrentPage ? (currentPage ?? _faker.Random.Number(1, 100)) : null,
+ PerPage: includePerPage ? (perPage ?? _faker.Random.Number(1, 200)) : null,
SearchTerm: searchTerm ?? _faker.Lorem.Word(),
FilterAlphaKey: filterAlphaKey,
ShouldIgnoreThePrefixForAlphaPicker: shouldIgnoreThePrefixForAlphaPicker,
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/GetBooksRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/GetBooksRequestFixture.cs
index cd898891..db6b9fe0 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/GetBooksRequestFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/GetBooksRequestFixture.cs
@@ -27,6 +27,8 @@ public class GetBooksRequestFixture
/// Optional. The search term used to filter results.
/// Optional. The name of the field by which to sort the results.
/// Optional. The direction in which to sort the results.
+ /// Whether the current page should be included, or forced to .
+ /// Whether the per page count should be included, or forced to .
/// The created .
public GetBooksRequest Create(
Guid? libraryId = null,
@@ -34,12 +36,14 @@ public class GetBooksRequestFixture
int? perPage = null,
string? searchTerm = null,
string? sortBy = null,
- SortOrder? sortOrder = null)
+ SortOrder? sortOrder = null,
+ bool includeCurrentPage = true,
+ bool includePerPage = true)
{
return new GetBooksRequest(
LibraryId: libraryId ?? _faker.Random.Guid(),
- CurrentPage: currentPage ?? _faker.Random.Number(1, 100),
- PerPage: perPage ?? _faker.Random.Number(1, 200),
+ CurrentPage: includeCurrentPage ? (currentPage ?? _faker.Random.Number(1, 100)) : null,
+ PerPage: includePerPage ? (perPage ?? _faker.Random.Number(1, 200)) : null,
SearchTerm: searchTerm ?? _faker.Lorem.Word(),
SortBy: sortBy ?? _faker.Lorem.Word(),
SortOrder: sortOrder ?? _faker.PickRandom()
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequestFixture.cs
new file mode 100644
index 00000000..f71ecc3f
--- /dev/null
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequestFixture.cs
@@ -0,0 +1,185 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Contracts.DTO.MediaContributors;
+using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary;
+using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
+using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
+using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class UpdateBookRequestFixture
+{
+ private readonly IsbnDtoFixture _isbnDtoFixture = new();
+ private readonly BookRatingDtoFixture _bookRatingDtoFixture = new();
+ private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
+ private readonly WrittenContentMetadataDtoFixture _writtenContentMetadataDtoFixture = new();
+
+ ///
+ /// Creates a random valid request to update a book.
+ ///
+ /// Optional. The Id of the book to update.
+ /// Optional. The written content metadata of the book.
+ /// Optional. The format of the book.
+ /// Optional. The edition of the book.
+ /// Optional. The volume or book number in the series.
+ /// Optional. The series the book is part of.
+ /// Optional. The ASIN of the book.
+ /// Optional. The Goodreads Id of the book.
+ /// Optional. The LCCN of the book.
+ /// Optional. The OCLC number of the book.
+ /// Optional. The Open Library Id of the book.
+ /// Optional. The LibraryThing Id of the book.
+ /// Optional. The Google Books Id of the book.
+ /// Optional. The Barnes and Noble Id of the book.
+ /// Optional. The Apple Books Id of the book.
+ /// Optional. The ISBNs of the book.
+ /// Optional. The contributors of the book.
+ /// Optional. The ratings of the book.
+ /// Whether the properties that are not explicitly provided should be randomized, or forced to .
+ /// Optional. The raw string value of the Id of the book to update. Takes precedence over .
+ /// Whether the Id should be included, or forced to .
+ /// The created request to update a book.
+ public UpdateBookRequest Create(
+ Guid? id = null,
+ WrittenContentMetadataDto? metadata = null,
+ BookFormat? format = null,
+ string? edition = null,
+ float? volumeNumber = null,
+ BookSeriesDto? series = null,
+ string? asin = null,
+ string? goodreadsId = null,
+ string? lccn = null,
+ string? oclcNumber = null,
+ string? openLibraryId = null,
+ string? libraryThingId = null,
+ string? googleBooksId = null,
+ string? barnesAndNobleId = null,
+ string? appleBooksId = null,
+ List? isbns = null,
+ List? contributors = null,
+ List? ratings = null,
+ bool includeOptionalProperties = true,
+ string? rawId = null,
+ bool includeId = true)
+ {
+ return new Faker()
+ .CustomInstantiator(f => new UpdateBookRequest(
+ default,
+ default!,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default,
+ default!,
+ default!,
+ default!
+ ))
+ .RuleFor(x => x.Id, f => includeId ? (rawId ?? id?.ToString() ?? Guid.NewGuid().ToString()) : null)
+ .RuleFor(x => x.Metadata, metadata ?? _writtenContentMetadataDtoFixture.Create())
+ .RuleFor(x => x.Format, f => format ?? (includeOptionalProperties ? f.PickRandom() : null))
+ .RuleFor(x => x.Edition, f => edition ?? (includeOptionalProperties ? f.Random.String2(f.Random.Number(1, 50)) : null))
+ .RuleFor(x => x.VolumeNumber, f => volumeNumber ?? (includeOptionalProperties ? (float?)f.Random.Number(1, 3) : null))
+ .RuleFor(x => x.Series, series)
+ .RuleFor(x => x.ASIN, f => asin ?? (includeOptionalProperties ? f.Random.String2(10) : null))
+ .RuleFor(x => x.GoodreadsId, f => goodreadsId ?? (includeOptionalProperties ? f.Random.Number(100000, 500000).ToString() : null))
+ .RuleFor(x => x.LCCN, f => lccn ?? (includeOptionalProperties ? CreateLccn(f) : null))
+ .RuleFor(x => x.OCLCNumber, f => oclcNumber ?? (includeOptionalProperties ? CreateOclcNumber(f) : null))
+ .RuleFor(x => x.OpenLibraryId, f => openLibraryId ?? (includeOptionalProperties ? CreateOpenLibraryId(f) : null))
+ .RuleFor(x => x.LibraryThingId, f => libraryThingId ?? (includeOptionalProperties ? f.Random.String2(f.Random.Number(1, 50)) : null))
+ .RuleFor(x => x.GoogleBooksId, f => googleBooksId ?? (includeOptionalProperties ? CreateGoogleBooksId(f) : null))
+ .RuleFor(x => x.BarnesAndNobleId, f => barnesAndNobleId ?? (includeOptionalProperties ? f.Random.String2(10, "0123456789") : null))
+ .RuleFor(x => x.AppleBooksId, f => appleBooksId ?? (includeOptionalProperties ? $"id{f.Random.Number(1, 999999)}" : null))
+ .RuleFor(p => p.ISBNs, f => isbns ?? (includeOptionalProperties ? [.. _isbnDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
+ .RuleFor(p => p.Ratings, f => ratings ?? (includeOptionalProperties ? [.. _bookRatingDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
+ .RuleFor(x => x.Contributors, f => contributors ?? (includeOptionalProperties ? [.. _mediaContributorDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
+ }
+
+ ///
+ /// Generates a random LCCN (Library of Congress Control Number).
+ ///
+ /// The faker used to generate the value.
+ /// The generated LCCN.
+ private static string CreateLccn(Faker faker)
+ {
+ string letters = new([.. Enumerable.Range(0, faker.Random.Number(0, 3)).Select(_ => faker.Random.Char('a', 'z'))]);
+ string digits = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
+ return letters + digits;
+ }
+
+ ///
+ /// Generates a random OCLC number (WorldCat identifier).
+ ///
+ /// The faker used to generate the value.
+ /// The generated OCLC number.
+ private static string CreateOclcNumber(Faker faker)
+ {
+ string[] prefixes = ["ocm", "ocn", "on", "(OCoLC)"];
+ string prefix = faker.Random.ArrayElement(prefixes);
+ string number;
+ switch (prefix)
+ {
+ case "ocm":
+ number = faker.Random.String2(8, "0123456789");
+ break;
+ case "ocn":
+ number = faker.Random.String2(faker.Random.Number(9, 11), "0123456789");
+ break;
+ case "on":
+ number = faker.Random.String2(10, "0123456789");
+ break;
+ case "(OCoLC)":
+ number = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
+ break;
+ default:
+ number = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
+ return number;
+ }
+ return prefix + number;
+ }
+
+ ///
+ /// Generates a random Open Library Id.
+ ///
+ /// The faker used to generate the value.
+ /// The generated Open Library Id.
+ private static string CreateOpenLibraryId(Faker faker)
+ {
+ int firstDigit = faker.Random.Number(1, 9);
+ string remainingDigits = faker.Random.String2(faker.Random.Number(0, 6), "0123456789");
+ char suffix = faker.Random.ArrayElement(['A', 'M', 'W']);
+ return $"OL{firstDigit}{remainingDigits}{suffix}";
+ }
+
+ ///
+ /// Generates a random Google Books Id.
+ ///
+ /// The faker used to generate the value.
+ /// The generated Google Books Id.
+ private static string CreateGoogleBooksId(Faker faker)
+ {
+ const string VALID_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
+ return new string([.. Enumerable.Repeat(VALID_CHARS, 12).Select(s => s[faker.Random.Number(VALID_CHARS.Length - 1)])]);
+ }
+}
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookLiteResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookLiteResponseFixture.cs
index dd23ff53..b834331d 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookLiteResponseFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookLiteResponseFixture.cs
@@ -24,18 +24,22 @@ public class BookLiteResponseFixture
/// Optional. The title of the book.
/// Optional. The release year of the book.
/// Optional. The path of the image representing the cover of the book.
+ /// Whether the release year should be included, or forced to .
+ /// Whether the cover path should be included, or forced to .
/// The created .
public BookLiteResponse Create(
Guid? id = null,
string? title = null,
int? releaseYear = null,
- string? coverPath = null)
+ string? coverPath = null,
+ bool includeReleaseYear = true,
+ bool includeCoverPath = true)
{
return new BookLiteResponse(
id ?? Guid.NewGuid(),
title ?? _faker.Commerce.ProductName(),
- releaseYear ?? _faker.Random.Int(1900, 2024),
- coverPath ?? _faker.System.FilePath()
+ includeReleaseYear ? (releaseYear ?? _faker.Random.Int(1900, 2024)) : null,
+ includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null
);
}
diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/Themes/ThemeResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/Themes/ThemeResponseFixture.cs
index 780ed917..5913454b 100644
--- a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/Themes/ThemeResponseFixture.cs
+++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/Themes/ThemeResponseFixture.cs
@@ -28,10 +28,10 @@ public class ThemeResponseFixture
/// Optional. The author of the theme.
/// Optional. The version of the theme.
/// Optional. The preview image path of the theme, or when the theme has no preview.
- /// Whether to set , or when .
+ /// Whether the preview path should be included, or forced to .
/// Optional. The source the theme was installed from.
/// Optional. Whether the theme is the currently active one.
- /// Whether to set , or when .
+ /// Whether the currently active flag should be included, or forced to .
/// Optional. The UTC timestamp when the theme was installed.
/// Optional. Whether the theme was deleted by the user.
/// The created .
diff --git a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/FileFixture.cs b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/FileFixture.cs
index 5e730d0d..bf8ed020 100644
--- a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/FileFixture.cs
+++ b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/FileFixture.cs
@@ -28,7 +28,7 @@ public class FileFixture
/// Optional. The file's modification date. If not provided, a recent date is generated.
/// Optional. The file size. If not provided, a random size is generated.
/// Optional. The file's status. If not provided, a random status is assigned.
- /// Whether the file should include creation and modification dates.
+ /// Whether the creation and modification dates should be included, or left unset.
/// The created .
public File Create(
string? path = null,
diff --git a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/LibraryFixture.cs b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/LibraryFixture.cs
index 449396f2..c786875c 100644
--- a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/LibraryFixture.cs
+++ b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/LibraryFixture.cs
@@ -2,9 +2,11 @@
using Bogus;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate;
-using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects;
+using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
+using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
+using Lumina.Domain.Fixtures.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects;
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
@@ -22,6 +24,9 @@ public class LibraryFixture
{
private readonly Faker _faker = new();
private readonly Random _random = new();
+ private readonly LibraryIdFixture _libraryIdFixture = new();
+ private readonly UserIdFixture _userIdFixture = new();
+ private readonly ScanIdFixture _scanIdFixture = new();
///
/// Creates a random valid domain aggregate.
@@ -32,7 +37,7 @@ public class LibraryFixture
/// Optional. The library type.
/// Optional. The content locations of the library.
/// Optional. The cover image of the library.
- /// Whether to include a cover image or not.
+ /// Whether the cover image should be included, or forced to .
/// Whether the library is enabled.
/// Whether the library is locked.
/// Whether metadata download from the web is enabled.
@@ -63,12 +68,13 @@ public class LibraryFixture
"F:/Content"
];
- List resolvedScanIds = scanIds is null ? [ScanId.CreateUnique(), ScanId.CreateUnique()] : [.. scanIds.Select(scanId => ScanId.Create(scanId))];
+ UserId resolvedUserId = userId is null ? _userIdFixture.Create() : _userIdFixture.Create(userId.Value);
+ List resolvedScanIds = scanIds is null ? [.. _scanIdFixture.CreateMany(2)] : [.. scanIds.Select(scanId => _scanIdFixture.Create(scanId))];
string? resolvedCoverImage = includeCoverImage ? (coverImage ?? _faker.System.FilePath()) : null;
Result library = id is null ?
Library.Create(
- userId is not null ? UserId.Create(userId.Value) : UserId.CreateUnique(),
+ resolvedUserId,
title ?? _faker.Random.String2(_faker.Random.Number(1, 50)),
libraryType ?? _faker.PickRandom(),
contentLocations ?? validPaths.Take(_random.Next(1, validPaths.Count)),
@@ -81,8 +87,8 @@ public class LibraryFixture
resolvedScanIds
) :
Library.Create(
- LibraryId.Create(id.Value),
- userId is not null ? UserId.Create(userId.Value) : UserId.CreateUnique(),
+ _libraryIdFixture.Create(id.Value),
+ resolvedUserId,
title ?? _faker.Random.String2(_faker.Random.Number(1, 50)),
libraryType ?? _faker.PickRandom(),
contentLocations ?? validPaths.Take(_random.Next(1, validPaths.Count)),
diff --git a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/Events/LibraryScanFailedDomainEventFixture.cs b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/Events/LibraryScanFailedDomainEventFixture.cs
index 1d28c60a..b99dd4cd 100644
--- a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/Events/LibraryScanFailedDomainEventFixture.cs
+++ b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/Events/LibraryScanFailedDomainEventFixture.cs
@@ -29,7 +29,7 @@ public class LibraryScanFailedDomainEventFixture
/// Optional. The composite identifier of the media library scan that has failed.
/// Optional. The date and time when the domain event occurred.
/// Optional. The descriptive message of the failure.
- /// Whether to include an error message in the domain event. When false, the error message is left unset.
+ /// Whether the error message should be included, or forced to .
/// The created .
public LibraryScanFailedDomainEvent Create(
Guid? id = null,
diff --git a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/BookFixture.cs b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/BookFixture.cs
index 3b9873ed..331d81b0 100644
--- a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/BookFixture.cs
+++ b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/BookFixture.cs
@@ -1,13 +1,12 @@
#region ========================================================================= USING =====================================================================================
-using AutoFixture;
+using Bogus;
using Lumina.Domain.Common.Primitives;
-using Lumina.Domain.Common.ValueObjects.Metadata;
using Lumina.Domain.Core.BoundedContexts.MediaContributorBoundedContext.MediaContributorAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate;
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.Entities;
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.ExternalIdentifiers.LibraryManagementBoundedContext.LibraryAggregate;
-using Lumina.Domain.Fixtures.Common.Setup;
+using Lumina.Domain.Fixtures.Core.BoundedContexts.MediaContributorBoundedContext.MediaContributorAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
using System;
@@ -24,46 +23,76 @@ namespace Lumina.Domain.Fixtures.Core.BoundedContexts.WrittenContentLibraryBound
[ExcludeFromCodeCoverage]
public class BookFixture
{
- private readonly Fixture _fixture = new();
+ private readonly Faker _faker = new();
+ private readonly WrittenContentMetadataFixture _writtenContentMetadataFixture = new();
private readonly IsbnFixture _isbnFixture = new();
private readonly BookRatingFixture _bookRatingFixture = new();
-
- ///
- /// Initializes a new instance of the class.
- ///
- public BookFixture()
- {
- _fixture.Customizations.Add(new DateOnlySpecimenBuilder());
- _fixture.Customizations.Add(new NullableDateOnlySpecimenBuilder());
- ConfigureCustomDomainTypes();
- }
+ private readonly MediaContributorIdFixture _mediaContributorIdFixture = new();
///
/// Creates a random valid domain aggregate.
///
+ /// Optional. The Id of the media library this book belongs to.
+ /// Optional. The file system path of the book.
+ /// Optional. The written content metadata of the book.
+ /// Optional. The format of the book.
+ /// Optional. The edition of the book.
+ /// Optional. The volume or book number in the series.
+ /// Optional. The series the book is part of.
+ /// Optional. The ASIN of the book.
+ /// Optional. The Goodreads Id of the book.
+ /// Optional. The LCCN of the book.
+ /// Optional. The OCLC number of the book.
+ /// Optional. The Open Library Id of the book.
+ /// Optional. The LibraryThing Id of the book.
+ /// Optional. The Google Books Id of the book.
+ /// Optional. The Barnes and Noble Id of the book.
+ /// Optional. The Apple Books Id of the book.
+ /// Optional. The ISBNs of the book.
+ /// Optional. The media contributors of the book.
+ /// Optional. The ratings of the book.
/// The created domain aggregate.
- public Book Create()
+ public Book Create(
+ Guid? libraryId = null,
+ string? path = null,
+ WrittenContentMetadata? metadata = null,
+ BookFormat? format = null,
+ string? edition = null,
+ float? volumeNumber = null,
+ BookSeries? series = null,
+ string? asin = null,
+ string? goodreadsId = null,
+ string? lccn = null,
+ string? oclcNumber = null,
+ string? openLibraryId = null,
+ string? libraryThingId = null,
+ string? googleBooksId = null,
+ string? barnesAndNobleId = null,
+ string? appleBooksId = null,
+ List? isbns = null,
+ List? contributors = null,
+ List? ratings = null)
{
return Book.Create(
- LibraryId.Create(_fixture.Create()),
- _fixture.Create(),
- _fixture.Create(),
- _fixture.Create(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>()
+ libraryId is null ? LibraryId.Create(Guid.NewGuid()) : LibraryId.Create(libraryId.Value),
+ path ?? _faker.System.FilePath(),
+ metadata ?? _writtenContentMetadataFixture.Create(),
+ format ?? _faker.PickRandom(),
+ edition is null ? Optional.Some(_faker.Commerce.ProductName()) : Optional.Some(edition),
+ volumeNumber is null ? Optional.None() : Optional.Some(volumeNumber.Value),
+ series is null ? Optional.None() : Optional.Some(series),
+ asin is null ? Optional.Some(_faker.Random.String2(10)) : Optional.Some(asin),
+ goodreadsId is null ? Optional.Some(_faker.Random.Number(100000, 500000).ToString()) : Optional.Some(goodreadsId),
+ lccn is null ? Optional.Some(_faker.Random.String2(_faker.Random.Number(8, 10))) : Optional.Some(lccn),
+ oclcNumber is null ? Optional.Some($"ocm{_faker.Random.String2(8, "0123456789")}") : Optional.Some(oclcNumber),
+ openLibraryId is null ? Optional.Some($"OL{_faker.Random.Number(100000, 999999)}{_faker.Random.ArrayElement(['A', 'M', 'W'])}") : Optional.Some(openLibraryId),
+ libraryThingId is null ? Optional.Some(_faker.Random.String2(_faker.Random.Number(1, 50))) : Optional.Some(libraryThingId),
+ googleBooksId is null ? Optional.Some(_faker.Random.String2(12)) : Optional.Some(googleBooksId),
+ barnesAndNobleId is null ? Optional.Some(_faker.Random.String2(10, "0123456789")) : Optional.Some(barnesAndNobleId),
+ appleBooksId is null ? Optional.Some($"id{_faker.Random.Number(1, 999999)}") : Optional.Some(appleBooksId),
+ isbns ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 4)).Select(_ => _isbnFixture.Create())],
+ contributors ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 4)).Select(_ => _mediaContributorIdFixture.Create())],
+ ratings ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 4)).Select(_ => _bookRatingFixture.Create())]
).Value;
}
@@ -76,50 +105,4 @@ public class BookFixture
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
-
- private void ConfigureCustomDomainTypes()
- {
- _fixture.Register(() => Optional.Some(_fixture.Create()));
- _fixture.Register(() => Optional.Some(_fixture.Create()));
-
- _fixture.Register(() =>
- {
- int originalYear = Random.Shared.Next(1900, 2026);
- int reReleaseYear = Random.Shared.Next(originalYear, 2026);
-
- return ReleaseInfo.Create(
- Optional.Some(DateOnly.FromDateTime(new DateTime(originalYear, 1, 1))),
- Optional.Some(originalYear),
- Optional.Some(DateOnly.FromDateTime(new DateTime(reReleaseYear, 1, 1))),
- Optional.Some(reReleaseYear),
- _fixture.Create>(),
- _fixture.Create>()
- ).Value;
- });
-
- _fixture.Register(() => Genre.Create(
- _fixture.Create()
- ).Value);
-
- _fixture.Register(() => Tag.Create(
- _fixture.Create()
- ).Value);
-
- _fixture.Register(() => WrittenContentMetadata.Create(
- _fixture.Create(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>(),
- _fixture.Create>()
- ).Value);
-
- _fixture.Register(() => _isbnFixture.Create());
-
- _fixture.Register(() => _bookRatingFixture.Create());
- }
}
diff --git a/tests/Common/Lumina.Infrastructure.Fixtures/Core/Themes/ThemePackFixture.cs b/tests/Common/Lumina.Infrastructure.Fixtures/Core/Themes/ThemePackFixture.cs
index f87a516f..9347f4b9 100644
--- a/tests/Common/Lumina.Infrastructure.Fixtures/Core/Themes/ThemePackFixture.cs
+++ b/tests/Common/Lumina.Infrastructure.Fixtures/Core/Themes/ThemePackFixture.cs
@@ -28,7 +28,7 @@ public sealed class ThemePackFixture
/// Optional template mappings written to the manifest.
/// Optional preview path written to the manifest, or to omit the preview.
/// Optional content for the default template file.
- /// Whether to include the preview asset file in the archive.
+ /// Whether to include the preview asset file in the archive or not.
/// Optional additional files written into the archive.
/// The created theme pack ZIP archive.
public byte[] Create(
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Api/StubApiHttpClient.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Api/StubApiHttpClient.cs
index 2b3c67cf..ad6f31c8 100644
--- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Api/StubApiHttpClient.cs
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Api/StubApiHttpClient.cs
@@ -267,6 +267,24 @@ public class StubApiHttpClient : IApiHttpClient
throw new InvalidOperationException($"No PUT response is registered for the endpoint '{endpoint}'.");
}
+ ///
+ /// Sends a PUT request with a multipart form containing a single file to the specified as an asynchronous operation and returns the result.
+ ///
+ /// The expected type of the response content.
+ /// The API endpoint where the request is being sent.
+ /// The stream of the file to upload.
+ /// The name of the file to upload.
+ /// The name of the form field carrying the file.
+ /// Cancellation token that can be used to stop the execution.
+ /// The deserialized response containing the result of the PUT request.
+ public Task PutMultipartAsync(string endpoint, Stream fileStream, string fileName, string fieldName, CancellationToken cancellationToken = default)
+ {
+ PutRequests.Add((endpoint, fileName));
+ if (_putResponseFactories.TryGetValue(endpoint, out Func
/// Optional unique identifier of the plugin.
- /// Whether to populate the current settings values, or leave them null.
- /// Whether to populate the settings schema, or leave it empty.
+ /// Whether the current settings values should be included, or forced to .
+ /// Whether the settings schema should be included, or forced to an empty collection.
/// A configured instance.
public PluginSettingsDto Create(
Guid? pluginId = null,
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Themes/ThemeNavEntryDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Themes/ThemeNavEntryDtoFixture.cs
index 76cc62a7..bf3edb3c 100644
--- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Themes/ThemeNavEntryDtoFixture.cs
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Themes/ThemeNavEntryDtoFixture.cs
@@ -21,9 +21,9 @@ public class ThemeNavEntryDtoFixture
///
/// Optional label of the entry.
/// Optional URL of the link, or for a submenu.
- /// Whether to set , or when .
+ /// Whether the URL should be included, or forced to .
/// Optional CSS classes of the link.
- /// Whether to set , or when .
+ /// Whether the CSS class should be included, or forced to .
/// Optional child links of a submenu.
/// The created .
public ThemeNavEntryDto Create(
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Themes/ThemeResponseDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Themes/ThemeResponseDtoFixture.cs
index 36901ca5..14ec2131 100644
--- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Themes/ThemeResponseDtoFixture.cs
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Themes/ThemeResponseDtoFixture.cs
@@ -28,10 +28,10 @@ public class ThemeResponseDtoFixture
/// Optional author of the theme.
/// Optional semantic version of the theme.
/// Optional preview image path of the theme, or when the theme has no preview.
- /// Whether to set , or when .
+ /// Whether the preview path should be included, or forced to .
/// Optional source the theme was installed from.
/// Optional value indicating whether the theme is the active one.
- /// Whether to set , or when .
+ /// Whether the currently active flag should be included, or forced to .
/// Optional UTC timestamp at which the theme was installed.
/// Optional value indicating whether the theme was deleted by the user.
/// A configured instance.
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/BookLibrary/BookDetailsDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/BookLibrary/BookDetailsDtoFixture.cs
new file mode 100644
index 00000000..fdc2ba2b
--- /dev/null
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/BookLibrary/BookDetailsDtoFixture.cs
@@ -0,0 +1,94 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary;
+using Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary.BookLibrary;
+using Lumina.Presentation.Web.Common.Enums.BookLibrary;
+using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors;
+using Lumina.Presentation.Web.Fixtures.Common.DTO.WrittenContentLibrary;
+using Lumina.Presentation.Web.Fixtures.Common.DTO.WrittenContentLibrary.BookLibrary;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Presentation.Web.Fixtures.Common.DTO.WrittenContentLibrary.BookLibrary;
+
+///
+/// Fixture class for generating test data.
+///
+[ExcludeFromCodeCoverage]
+public class BookDetailsDtoFixture
+{
+ private readonly Faker _faker = new();
+ private readonly WrittenContentMetadataDtoFixture _writtenContentMetadataDtoFixture = new();
+ private readonly IsbnDtoFixture _isbnDtoFixture = new();
+ private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
+ private readonly BookRatingDtoFixture _bookRatingDtoFixture = new();
+
+ ///
+ /// Creates a new instance with randomized test data.
+ ///
+ /// Optional Id of the book.
+ /// Optional Id of the media library the book belongs to.
+ /// Optional file system path of the book.
+ /// Optional written content metadata of the book.
+ /// Whether the written content metadata should be included, or forced to .
+ /// A configured instance.
+ public BookDetailsDto Create(
+ Guid? id = null,
+ Guid? libraryId = null,
+ string? path = null,
+ WrittenContentMetadataDto? metadata = null,
+ bool includeMetadata = true)
+ {
+ return new BookDetailsDto
+ {
+ Id = id ?? _faker.Random.Guid(),
+ LibraryId = libraryId ?? _faker.Random.Guid(),
+ Path = path ?? _faker.System.FilePath(),
+ Metadata = metadata ?? (includeMetadata ? _writtenContentMetadataDtoFixture.Create() : null),
+ Format = _faker.PickRandom(),
+ Edition = _faker.Random.String2(_faker.Random.Number(1, 50)),
+ VolumeNumber = _faker.Random.Number(1, 3),
+ ASIN = _faker.Random.String2(10),
+ GoodreadsId = _faker.Random.Number(100000, 500000).ToString(),
+ LCCN = "n78890351",
+ OCLCNumber = "ocm12345678",
+ OpenLibraryId = "OL123456M",
+ LibraryThingId = _faker.Random.String2(_faker.Random.Number(1, 50)),
+ GoogleBooksId = CreateGoogleBooksId(),
+ BarnesAndNobleId = _faker.Random.String2(10, "0123456789"),
+ AppleBooksId = $"id{_faker.Random.Number(1, 999999)}",
+ ISBNs = [.. _isbnDtoFixture.CreateMany(_faker.Random.Number(1, 3))],
+ Contributors = [.. _mediaContributorDtoFixture.CreateMany(_faker.Random.Number(1, 3))],
+ Ratings = [.. _bookRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))],
+ MetadataStatus = _faker.Random.String2(_faker.Random.Number(1, 20)),
+ LastMetadataUpdateUtc = _faker.Date.Recent(),
+ MetadataProvider = _faker.Random.String2(_faker.Random.Number(1, 20)),
+ CreatedOnUtc = _faker.Date.Past(),
+ UpdatedOnUtc = _faker.Date.Recent(),
+ CoverPath = _faker.System.FilePath()
+ };
+ }
+
+ ///
+ /// Creates a list of instances with randomized test data.
+ ///
+ /// Number of instances to create.
+ /// List of configured instances.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+
+ ///
+ /// Generates a valid Google Books Id.
+ ///
+ /// The generated Google Books Id.
+ private string CreateGoogleBooksId()
+ {
+ const string VALID_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
+ return new string([.. Enumerable.Repeat(VALID_CHARS, 12).Select(s => s[_faker.Random.Number(VALID_CHARS.Length - 1)])]);
+ }
+}
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/BookLibrary/BookRatingDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/BookLibrary/BookRatingDtoFixture.cs
new file mode 100644
index 00000000..49cb5256
--- /dev/null
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/BookLibrary/BookRatingDtoFixture.cs
@@ -0,0 +1,53 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary.BookLibrary;
+using Lumina.Presentation.Web.Common.Enums.BookLibrary;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Presentation.Web.Fixtures.Common.DTO.WrittenContentLibrary.BookLibrary;
+
+///
+/// Fixture class for generating test data.
+///
+[ExcludeFromCodeCoverage]
+public class BookRatingDtoFixture
+{
+ private readonly Faker _faker = new();
+
+ ///
+ /// Creates a new instance with randomized test data.
+ ///
+ /// Optional. The rating value.
+ /// Optional. The maximum possible rating value.
+ /// Optional. The number of votes the rating is based on.
+ /// Optional. The source of the rating.
+ /// A configured instance.
+ public BookRatingDto Create(
+ decimal? value = null,
+ decimal? maxValue = null,
+ int? voteCount = null,
+ BookRatingSource? source = null)
+ {
+ return new BookRatingDto
+ {
+ Value = value ?? _faker.Random.Decimal(1, 5),
+ MaxValue = maxValue ?? 5,
+ VoteCount = voteCount ?? _faker.Random.Number(1, 1000),
+ Source = source ?? _faker.PickRandom()
+ };
+ }
+
+ ///
+ /// Creates multiple instances with randomized test data.
+ ///
+ /// Number of instances to create.
+ /// List of configured instances.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/BookLibrary/BookSeriesDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/BookLibrary/BookSeriesDtoFixture.cs
new file mode 100644
index 00000000..c84c8be0
--- /dev/null
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/BookLibrary/BookSeriesDtoFixture.cs
@@ -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;
+
+///
+/// Fixture class for generating test data.
+///
+[ExcludeFromCodeCoverage]
+public class BookSeriesDtoFixture
+{
+ private readonly Faker _faker = new();
+
+ ///
+ /// Creates a new instance with randomized test data.
+ ///
+ /// Optional. The title of the book series.
+ /// A configured instance.
+ public BookSeriesDto Create(string? title = null)
+ {
+ return new BookSeriesDto
+ {
+ Title = title ?? _faker.Lorem.Sentence(3)
+ };
+ }
+
+ ///
+ /// Creates multiple instances with randomized test data.
+ ///
+ /// Number of instances to create.
+ /// List of configured instances.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/BookLibrary/IsbnDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/BookLibrary/IsbnDtoFixture.cs
new file mode 100644
index 00000000..f5185f35
--- /dev/null
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/BookLibrary/IsbnDtoFixture.cs
@@ -0,0 +1,86 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary.BookLibrary;
+using Lumina.Presentation.Web.Common.Enums.BookLibrary;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Presentation.Web.Fixtures.Common.DTO.WrittenContentLibrary.BookLibrary;
+
+///
+/// Fixture class for generating test data.
+///
+[ExcludeFromCodeCoverage]
+public class IsbnDtoFixture
+{
+ private readonly Random _random = new();
+
+ ///
+ /// Creates a new instance with a random or explicitly requested format.
+ ///
+ /// Optional. The ISBN value. If not provided, a valid ISBN is generated.
+ /// Optional. The ISBN format. If not provided, the format is derived from the value.
+ /// A configured instance.
+ public IsbnDto Create(string? value = null, IsbnFormat? format = null)
+ {
+ string resolvedValue = value ?? (format == IsbnFormat.Isbn10 ? GenerateValidIsbn10() : GenerateValidIsbn13());
+ return new IsbnDto
+ {
+ Value = resolvedValue,
+ Format = format ?? (resolvedValue.Length > 13 ? IsbnFormat.Isbn13 : IsbnFormat.Isbn10)
+ };
+ }
+
+ ///
+ /// Creates multiple instances with randomized test data.
+ ///
+ /// Number of instances to create.
+ /// List of configured instances.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+
+ ///
+ /// Generates a valid ISBN-10 with the correct checksum.
+ ///
+ /// A valid ISBN-10 value.
+ private string GenerateValidIsbn10()
+ {
+ int[] digits = new int[9];
+ for (int i = 0; i < 9; i++)
+ digits[i] = _random.Next(0, 10);
+
+ int sum = 0;
+ for (int i = 0; i < 9; i++)
+ sum += (10 - i) * digits[i];
+
+ int checkDigit = (11 - sum % 11) % 11;
+ string checkChar = checkDigit == 10 ? "X" : checkDigit.ToString();
+
+ return $"{digits[0]}-{digits[1]}{digits[2]}-{digits[3]}{digits[4]}{digits[5]}{digits[6]}{digits[7]}{digits[8]}-{checkChar}";
+ }
+
+ ///
+ /// Generates a valid ISBN-13 with the correct checksum.
+ ///
+ /// A valid ISBN-13 value.
+ private string GenerateValidIsbn13()
+ {
+ string prefix = _random.Next(2) == 0 ? "978" : "979";
+ string group = _random.Next(0, 99999).ToString().PadLeft(5, '0');
+ string publisher = _random.Next(0, 999999).ToString().PadLeft(6, '0');
+ string title = _random.Next(0, 99).ToString().PadLeft(2, '0');
+
+ string isbn = $"{prefix}{group[..1]}{publisher}{title}";
+ int sum = 0;
+ for (int i = 0; i < 12; i++)
+ sum += (i % 2 == 0 ? 1 : 3) * int.Parse(isbn[i].ToString());
+
+ int checkDigit = (10 - sum % 10) % 10;
+
+ return $"{prefix}-{group[..1]}-{publisher}-{title}-{checkDigit}";
+ }
+}
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/WrittenContentMetadataDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/WrittenContentMetadataDtoFixture.cs
new file mode 100644
index 00000000..6695be24
--- /dev/null
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/WrittenContentLibrary/WrittenContentMetadataDtoFixture.cs
@@ -0,0 +1,75 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Presentation.Web.Common.DTO.Common;
+using Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary;
+using Lumina.Presentation.Web.Fixtures.Common.DTO.Common;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Presentation.Web.Fixtures.Common.DTO.WrittenContentLibrary;
+
+///
+/// Fixture class for generating test data.
+///
+[ExcludeFromCodeCoverage]
+public class WrittenContentMetadataDtoFixture
+{
+ private readonly Faker _faker = new();
+ private readonly GenreDtoFixture _genreDtoFixture = new();
+ private readonly TagDtoFixture _tagDtoFixture = new();
+ private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
+ private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
+
+ ///
+ /// Creates a new instance with randomized test data.
+ ///
+ /// Optional. The title of the written content.
+ /// Optional. The original title of the written content.
+ /// Optional. A brief description or summary of the written content.
+ /// Optional. The release information of the written content.
+ /// Optional. The genres associated with the written content.
+ /// Optional. The tags that describe or categorize the written content.
+ /// Optional. The language in which the written content is written.
+ /// Optional. The original language of the written content.
+ /// Optional. The name of the publisher of the written content.
+ /// Optional. The number of pages in the written content.
+ /// A configured instance.
+ public WrittenContentMetadataDto Create(
+ string? title = null,
+ string? originalTitle = null,
+ string? description = null,
+ ReleaseInfoDto? releaseInfo = null,
+ List? genres = null,
+ List? tags = null,
+ LanguageInfoDto? language = null,
+ LanguageInfoDto? originalLanguage = null,
+ string? publisher = null,
+ int? pageCount = null)
+ {
+ return new WrittenContentMetadataDto
+ {
+ Title = title ?? _faker.Lorem.Sentence(3),
+ OriginalTitle = originalTitle ?? _faker.Lorem.Sentence(3),
+ Description = description ?? _faker.Lorem.Paragraph(),
+ ReleaseInfo = releaseInfo ?? _releaseInfoDtoFixture.Create(),
+ Genres = genres ?? [.. _genreDtoFixture.CreateMany(_faker.Random.Number(1, 3))],
+ Tags = tags ?? [.. _tagDtoFixture.CreateMany(_faker.Random.Number(1, 3))],
+ Language = language ?? _languageInfoDtoFixture.Create(),
+ OriginalLanguage = originalLanguage ?? _languageInfoDtoFixture.Create(),
+ Publisher = publisher ?? _faker.Company.CompanyName(),
+ PageCount = pageCount ?? _faker.Random.Int(100, 1000)
+ };
+ }
+
+ ///
+ /// Creates multiple instances with randomized test data.
+ ///
+ /// Number of instances to create.
+ /// List of configured instances.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/FileSystemManagement/Directories/GetDirectoriesRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/FileSystemManagement/Directories/GetDirectoriesRequestFixture.cs
index 3683b3a4..6c3c7575 100644
--- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/FileSystemManagement/Directories/GetDirectoriesRequestFixture.cs
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/FileSystemManagement/Directories/GetDirectoriesRequestFixture.cs
@@ -17,9 +17,11 @@ public class GetDirectoriesRequestFixture
/// Creates a new instance with randomized test data.
///
/// Optional file system path whose directories are retrieved.
- /// Whether hidden file system elements are included or not.
+ /// Whether to include hidden file system elements or not.
/// A configured instance.
- public GetDirectoriesRequest Create(string? path = null, bool includeHiddenElements = false)
+ public GetDirectoriesRequest Create(
+ string? path = null,
+ bool includeHiddenElements = false)
{
return new GetDirectoriesRequest(
Path: path ?? $"/media/{System.Guid.NewGuid():N}",
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBookRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBookRequestFixture.cs
new file mode 100644
index 00000000..deca06c8
--- /dev/null
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBookRequestFixture.cs
@@ -0,0 +1,37 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books;
+
+///
+/// Fixture class for generating test data.
+///
+[ExcludeFromCodeCoverage]
+public class GetBookRequestFixture
+{
+ ///
+ /// Creates a new instance.
+ ///
+ /// Optional unique identifier of the book to retrieve.
+ /// A configured instance.
+ public GetBookRequest Create(
+ Guid? id = null)
+ {
+ return new GetBookRequest(id?.ToString() ?? Guid.NewGuid().ToString());
+ }
+
+ ///
+ /// Creates a list of instances.
+ ///
+ /// Number of instances to create.
+ /// List of configured instances.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequestFixture.cs
new file mode 100644
index 00000000..675dc2f8
--- /dev/null
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequestFixture.cs
@@ -0,0 +1,84 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary;
+using Lumina.Presentation.Web.Common.Enums.BookLibrary;
+using Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books;
+using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors;
+using Lumina.Presentation.Web.Fixtures.Common.DTO.WrittenContentLibrary;
+using Lumina.Presentation.Web.Fixtures.Common.DTO.WrittenContentLibrary.BookLibrary;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books;
+
+///
+/// Fixture class for generating test data.
+///
+[ExcludeFromCodeCoverage]
+public class UpdateBookRequestFixture
+{
+ private readonly Faker _faker = new();
+ private readonly WrittenContentMetadataDtoFixture _writtenContentMetadataDtoFixture = new();
+ private readonly BookSeriesDtoFixture _bookSeriesDtoFixture = new();
+ private readonly IsbnDtoFixture _isbnDtoFixture = new();
+ private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
+ private readonly BookRatingDtoFixture _bookRatingDtoFixture = new();
+
+ ///
+ /// Creates a new instance with randomized test data.
+ ///
+ /// Optional Id of the book to update.
+ /// Optional written content metadata of the book.
+ /// Whether the properties that are not explicitly provided should be randomized, or forced to .
+ /// A configured instance.
+ public UpdateBookRequest Create(
+ Guid? id = null,
+ WrittenContentMetadataDto? metadata = null,
+ bool includeOptionalProperties = true)
+ {
+ return new UpdateBookRequest
+ {
+ Id = id?.ToString() ?? Guid.NewGuid().ToString(),
+ Metadata = metadata ?? (includeOptionalProperties ? _writtenContentMetadataDtoFixture.Create() : null),
+ Format = includeOptionalProperties ? _faker.PickRandom() : null,
+ Edition = includeOptionalProperties ? _faker.Random.String2(_faker.Random.Number(1, 50)) : null,
+ VolumeNumber = includeOptionalProperties ? _faker.Random.Number(1, 3) : null,
+ Series = includeOptionalProperties ? _bookSeriesDtoFixture.Create() : null,
+ ASIN = includeOptionalProperties ? _faker.Random.String2(10) : null,
+ GoodreadsId = includeOptionalProperties ? _faker.Random.Number(100000, 500000).ToString() : null,
+ LCCN = includeOptionalProperties ? "n78890351" : null,
+ OCLCNumber = includeOptionalProperties ? "ocm12345678" : null,
+ OpenLibraryId = includeOptionalProperties ? "OL123456M" : null,
+ LibraryThingId = includeOptionalProperties ? _faker.Random.String2(_faker.Random.Number(1, 50)) : null,
+ GoogleBooksId = includeOptionalProperties ? CreateGoogleBooksId() : null,
+ BarnesAndNobleId = includeOptionalProperties ? _faker.Random.String2(10, "0123456789") : null,
+ AppleBooksId = includeOptionalProperties ? $"id{_faker.Random.Number(1, 999999)}" : null,
+ ISBNs = includeOptionalProperties ? [.. _isbnDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null,
+ Contributors = includeOptionalProperties ? [.. _mediaContributorDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null,
+ Ratings = includeOptionalProperties ? [.. _bookRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null
+ };
+ }
+
+ ///
+ /// Creates a list of instances with randomized test data.
+ ///
+ /// Number of instances to create.
+ /// List of configured instances.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+
+ ///
+ /// Generates a valid Google Books Id.
+ ///
+ /// The generated Google Books Id.
+ private string CreateGoogleBooksId()
+ {
+ const string VALID_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
+ return new string([.. Enumerable.Repeat(VALID_CHARS, 12).Select(s => s[_faker.Random.Number(VALID_CHARS.Length - 1)])]);
+ }
+}
diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointTests.cs
index 6e2216f1..26a716e6 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointTests.cs
@@ -1,13 +1,24 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
+using Lumina.Application.Common.DataAccess.Entities.MediaContributors;
+using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management;
+using Lumina.Contracts.Fixtures.Core.DTO.Common;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
using Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
+using Lumina.DataAccess.Core.UoW;
using Lumina.Domain.Common.Errors;
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate;
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using Lumina.Presentation.Api.IntegrationTests.Common.Converters;
using Lumina.Presentation.Api.IntegrationTests.Common.Setup;
using Microsoft.AspNetCore.Http;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -40,6 +51,16 @@ public class AddBookEndpointTests : IClassFixture
}
};
private readonly AddBookRequestFixture _requestBookFixture = new();
+ private readonly WrittenContentMetadataDtoFixture _writtenContentMetadataDtoFixture = new();
+ private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
+ private readonly GenreDtoFixture _genreDtoFixture = new();
+ private readonly TagDtoFixture _tagDtoFixture = new();
+ private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
+ private readonly IsbnDtoFixture _isbnDtoFixture = new();
+ private readonly BookRatingDtoFixture _bookRatingDtoFixture = new();
+ private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
+ private readonly LibraryEntityFixture _libraryEntityFixture = new();
+ private Guid _libraryId;
///
/// Initializes a new instance of the class.
@@ -52,11 +73,19 @@ public class AddBookEndpointTests : IClassFixture
}
///
- /// Initializes authenticated API client.
+ /// Initializes authenticated API client, along with a media library owned by the authenticated user that the added books belong to.
///
public async Task InitializeAsync()
{
_client = await _apiFactory.CreateAuthenticatedClientAsync();
+
+ // The handler only allows adding books to a library the current user owns, so each test seeds its own owned library.
+ _libraryId = Guid.NewGuid();
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ Guid userId = dbContext.Users.Single(user => user.Username == _apiFactory.TestUsername).Id;
+ dbContext.Libraries.Add(_libraryEntityFixture.Create(id: _libraryId, userId: userId, title: "Test Library", libraryType: LibraryType.EBook, contentLocations: []));
+ await dbContext.SaveChangesAsync();
}
[Fact]
@@ -66,7 +95,7 @@ public class AddBookEndpointTests : IClassFixture
AddBookRequest bookRequest = _requestBookFixture.Create();
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
response.EnsureSuccessStatusCode();
@@ -168,11 +197,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyTitle_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { Title = null! } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(includeTitle: false));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.TitleCannotBeEmpty.Description);
@@ -182,11 +210,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthTitle_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { Title = new Faker().Random.String2(300) } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(title: new Faker().Random.String2(300)));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.TitleMustBeMaximum255CharactersLong.Description);
@@ -196,8 +223,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyOriginalTitle_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { OriginalTitle = null! } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(includeOriginalTitle: false));
// Act & Assert
await AssertCreated(bookRequest);
@@ -207,11 +233,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthOriginalTitle_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { OriginalTitle = new Faker().Random.String2(300) } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(originalTitle: new Faker().Random.String2(300)));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.OriginalTitleMustBeMaximum255CharactersLong.Description);
@@ -221,8 +246,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyDescription_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { Description = null! } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(includeDescription: false));
// Act & Assert
await AssertCreated(bookRequest);
@@ -232,11 +256,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthDescription_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { Description = new Faker().Random.String2(2001) } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(description: new Faker().Random.String2(2001)));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong.Description);
@@ -246,11 +269,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNullReleaseInfo_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { ReleaseInfo = null! } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(includeReleaseInfo: false));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.ReleaseInfoCannotBeNull.Description);
@@ -260,8 +282,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyOriginalReleaseYear_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { ReleaseInfo = bookRequest.Metadata.ReleaseInfo! with { OriginalReleaseYear = null! } } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(includeOriginalReleaseYear: false)));
// Act & Assert
await AssertCreated(bookRequest);
@@ -271,11 +292,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidValueOriginalReleaseYear_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { ReleaseInfo = bookRequest.Metadata.ReleaseInfo! with { OriginalReleaseYear = 10000 } } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 10000)));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.OriginalReleaseYearMustBeBetween1And9999.Description);
@@ -285,8 +305,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyReReleaseYear_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { ReleaseInfo = bookRequest.Metadata.ReleaseInfo! with { ReReleaseYear = null!, ReReleaseDate = null } } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(includeReReleaseYear: false, includeReReleaseDate: false)));
// Act & Assert
await AssertCreated(bookRequest);
@@ -296,19 +315,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidValueReReleaseYear_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- ReleaseInfo = bookRequest.Metadata.ReleaseInfo!
- with
- { ReReleaseYear = 10000 }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 10000)));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.ReReleaseYearMustBeBetween1And9999.Description);
@@ -318,8 +328,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyReleaseCountry_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { ReleaseInfo = bookRequest.Metadata.ReleaseInfo! with { ReleaseCountry = null! } } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(includeReleaseCountry: false)));
// Act & Assert
await AssertCreated(bookRequest);
@@ -329,17 +338,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidValueReleaseCountry_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- ReleaseInfo = bookRequest.Metadata.ReleaseInfo! with { ReleaseCountry = "test" }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(releaseCountry: "test")));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.CountryCodeMustBe2CharactersLong.Description);
@@ -349,8 +351,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyReleaseVersion_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { ReleaseInfo = bookRequest.Metadata.ReleaseInfo! with { ReleaseVersion = null! } } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(includeReleaseVersion: false)));
// Act & Assert
await AssertCreated(bookRequest);
@@ -360,17 +361,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidValueReleasVersion_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- ReleaseInfo = bookRequest.Metadata.ReleaseInfo! with { ReleaseVersion = new Faker().Random.String2(100) }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(releaseVersion: new Faker().Random.String2(100))));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.ReleaseVersionMustBeMaximum50CharactersLong.Description);
@@ -380,16 +374,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenReReleaseYearIsAfterOriginalReleaseYear_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- ReleaseInfo = bookRequest.Metadata.ReleaseInfo!
- with
- { OriginalReleaseYear = 2000, OriginalReleaseDate = new DateOnly(2000, 1, 1), ReReleaseYear = 2001, ReReleaseDate = new DateOnly(2001, 1, 1) }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2000, 1, 1), originalReleaseYear: 2000, reReleaseDate: new DateOnly(2001, 1, 1), reReleaseYear: 2001)));
// Act & Assert
await AssertCreated(bookRequest);
@@ -399,19 +384,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenReReleaseYearIsBeforeReleaseYear_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- ReleaseInfo = bookRequest.Metadata.ReleaseInfo!
- with
- { OriginalReleaseYear = 2001, OriginalReleaseDate = new DateOnly(2001, 1, 1), ReReleaseYear = 2000, ReReleaseDate = new DateOnly(2000, 1, 1) }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2001, 1, 1), originalReleaseYear: 2001, reReleaseDate: new DateOnly(2000, 1, 1), reReleaseYear: 2000)));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.ReReleaseYearCannotBeEarlierThanOriginalReleaseYear.Description);
@@ -421,16 +397,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenReReleaseDateIsAfterOriginalReleaseDate_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- ReleaseInfo = bookRequest.Metadata.ReleaseInfo!
- with
- { OriginalReleaseYear = 2000, OriginalReleaseDate = new DateOnly(2000, 1, 1), ReReleaseYear = 2001, ReReleaseDate = new DateOnly(2001, 1, 1) }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2000, 1, 1), originalReleaseYear: 2000, reReleaseDate: new DateOnly(2001, 1, 1), reReleaseYear: 2001)));
// Act & Assert
await AssertCreated(bookRequest);
@@ -440,19 +407,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenReReleaseDateIsBeforeReleaseDate_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- ReleaseInfo = bookRequest.Metadata.ReleaseInfo!
- with
- { OriginalReleaseYear = 2001, OriginalReleaseDate = new DateOnly(2001, 1, 1), ReReleaseYear = 2000, ReReleaseDate = new DateOnly(2000, 1, 1) }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2001, 1, 1), originalReleaseYear: 2001, reReleaseDate: new DateOnly(2000, 1, 1), reReleaseYear: 2000)));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.ReReleaseDateCannotBeEarlierThanOriginalReleaseDate.Description);
@@ -462,11 +420,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNullGenres_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { Genres = null! } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(includeGenres: false));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.GenresListCannotBeNull.Description);
@@ -476,17 +433,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyGenreName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- Genres = [.. bookRequest.Metadata.Genres!.Select((genre, index) => index == 0 ? genre with { Name = null } : genre)]
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(genres: [_genreDtoFixture.Create(includeName: false)]));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.GenreNameCannotBeEmpty.Description);
@@ -496,16 +446,9 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthGenreName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- Genres = [.. bookRequest.Metadata.Genres!.Select((genre, index) => index == 0 ? genre with { Name = new Faker().Random.String2(100) } : genre)]
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(genres: [_genreDtoFixture.Create(name: new Faker().Random.String2(100))]));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.GenreNameMustBeMaximum50CharactersLong.Description);
@@ -515,11 +458,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNullTags_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { Tags = null! } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(includeTags: false));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.TagsListCannotBeNull.Description);
@@ -529,17 +471,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyTagName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- Tags = [.. bookRequest.Metadata.Tags!.Select((tag, index) => index == 0 ? tag with { Name = null } : tag)]
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(tags: [_tagDtoFixture.Create(includeName: false)]));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.TagNameCannotBeEmpty.Description);
@@ -549,16 +484,9 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthTagName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- Tags = [.. bookRequest.Metadata.Tags!.Select((tag, index) => index == 0 ? tag with { Name = new Faker().Random.String2(100) } : tag)]
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(tags: [_tagDtoFixture.Create(name: new Faker().Random.String2(100))]));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.TagNameMustBeMaximum50CharactersLong.Description);
@@ -568,8 +496,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyLanguage_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { Language = null! } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(includeLanguage: false));
// Act & Assert
await AssertCreated(bookRequest);
@@ -579,11 +506,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyLanguageCode_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { Language = bookRequest.Metadata.Language! with { LanguageCode = null } } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(language: _languageInfoDtoFixture.Create(includeLanguageCode: false)));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.LanguageCodeCannotBeEmpty.Description);
@@ -593,20 +519,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthLanguageCode_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- Language = bookRequest.Metadata.Language! with
- {
- LanguageCode = new Faker().Random.String2(10)
- }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(language: _languageInfoDtoFixture.Create(languageCode: new Faker().Random.String2(10))));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.LanguageCodeMustBe2CharactersLong.Description);
@@ -616,11 +532,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyLanguageName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { Language = bookRequest.Metadata.Language! with { LanguageName = null } } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(language: _languageInfoDtoFixture.Create(includeLanguageName: false)));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.LanguageNameCannotBeEmpty.Description);
@@ -630,20 +545,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthLanguageName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- Language = bookRequest.Metadata.Language! with
- {
- LanguageName = new Faker().Random.String2(100)
- }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(language: _languageInfoDtoFixture.Create(languageName: new Faker().Random.String2(100))));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.LanguageNameMustBeMaximum50CharactersLong.Description);
@@ -653,8 +558,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyLanguageNativeName_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { Language = bookRequest.Metadata.Language! with { NativeName = null } } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(language: _languageInfoDtoFixture.Create(includeNativeName: false)));
// Act & Assert
await AssertCreated(bookRequest);
@@ -664,20 +568,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthNativeLanguageName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- Language = bookRequest.Metadata.Language! with
- {
- NativeName = new Faker().Random.String2(100)
- }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(language: _languageInfoDtoFixture.Create(nativeName: new Faker().Random.String2(100))));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.LanguageNativeNameMustBeMaximum50CharactersLong.Description);
@@ -687,8 +581,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyOriginalLanguage_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { OriginalLanguage = null! } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(includeOriginalLanguage: false));
// Act & Assert
await AssertCreated(bookRequest);
@@ -698,11 +591,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyOriginalLanguageCode_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { OriginalLanguage = bookRequest.Metadata.Language! with { LanguageCode = null } } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(originalLanguage: _languageInfoDtoFixture.Create(includeLanguageCode: false)));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.LanguageCodeCannotBeEmpty.Description);
@@ -712,20 +604,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthOriginalLanguageCode_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- OriginalLanguage = bookRequest.Metadata.Language! with
- {
- LanguageCode = new Faker().Random.String2(10)
- }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(originalLanguage: _languageInfoDtoFixture.Create(languageCode: new Faker().Random.String2(10))));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.LanguageCodeMustBe2CharactersLong.Description);
@@ -735,11 +617,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyOriginalLanguageName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { OriginalLanguage = bookRequest.Metadata.Language! with { LanguageName = null } } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(originalLanguage: _languageInfoDtoFixture.Create(includeLanguageName: false)));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.LanguageNameCannotBeEmpty.Description);
@@ -749,20 +630,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthOriginalLanguageName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- OriginalLanguage = bookRequest.Metadata.Language! with
- {
- LanguageName = new Faker().Random.String2(100)
- }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(originalLanguage: _languageInfoDtoFixture.Create(languageName: new Faker().Random.String2(100))));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.LanguageNameMustBeMaximum50CharactersLong.Description);
@@ -772,20 +643,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthOriginalNativeLanguageName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Metadata = bookRequest.Metadata! with
- {
- OriginalLanguage = bookRequest.Metadata.Language! with
- {
- NativeName = new Faker().Random.String2(100)
- }
- }
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(originalLanguage: _languageInfoDtoFixture.Create(nativeName: new Faker().Random.String2(100))));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.LanguageNativeNameMustBeMaximum50CharactersLong.Description);
@@ -795,8 +656,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyOriginalLanguageNativeName_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { OriginalLanguage = bookRequest.Metadata.Language! with { NativeName = null } } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(originalLanguage: _languageInfoDtoFixture.Create(includeNativeName: false)));
// Act & Assert
await AssertCreated(bookRequest);
@@ -806,8 +666,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyPublisher_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { Publisher = null } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(includePublisher: false));
// Act & Assert
await AssertCreated(bookRequest);
@@ -817,11 +676,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthPublisher_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { Publisher = new Faker().Random.String2(150) } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(publisher: new Faker().Random.String2(150)));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.PublisherMustBeMaximum100CharactersLong.Description);
@@ -831,8 +689,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyPageCount_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { PageCount = null } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(includePageCount: false));
// Act & Assert
await AssertCreated(bookRequest);
@@ -842,11 +699,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNegativePageCount_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Metadata = bookRequest.Metadata! with { PageCount = -1 } };
+ AddBookRequest bookRequest = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(pageCount: -1));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.PageCountMustBeGreaterThanZero.Description);
@@ -856,8 +712,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyFormat_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Format = null };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
// Act & Assert
await AssertCreated(bookRequest);
@@ -867,11 +722,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidFormat_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Format = (BookFormat)99 };
+ AddBookRequest bookRequest = _requestBookFixture.Create(format: (BookFormat)99);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.UnknownBookFormat.Description);
@@ -881,8 +735,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyEdition_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Edition = null };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
// Act & Assert
await AssertCreated(bookRequest);
@@ -892,11 +745,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthEdition_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Edition = new Faker().Random.String2(100) };
+ AddBookRequest bookRequest = _requestBookFixture.Create(edition: new Faker().Random.String2(100));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.EditionMustBeMaximum50CharactersLong.Description);
@@ -906,8 +758,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyVolumeNumber_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { VolumeNumber = null };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
// Act & Assert
await AssertCreated(bookRequest);
@@ -917,11 +768,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNegativeVolumeNumber_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { VolumeNumber = -1 };
+ AddBookRequest bookRequest = _requestBookFixture.Create(volumeNumber: -1);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.VolumeNumberMustBeGreaterThanZero.Description);
@@ -932,7 +782,6 @@ public class AddBookEndpointTests : IClassFixture
{
// Arrange
AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Series = null };
// Act & Assert
await AssertCreated(bookRequest);
@@ -973,8 +822,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyAsin_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { ASIN = null };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
// Act & Assert
await AssertCreated(bookRequest);
@@ -984,11 +832,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthAsin_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { ASIN = new Faker().Random.String2(15) };
+ AddBookRequest bookRequest = _requestBookFixture.Create(asin: new Faker().Random.String2(15));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.AsinMustBe10CharactersLong.Description);
@@ -998,8 +845,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyGoodreadsId_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { GoodreadsId = null };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
// Act & Assert
await AssertCreated(bookRequest);
@@ -1009,11 +855,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidGoodreadsId_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { GoodreadsId = new Faker().Random.String2(2) };
+ AddBookRequest bookRequest = _requestBookFixture.Create(goodreadsId: new Faker().Random.String2(2));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.GoodreadsIdMustBeNumeric.Description);
@@ -1023,8 +868,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyLccn_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { LCCN = null };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
// Act & Assert
await AssertCreated(bookRequest);
@@ -1034,11 +878,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLccn_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { LCCN = new Faker().Random.String2(200) };
+ AddBookRequest bookRequest = _requestBookFixture.Create(lccn: new Faker().Random.String2(200));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.InvalidLccnFormat.Description);
@@ -1048,8 +891,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyOclcNumber_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { OCLCNumber = null };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
// Act & Assert
await AssertCreated(bookRequest);
@@ -1059,11 +901,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidOclcNumber_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { OCLCNumber = new Faker().Random.String2(200) };
+ AddBookRequest bookRequest = _requestBookFixture.Create(oclcNumber: new Faker().Random.String2(200));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.InvalidOclcFormat.Description);
@@ -1073,8 +914,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyOpenLibraryId_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { OpenLibraryId = null };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
// Act & Assert
await AssertCreated(bookRequest);
@@ -1084,11 +924,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidOpenLibraryId_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { OpenLibraryId = new Faker().Random.String2(200) };
+ AddBookRequest bookRequest = _requestBookFixture.Create(openLibraryId: new Faker().Random.String2(200));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.InvalidOpenLibraryId.Description);
@@ -1098,8 +937,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyLibraryThingId_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { LibraryThingId = null };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
// Act & Assert
await AssertCreated(bookRequest);
@@ -1109,11 +947,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthLibraryThingId_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { LibraryThingId = new Faker().Random.String2(200) };
+ AddBookRequest bookRequest = _requestBookFixture.Create(libraryThingId: new Faker().Random.String2(200));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.LibraryThingIdMustBeMaximum50CharactersLong.Description);
@@ -1123,8 +960,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyGoogleBooksId_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { GoogleBooksId = null };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
// Act & Assert
await AssertCreated(bookRequest);
@@ -1134,11 +970,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthGoogleBooksId_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { GoogleBooksId = new Faker().Random.String2(20) };
+ AddBookRequest bookRequest = _requestBookFixture.Create(googleBooksId: new Faker().Random.String2(20));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.GoogleBooksIdMustBe12CharactersLong.Description);
@@ -1148,11 +983,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidGoogleBooksId_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { GoogleBooksId = new Faker().Random.String2(11) + " " };
+ AddBookRequest bookRequest = _requestBookFixture.Create(googleBooksId: new Faker().Random.String2(11) + " ");
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.InvalidGoogleBooksIdFormat.Description);
@@ -1162,8 +996,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyBarnesAndNobleId_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { BarnesAndNobleId = null };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
// Act & Assert
await AssertCreated(bookRequest);
@@ -1173,11 +1006,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthBarnesAndNobleId_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { BarnesAndNobleId = new Faker().Random.String2(20) };
+ AddBookRequest bookRequest = _requestBookFixture.Create(barnesAndNobleId: new Faker().Random.String2(20));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.BarnesAndNoblesIdMustBe10CharactersLong.Description);
@@ -1187,11 +1019,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidBarnesAndNobleId_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { BarnesAndNobleId = new Faker().Random.String2(10) };
+ AddBookRequest bookRequest = _requestBookFixture.Create(barnesAndNobleId: new Faker().Random.String2(10));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.InvalidBarnesAndNoblesIdFormat.Description);
@@ -1201,8 +1032,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyAppleBooksId_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { AppleBooksId = null };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
// Act & Assert
await AssertCreated(bookRequest);
@@ -1212,11 +1042,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidAppleBooksId_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { AppleBooksId = new Faker().Random.String2(10) };
+ AddBookRequest bookRequest = _requestBookFixture.Create(appleBooksId: new Faker().Random.String2(10));
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.InvalidAppleBooksIdFormat.Description);
@@ -1226,11 +1055,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNullIsbns_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { ISBNs = null! };
+ AddBookRequest bookRequest = _requestBookFixture.Create(includeOptionalProperties: false);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.IsbnListCannotBeNull.Description);
@@ -1240,14 +1068,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyIsbnValue_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- ISBNs = [.. bookRequest.ISBNs!.Select((isbn, index) => index == 0 ? isbn with { Value = null } : isbn)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [_isbnDtoFixture.Create(value: string.Empty)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.IsbnValueCannotBeEmpty.Description);
@@ -1257,14 +1081,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidIsbn10Value_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- ISBNs = [.. bookRequest.ISBNs!.Select((isbn, index) => index == 0 ? isbn with { Value = new Faker().Random.String2(5), Format = IsbnFormat.Isbn10 } : isbn)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [_isbnDtoFixture.Create(value: new Faker().Random.String2(5), format: IsbnFormat.Isbn10)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.InvalidIsbn10Format.Description);
@@ -1274,14 +1094,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidIsbn13Value_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- ISBNs = [.. bookRequest.ISBNs!.Select((isbn, index) => index == 0 ? isbn with { Value = new Faker().Random.String2(5), Format = IsbnFormat.Isbn13 } : isbn)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [_isbnDtoFixture.Create(value: new Faker().Random.String2(5), format: IsbnFormat.Isbn13)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.InvalidIsbn13Format.Description);
@@ -1291,13 +1107,9 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidIsbnFormat_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- ISBNs = [.. bookRequest.ISBNs!.Select((isbn, index) => index == 0 ? isbn with { Format = (IsbnFormat)99 } : isbn)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [_isbnDtoFixture.Create(format: (IsbnFormat)99)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.WrittenContent.UnknownIsbnFormat.Description);
@@ -1307,11 +1119,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNullContributors_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Contributors = null! };
+ AddBookRequest bookRequest = _requestBookFixture.Create(includeOptionalProperties: false);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.MediaContributor.ContributorsListCannotBeNull.Description);
@@ -1321,14 +1132,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNullContributorName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Contributors = [.. bookRequest.Contributors!.Select((contributor, index) => index == 0 ? contributor with { Name = null! } : contributor)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(contributors: [_mediaContributorDtoFixture.Create(roleName: "author", roleCategory: MediaContributorRoleCategory.Author, includeName: false)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.MediaContributor.ContributorNameCannotBeEmpty.Description);
@@ -1338,14 +1145,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyContributorDisplayName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Contributors = [.. bookRequest.Contributors!.Select((contributor, index) => index == 0 ? contributor with { Name = contributor.Name! with { DisplayName = string.Empty } } : contributor)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(contributors: [_mediaContributorDtoFixture.Create(displayName: string.Empty)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.MediaContributor.ContributorDisplayNameCannotBeEmpty.Description);
@@ -1355,14 +1158,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNullContributorDisplayName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Contributors = [.. bookRequest.Contributors!.Select((contributor, index) => index == 0 ? contributor with { Name = contributor.Name! with { DisplayName = null! } } : contributor)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(contributors: [_mediaContributorDtoFixture.Create(includeDisplayName: false, includeLegalName: false, roleName: "author", roleCategory: MediaContributorRoleCategory.Author)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.MediaContributor.ContributorDisplayNameCannotBeEmpty.Description);
@@ -1372,14 +1171,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthContributorDisplayName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Contributors = [.. bookRequest.Contributors!.Select((contributor, index) => index == 0 ? contributor with { Name = contributor.Name! with { DisplayName = new Faker().Random.String2(150) } } : contributor)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(contributors: [_mediaContributorDtoFixture.Create(displayName: new Faker().Random.String2(150))]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.MediaContributor.ContributorDisplayNameMustBeMaximum100CharactersLong.Description);
@@ -1389,14 +1184,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthContributorLegalName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Contributors = [.. bookRequest.Contributors!.Select((contributor, index) => index == 0 ? contributor with { Name = contributor.Name! with { LegalName = new Faker().Random.String2(150) } } : contributor)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(contributors: [_mediaContributorDtoFixture.Create(displayName: new Faker().Random.String2(50), legalName: new Faker().Random.String2(150), roleName: "author", roleCategory: MediaContributorRoleCategory.Author)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.MediaContributor.ContributorLegalNameMustBeMaximum100CharactersLong.Description);
@@ -1406,14 +1197,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyContributorRole_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Contributors = [.. bookRequest.Contributors!.Select((contributor, index) => index == 0 ? contributor with { Role = null } : contributor)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(contributors: [_mediaContributorDtoFixture.Create(displayName: new Faker().Random.String2(50), includeRole: false)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.MediaContributor.ContributorRoleCannotBeNull.Description);
@@ -1423,15 +1210,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyContributorRoleName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Contributors = [.. bookRequest.Contributors!.Select((contributor, index) => index == 0 ? contributor with
- { Role = contributor.Role! with { Name = null } } : contributor)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(contributors: [_mediaContributorDtoFixture.Create(displayName: new Faker().Random.String2(50), includeRoleName: false, roleCategory: MediaContributorRoleCategory.Author)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.MediaContributor.RoleNameCannotBeEmpty.Description);
@@ -1441,15 +1223,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithInvalidLengthContributorRoleName_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Contributors = [.. bookRequest.Contributors!.Select((contributor, index) => index == 0 ? contributor with
- { Role = contributor.Role! with { Name = new Faker().Random.String2(100) } } : contributor)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(contributors: [_mediaContributorDtoFixture.Create(displayName: new Faker().Random.String2(50), roleName: new Faker().Random.String2(100), roleCategory: MediaContributorRoleCategory.Author)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.MediaContributor.RoleNameMustBeMaximum50CharactersLong.Description);
@@ -1459,15 +1236,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyContributorRoleCategory_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Contributors = [.. bookRequest.Contributors!.Select((contributor, index) => index == 0 ? contributor with
- { Role = contributor.Role! with { Category = null } } : contributor)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(contributors: [_mediaContributorDtoFixture.Create(displayName: new Faker().Random.String2(50), roleName: "author", includeRoleCategory: false)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.MediaContributor.RoleCategoryCannotBeEmpty.Description);
@@ -1477,11 +1249,10 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNullRatings_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with { Ratings = null! };
+ AddBookRequest bookRequest = _requestBookFixture.Create(includeOptionalProperties: false);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.RatingsListCannotBeNull.Description);
@@ -1491,13 +1262,9 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNegativeRatingValue_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Ratings = [.. bookRequest.Ratings!.Select((rating, index) => index == 0 ? rating with { Value = -3 } : rating)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -3)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.RatingValueMustBePositive.Description);
@@ -1507,13 +1274,9 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithRatingValueGreaterThanMaxValue_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Ratings = [.. bookRequest.Ratings!.Select((rating, index) => index == 0 ? rating with { Value = 3, MaxValue = 2 } : rating)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: 3, maxValue: 2)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.RatingValueCannotBeGreaterThanMaxValue.Description);
@@ -1523,13 +1286,9 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNegativeMaxRatingValue_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Ratings = [.. bookRequest.Ratings!.Select((rating, index) => index == 0 ? rating with { MaxValue = -3 } : rating)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(maxValue: -3)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.RatingMaxValueMustBePositive.Description);
@@ -1539,11 +1298,7 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithEmptyRatingVoteCount_ShouldAddBook()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Ratings = [.. bookRequest.Ratings!.Select((rating, index) => index == 0 ? rating with { VoteCount = null } : rating)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(source: BookRatingSource.Goodreads, includeOptionalProperties: false)]);
// Act & Assert
await AssertCreated(bookRequest);
}
@@ -1552,18 +1307,56 @@ public class AddBookEndpointTests : IClassFixture
public async Task AddBook_WhenCalledWithNegativeVoteCount_ShouldReturnUnprocessableEntity()
{
// Arrange
- AddBookRequest bookRequest = _requestBookFixture.Create();
- bookRequest = bookRequest with
- {
- Ratings = [.. bookRequest.Ratings!.Select((rating, index) => index == 0 ? rating with { VoteCount = -3 } : rating)]
- };
+ AddBookRequest bookRequest = _requestBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(voteCount: -3)]);
// Act
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
// Assert
await AssertUnprocessableEntityWithValidationErrors(response, Errors.Metadata.RatingVoteCountMustBePositive.Description);
}
+ [Fact]
+ public async Task AddBook_WhenTwoContributorsShareTheSameDisplayName_ShouldCreateOneContributorWithTwoBookLinks()
+ {
+ // Arrange
+ AddBookRequest bookRequest = _requestBookFixture.Create(contributors:
+ [
+ _mediaContributorDtoFixture.Create(displayName: "Duplicated Author", legalName: "Duplicated Author Legal", roleName: "author", roleCategory: MediaContributorRoleCategory.Author),
+ _mediaContributorDtoFixture.Create(displayName: "Duplicated Author", legalName: "Duplicated Author Legal", roleName: "illustrator", roleCategory: MediaContributorRoleCategory.Illustrator)
+ ]);
+
+ // Act
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
+
+ // Assert
+ response.EnsureSuccessStatusCode();
+ Assert.Equal(HttpStatusCode.Created, response.StatusCode);
+ Book? bookResponse = await response.Content.ReadFromJsonAsync(_jsonOptions);
+ Assert.NotNull(bookResponse);
+
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ MediaContributorEntity contributor = dbContext.MediaContributors.Single(mediaContributor => mediaContributor.DisplayName == "Duplicated Author");
+ List links = [.. dbContext.Books
+ .Include(book => book.BookContributors)
+ .Single(book => book.Id == bookResponse!.Id.Value)
+ .BookContributors];
+ Assert.Equal(2, links.Count);
+ Assert.All(links, link => Assert.Equal(contributor.Id, link.MediaContributorId));
+ Assert.Contains(links, link => link.RoleName == "author");
+ Assert.Contains(links, link => link.RoleName == "illustrator");
+ }
+
+ ///
+ /// Posts a request to add a book to the media library owned by the authenticated user of the current test.
+ ///
+ /// The request to post.
+ /// The HTTP response of the POST request.
+ private Task PostBookAsync(AddBookRequest request)
+ {
+ return _client.PostAsJsonAsync("/api/v1/books", request with { LibraryId = _libraryId });
+ }
+
private async Task AssertUnprocessableEntityWithValidationErrors(HttpResponseMessage response, params string[] expectedErrorCodes)
{
Assert.Equal(HttpStatusCode.UnprocessableContent, response.StatusCode);
@@ -1588,7 +1381,7 @@ public class AddBookEndpointTests : IClassFixture
private async Task AssertCreated(AddBookRequest bookRequest)
{
- HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/books", bookRequest);
+ HttpResponseMessage response = await PostBookAsync(bookRequest);
response.EnsureSuccessStatusCode();
Book? bookResponse = await response.Content.ReadFromJsonAsync(_jsonOptions);
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs
index 36a07376..d0f1196e 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs
@@ -1,10 +1,25 @@
#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
+using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
+using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management;
+using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
+using Lumina.Application.Fixtures.Common.DataAccess.Entities.UsersManagement;
+using Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
+using Lumina.DataAccess.Core.UoW;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using Lumina.Presentation.Api.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.GetBook;
using Lumina.Presentation.Api.IntegrationTests.Common.Setup;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.DependencyInjection;
using System;
using System.Diagnostics.CodeAnalysis;
+using System.Linq;
using System.Net;
using System.Net.Http;
+using System.Net.Http.Json;
+using System.Text.Json;
+using System.Text.Json.Serialization;
using System.Threading.Tasks;
#endregion
@@ -18,6 +33,14 @@ public class GetBookEndpointTests : IClassFixture
{
private HttpClient _client;
private readonly AuthenticatedLuminaApiFactory _apiFactory;
+ private readonly JsonSerializerOptions _jsonOptions = new()
+ {
+ PropertyNameCaseInsensitive = true,
+ Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
+ };
+ private readonly BookEntityFixture _bookEntityFixture = new();
+ private readonly LibraryEntityFixture _libraryEntityFixture = new();
+ private readonly UserEntityFixture _userEntityFixture = new();
///
/// Initializes a new instance of the class.
@@ -38,16 +61,118 @@ public class GetBookEndpointTests : IClassFixture
}
[Fact]
- public async Task GetBook_WhenCalled_ShouldReturnOk()
+ public async Task GetBook_WhenBookBelongsToAnOwnedLibrary_ShouldReturnBookDetails()
{
// Arrange
- Guid bookId = Guid.NewGuid();
+ Guid userId = GetCurrentUserId();
+ (Guid libraryId, Guid bookId) = await SeedLibraryAndBookAsync(userId, "Test Book");
// Act
HttpResponseMessage response = await _client.GetAsync($"/api/v1/books/{bookId}");
// Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ BookResponse? book = JsonSerializer.Deserialize(content, _jsonOptions);
+ Assert.NotNull(book);
+ Assert.Equal(bookId, book!.Id);
+ Assert.Equal(libraryId, book.LibraryId);
+ Assert.Equal("Test Book", book.Metadata!.Title);
+ Assert.Equal($"/books/{bookId:N}.epub", book.Path);
+ }
+
+ [Fact]
+ public async Task GetBook_WhenBookDoesNotExist_ShouldReturnBookNotFoundProblem()
+ {
+ // Act
+ HttpResponseMessage response = await _client.GetAsync($"/api/v1/books/{Guid.NewGuid()}");
+
+ // Assert
+ Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ Microsoft.AspNetCore.Mvc.ProblemDetails? problemDetails = JsonSerializer.Deserialize(content, _jsonOptions);
+ Assert.NotNull(problemDetails);
+ Assert.Equal("General.NotFound", problemDetails!.Title);
+ Assert.Equal("BookNotFound", problemDetails.Detail);
+ Assert.DoesNotContain("Exception", content, StringComparison.Ordinal);
+ }
+
+ [Fact]
+ public async Task GetBook_WhenBookBelongsToAnotherUserLibrary_ShouldReturnForbiddenProblem()
+ {
+ // Arrange
+ (Guid otherUserId, _) = await SeedOtherUserAsync();
+ (_, Guid bookId) = await SeedLibraryAndBookAsync(otherUserId, "Other User Book");
+
+ // Act
+ HttpResponseMessage response = await _client.GetAsync($"/api/v1/books/{bookId}");
+
+ // Assert
+ Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
+ using JsonDocument problemDetails = JsonDocument.Parse(await response.Content.ReadAsStringAsync());
+ Assert.Equal("General.Unauthorized", problemDetails.RootElement.GetProperty("title").GetString());
+ Assert.Equal("NotAuthorized", problemDetails.RootElement.GetProperty("detail").GetString());
+ Assert.DoesNotContain("Exception", problemDetails.RootElement.GetRawText(), StringComparison.Ordinal);
+ }
+
+ [Fact]
+ public async Task GetBook_WhenUnauthorized_ShouldReturnUnauthorizedResult()
+ {
+ // Arrange
+ HttpClient unauthenticatedClient = _apiFactory.CreateClient();
+
+ // Act
+ HttpResponseMessage response = await unauthenticatedClient.GetAsync($"/api/v1/books/{Guid.NewGuid()}");
+
+ // Assert
+ Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
+ }
+
+ ///
+ /// Seeds a library owned by and a book belonging to it.
+ ///
+ /// The Id of the user that owns the library.
+ /// The title of the seeded book.
+ /// The Ids of the seeded library and book.
+ private async Task<(Guid libraryId, Guid bookId)> SeedLibraryAndBookAsync(Guid userId, string title)
+ {
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ Guid libraryId = Guid.NewGuid();
+ Guid bookId = Guid.NewGuid();
+ LibraryEntity library = _libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Test Library", libraryType: LibraryType.EBook, contentLocations: []);
+ BookEntity book = _bookEntityFixture.Create(id: bookId, libraryId: libraryId, path: $"/books/{bookId:N}.epub", title: title, includeMetadata: false);
+ dbContext.Libraries.Add(library);
+ dbContext.Books.Add(book);
+ await dbContext.SaveChangesAsync();
+ return (libraryId, bookId);
+ }
+
+ ///
+ /// Seeds a user distinct from the authenticated test user and returns its Id.
+ ///
+ /// The Id of the seeded user and its username.
+ private async Task<(Guid userId, string username)> SeedOtherUserAsync()
+ {
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ Guid userId = Guid.NewGuid();
+ string username = $"otheruser_{Guid.NewGuid()}";
+ dbContext.Users.Add(_userEntityFixture.Create(id: userId, username: username, password: "TestPass123!"));
+ await dbContext.SaveChangesAsync();
+ return (userId, username);
+ }
+
+ ///
+ /// Gets the Id of the currently authenticated test user.
+ ///
+ /// The Id of the authenticated test user.
+ private Guid GetCurrentUserId()
+ {
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ UserEntity user = dbContext.Users.First(user => user.Username == _apiFactory.TestUsername);
+ return user.Id;
}
///
diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs
index 17d95071..82e937fb 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs
@@ -22,7 +22,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.Reading.GetReadingAvailability;
///
-/// Contains integration tests for the /books/{bookId}/reading/availability route.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetReadingAvailabilityEndpointTests : IClassFixture, IAsyncLifetime
diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingManifest/GetReadingManifestEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingManifest/GetReadingManifestEndpointTests.cs
index 3a954ded..7fb86434 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingManifest/GetReadingManifestEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingManifest/GetReadingManifestEndpointTests.cs
@@ -19,7 +19,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.Reading.GetReadingManifest;
///
-/// Contains integration tests for the /books/{bookId}/reading/manifest route.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetReadingManifestEndpointTests : IClassFixture, IAsyncLifetime
diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs
index d2f7a13a..a2db9592 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs
@@ -19,7 +19,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.Reading.GetReadingResource;
///
-/// Contains integration tests for the /books/{bookId}/reading/resources/{resourceKey} route.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetReadingResourceEndpointTests : IClassFixture, IAsyncLifetime
diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs
index 888b8e42..209f6ddd 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs
@@ -19,7 +19,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.Reading.GetReadingSection;
///
-/// Contains integration tests for the /books/{bookId}/reading/sections/{locationRef} route.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetReadingSectionEndpointTests : IClassFixture, IAsyncLifetime
diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBook/UpdateBookEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBook/UpdateBookEndpointTests.cs
new file mode 100644
index 00000000..a7ae66b2
--- /dev/null
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBook/UpdateBookEndpointTests.cs
@@ -0,0 +1,298 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.DataAccess.Entities.MediaContributors;
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
+using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
+using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management;
+using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
+using Lumina.Application.Fixtures.Common.DataAccess.Entities.UsersManagement;
+using Lumina.Contracts.DTO.MediaContributors;
+using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary;
+using Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
+using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
+using Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
+using Lumina.DataAccess.Core.UoW;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
+using Lumina.Presentation.Api.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.UpdateBook;
+using Lumina.Presentation.Api.IntegrationTests.Common.Setup;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Json;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.UpdateBook;
+
+///
+/// Contains integration tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class UpdateBookEndpointTests : IClassFixture, IAsyncLifetime
+{
+ private HttpClient _client;
+ private readonly AuthenticatedLuminaApiFactory _apiFactory;
+ private readonly JsonSerializerOptions _jsonOptions = new()
+ {
+ PropertyNameCaseInsensitive = true,
+ Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
+ };
+ private readonly UpdateBookRequestFixture _requestBookFixture = new();
+ private readonly WrittenContentMetadataDtoFixture _writtenContentMetadataDtoFixture = new();
+ private readonly BookEntityFixture _bookEntityFixture = new();
+ private readonly LibraryEntityFixture _libraryEntityFixture = new();
+ private readonly UserEntityFixture _userEntityFixture = new();
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected in-memory API factory.
+ public UpdateBookEndpointTests(AuthenticatedLuminaApiFactory apiFactory)
+ {
+ _client = apiFactory.CreateClient();
+ _apiFactory = apiFactory;
+ }
+
+ ///
+ /// Initializes authenticated API client.
+ ///
+ public async Task InitializeAsync()
+ {
+ _client = await _apiFactory.CreateAuthenticatedClientAsync();
+ }
+
+ [Fact]
+ public async Task UpdateBook_WhenCalledByOwnerWithValidData_ShouldUpdateBookAndPersistChanges()
+ {
+ // Arrange
+ Guid userId = GetCurrentUserId();
+ (Guid libraryId, Guid bookId) = await SeedLibraryAndBookAsync(userId, "Original Title");
+ UpdateBookRequest request = _requestBookFixture.Create(id: bookId, metadata: _writtenContentMetadataDtoFixture.Create(title: "Updated Title"), isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
+
+ // Act
+ HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/books/{bookId}", request);
+
+ // Assert
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ BookResponse? bookResponse = JsonSerializer.Deserialize(content, _jsonOptions);
+ Assert.NotNull(bookResponse);
+ Assert.Equal(bookId, bookResponse!.Id);
+ Assert.Equal(libraryId, bookResponse.LibraryId);
+ Assert.Equal("Updated Title", bookResponse.Metadata!.Title);
+
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ BookEntity storedBook = dbContext.Books.Single(book => book.Id == bookId);
+ Assert.Equal("Updated Title", storedBook.Title);
+ }
+
+ [Fact]
+ public async Task UpdateBook_WhenTwoContributorsShareTheSameDisplayName_ShouldCreateOneContributorWithTwoBookLinks()
+ {
+ // Arrange
+ Guid userId = GetCurrentUserId();
+ (_, Guid bookId) = await SeedLibraryAndBookAsync(userId, "Original Title");
+ List duplicatedContributors =
+ [
+ new MediaContributorDto(
+ new MediaContributorNameDto("Duplicated Author", "Duplicated Author Legal"),
+ new MediaContributorRoleDto("author", MediaContributorRoleCategory.Author)),
+ new MediaContributorDto(
+ new MediaContributorNameDto("Duplicated Author", "Duplicated Author Legal"),
+ new MediaContributorRoleDto("illustrator", MediaContributorRoleCategory.Illustrator))
+ ];
+ UpdateBookRequest request = _requestBookFixture.Create(id: bookId, contributors: duplicatedContributors, isbns: [], ratings: [], includeOptionalProperties: false);
+
+ // Act
+ HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/books/{bookId}", request);
+
+ // Assert
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ MediaContributorEntity contributor = dbContext.MediaContributors.Single(mediaContributor => mediaContributor.DisplayName == "Duplicated Author");
+ List links = dbContext.Books
+ .Include(book => book.BookContributors)
+ .Single(book => book.Id == bookId)
+ .BookContributors
+ .ToList();
+ Assert.Equal(2, links.Count);
+ Assert.All(links, link => Assert.Equal(contributor.Id, link.MediaContributorId));
+ Assert.Contains(links, link => link.RoleName == "author");
+ Assert.Contains(links, link => link.RoleName == "illustrator");
+ }
+
+ [Fact]
+ public async Task UpdateBook_WhenRouteBookDoesNotExistButBodyIdExists_ShouldNotUpdateTheBodyBook()
+ {
+ // Arrange
+ Guid userId = GetCurrentUserId();
+ (Guid libraryId, Guid bodyBookId) = await SeedLibraryAndBookAsync(userId, "Body Book Title");
+ Guid routeId = Guid.NewGuid();
+ UpdateBookRequest request = _requestBookFixture.Create(id: bodyBookId, metadata: _writtenContentMetadataDtoFixture.Create(title: "Should Not Apply"));
+
+ // Act
+ HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/books/{routeId}", request);
+
+ // Assert
+ Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase);
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ BookEntity storedBook = dbContext.Books.Single(book => book.Id == bodyBookId);
+ Assert.Equal("Body Book Title", storedBook.Title);
+ }
+
+ [Fact]
+ public async Task UpdateBook_WhenRouteIdIsNotParseable_ShouldReturnUnprocessableEntity()
+ {
+ // Arrange
+ UpdateBookRequest request = _requestBookFixture.Create();
+
+ // Act
+ HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/books/not-a-guid", request);
+
+ // Assert
+ // The route value is kept as a raw string, so the unparseable Id becomes Guid.Empty in the command mapping and the
+ // command validator reports a clean validation error instead of failing the request binding.
+ Assert.Equal(HttpStatusCode.UnprocessableEntity, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ using JsonDocument problemDetails = JsonDocument.Parse(content);
+ Assert.Equal("General.Validation", problemDetails.RootElement.GetProperty("title").GetString());
+ Assert.Contains("BookIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase);
+ }
+
+ [Fact]
+ public async Task UpdateBook_WhenBookDoesNotExist_ShouldReturnBookNotFoundProblem()
+ {
+ // Arrange
+ UpdateBookRequest request = _requestBookFixture.Create();
+
+ // Act
+ HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/books/{Guid.NewGuid()}", request);
+
+ // Assert
+ Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ using JsonDocument problemDetails = JsonDocument.Parse(content);
+ Assert.Equal("General.NotFound", problemDetails.RootElement.GetProperty("title").GetString());
+ Assert.Equal("BookNotFound", problemDetails.RootElement.GetProperty("detail").GetString());
+ }
+
+ [Fact]
+ public async Task UpdateBook_WhenBookBelongsToAnotherUserLibrary_ShouldReturnForbiddenProblem()
+ {
+ // Arrange
+ (Guid otherUserId, _) = await SeedOtherUserAsync();
+ (_, Guid bookId) = await SeedLibraryAndBookAsync(otherUserId, "Other User Book");
+ UpdateBookRequest request = _requestBookFixture.Create(id: bookId);
+
+ // Act
+ HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/books/{bookId}", request);
+
+ // Assert
+ Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ using JsonDocument problemDetails = JsonDocument.Parse(content);
+ Assert.Equal("General.Unauthorized", problemDetails.RootElement.GetProperty("title").GetString());
+ Assert.Equal("NotAuthorized", problemDetails.RootElement.GetProperty("detail").GetString());
+ }
+
+ [Fact]
+ public async Task UpdateBook_WhenCalledWithInvalidBody_ShouldReturnUnprocessableEntity()
+ {
+ // Arrange
+ Guid userId = GetCurrentUserId();
+ (_, Guid bookId) = await SeedLibraryAndBookAsync(userId, "Original Title");
+ UpdateBookRequest request = _requestBookFixture.Create(id: bookId, metadata: _writtenContentMetadataDtoFixture.Create(includeTitle: false));
+
+ // Act
+ HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/books/{bookId}", request);
+
+ // Assert
+ Assert.Equal(HttpStatusCode.UnprocessableEntity, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ using JsonDocument problemDetails = JsonDocument.Parse(content);
+ Assert.Equal("General.Validation", problemDetails.RootElement.GetProperty("title").GetString());
+ Assert.Contains("TitleCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase);
+ }
+
+ [Fact]
+ public async Task UpdateBook_WhenUnauthorized_ShouldReturnUnauthorizedResult()
+ {
+ // Arrange
+ HttpClient unauthenticatedClient = _apiFactory.CreateClient();
+ UpdateBookRequest request = _requestBookFixture.Create();
+
+ // Act
+ HttpResponseMessage response = await unauthenticatedClient.PutAsJsonAsync($"/api/v1/books/{Guid.NewGuid()}", request);
+
+ // Assert
+ Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
+ }
+
+ ///
+ /// Seeds a library owned by and a book belonging to it.
+ ///
+ /// The Id of the user that owns the library.
+ /// The title of the seeded book.
+ /// The Ids of the seeded library and book.
+ private async Task<(Guid libraryId, Guid bookId)> SeedLibraryAndBookAsync(Guid userId, string title)
+ {
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ Guid libraryId = Guid.NewGuid();
+ Guid bookId = Guid.NewGuid();
+ LibraryEntity library = _libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Test Library", libraryType: LibraryType.EBook, contentLocations: []);
+ BookEntity book = _bookEntityFixture.Create(id: bookId, libraryId: libraryId, path: $"/books/{bookId:N}.epub", title: title, includeMetadata: false);
+ dbContext.Libraries.Add(library);
+ dbContext.Books.Add(book);
+ await dbContext.SaveChangesAsync();
+ return (libraryId, bookId);
+ }
+
+ ///
+ /// Seeds a user distinct from the authenticated test user and returns its Id.
+ ///
+ /// The Id of the seeded user and its username.
+ private async Task<(Guid userId, string username)> SeedOtherUserAsync()
+ {
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ Guid userId = Guid.NewGuid();
+ string username = $"otheruser_{Guid.NewGuid()}";
+ dbContext.Users.Add(_userEntityFixture.Create(id: userId, username: username, password: "TestPass123!"));
+ await dbContext.SaveChangesAsync();
+ return (userId, username);
+ }
+
+ ///
+ /// Gets the Id of the currently authenticated test user.
+ ///
+ /// The Id of the authenticated test user.
+ private Guid GetCurrentUserId()
+ {
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ UserEntity user = dbContext.Users.First(user => user.Username == _apiFactory.TestUsername);
+ return user.Id;
+ }
+
+ ///
+ /// Disposes API factory resources.
+ ///
+ public async Task DisposeAsync()
+ {
+ await _apiFactory.RemoveTestUserAsync();
+ }
+}
diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs
new file mode 100644
index 00000000..793b9e09
--- /dev/null
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs
@@ -0,0 +1,266 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.DataAccess.Entities.MediaContributors;
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
+using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
+using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management;
+using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
+using Lumina.Application.Fixtures.Common.DataAccess.Entities.UsersManagement;
+using Lumina.DataAccess.Core.UoW;
+using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
+using Lumina.Presentation.Api.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.UpdateBookCover;
+using Lumina.Presentation.Api.IntegrationTests.Common.Setup;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text.Json;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.UpdateBookCover;
+
+///
+/// Contains integration tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class UpdateBookCoverEndpointTests : IClassFixture, IAsyncLifetime
+{
+ private HttpClient _client;
+ private readonly AuthenticatedLuminaApiFactory _apiFactory;
+ private readonly BookEntityFixture _bookEntityFixture = new();
+ private readonly BookArtworkEntityFixture _bookArtworkEntityFixture = new();
+ private readonly LibraryEntityFixture _libraryEntityFixture = new();
+ private readonly UserEntityFixture _userEntityFixture = new();
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected in-memory API factory.
+ public UpdateBookCoverEndpointTests(AuthenticatedLuminaApiFactory apiFactory)
+ {
+ _client = apiFactory.CreateClient();
+ _apiFactory = apiFactory;
+ }
+
+ ///
+ /// Initializes authenticated API client.
+ ///
+ public async Task InitializeAsync()
+ {
+ _client = await _apiFactory.CreateAuthenticatedClientAsync();
+ }
+
+ [Fact]
+ public async Task UpdateBookCover_WhenCalledByOwnerWithValidImage_ShouldReplaceTheStoredCover()
+ {
+ // Arrange
+ Guid userId = GetCurrentUserId();
+ (Guid libraryId, Guid bookId) = await SeedLibraryAndBookWithCoverAsync(userId, "/media/books/old-cover.jpg");
+
+ // Act
+ HttpResponseMessage response = await _client.PutAsync($"/api/v1/books/{bookId}/cover", CreateCoverForm("cover.png"));
+
+ // Assert
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ string storedPath = JsonSerializer.Deserialize(content)!;
+ Assert.False(string.IsNullOrWhiteSpace(storedPath));
+ Assert.Contains("cover.png", storedPath, StringComparison.OrdinalIgnoreCase);
+
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ BookArtworkEntity coverArtwork = dbContext.Books
+ .SelectMany(book => book.BookArtwork)
+ .Single(artwork => artwork.BookId == bookId && artwork.ArtworkType == ArtworkType.Cover);
+ Assert.Equal(storedPath, coverArtwork.FileName);
+ Assert.Equal(ArtworkStatus.Enriched, coverArtwork.Status);
+ }
+
+ [Fact]
+ public async Task UpdateBookCover_WhenBookHasNoExistingCover_ShouldCreateACoverArtwork()
+ {
+ // Arrange
+ Guid userId = GetCurrentUserId();
+ (_, Guid bookId) = await SeedLibraryAndBookAsync(userId);
+
+ // Act
+ HttpResponseMessage response = await _client.PutAsync($"/api/v1/books/{bookId}/cover", CreateCoverForm("cover.png"));
+
+ // Assert
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ string storedPath = JsonSerializer.Deserialize(content)!;
+ Assert.False(string.IsNullOrWhiteSpace(storedPath));
+
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ BookArtworkEntity coverArtwork = dbContext.Books
+ .SelectMany(book => book.BookArtwork)
+ .Single(artwork => artwork.BookId == bookId && artwork.ArtworkType == ArtworkType.Cover);
+ Assert.Equal(storedPath, coverArtwork.FileName);
+ }
+
+ [Fact]
+ public async Task UpdateBookCover_WhenBookDoesNotExist_ShouldReturnBookNotFoundProblem()
+ {
+ // Act
+ HttpResponseMessage response = await _client.PutAsync($"/api/v1/books/{Guid.NewGuid()}/cover", CreateCoverForm("cover.png"));
+
+ // Assert
+ Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ using JsonDocument problemDetails = JsonDocument.Parse(content);
+ Assert.Equal("General.NotFound", problemDetails.RootElement.GetProperty("title").GetString());
+ Assert.Equal("BookNotFound", problemDetails.RootElement.GetProperty("detail").GetString());
+ }
+
+ [Fact]
+ public async Task UpdateBookCover_WhenRouteIdIsNotParseable_ShouldReturnUnprocessableEntity()
+ {
+ // Act
+ HttpResponseMessage response = await _client.PutAsync($"/api/v1/books/not-a-guid/cover", CreateCoverForm("cover.png"));
+
+ // Assert
+ Assert.Equal(HttpStatusCode.UnprocessableEntity, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ using JsonDocument problemDetails = JsonDocument.Parse(content);
+ Assert.Equal("General.Validation", problemDetails.RootElement.GetProperty("title").GetString());
+ Assert.Contains("BookIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase);
+ }
+
+ [Fact]
+ public async Task UpdateBookCover_WhenBookBelongsToAnotherUserLibrary_ShouldReturnForbiddenProblem()
+ {
+ // Arrange
+ (Guid otherUserId, _) = await SeedOtherUserAsync();
+ (_, Guid bookId) = await SeedLibraryAndBookAsync(otherUserId);
+
+ // Act
+ HttpResponseMessage response = await _client.PutAsync($"/api/v1/books/{bookId}/cover", CreateCoverForm("cover.png"));
+
+ // Assert
+ Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
+ string content = await response.Content.ReadAsStringAsync();
+ using JsonDocument problemDetails = JsonDocument.Parse(content);
+ Assert.Equal("General.Unauthorized", problemDetails.RootElement.GetProperty("title").GetString());
+ Assert.Equal("NotAuthorized", problemDetails.RootElement.GetProperty("detail").GetString());
+ }
+
+ [Fact]
+ public async Task UpdateBookCover_WhenUnauthorized_ShouldReturnUnauthorizedResult()
+ {
+ // Arrange
+ HttpClient unauthenticatedClient = _apiFactory.CreateClient();
+
+ // Act
+ HttpResponseMessage response = await unauthenticatedClient.PutAsync($"/api/v1/books/{Guid.NewGuid()}/cover", CreateCoverForm("cover.png"));
+
+ // Assert
+ Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
+ }
+
+ ///
+ /// Creates a multipart form carrying a minimal PNG-like payload.
+ ///
+ /// The name of the uploaded file.
+ /// A configured instance.
+ private static MultipartFormDataContent CreateCoverForm(string fileName)
+ {
+ // The payload only needs to carry the PNG signature in its first bytes and exceed the header detection buffer.
+ byte[] payload = new byte[100];
+ payload[0] = 137;
+ payload[1] = 80;
+ payload[2] = 78;
+ payload[3] = 71;
+ payload[4] = 13;
+ payload[5] = 10;
+ payload[6] = 26;
+ payload[7] = 10;
+ MultipartFormDataContent form = [];
+ ByteArrayContent fileContent = new(payload);
+ fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
+ form.Add(fileContent, "cover", fileName);
+ return form;
+ }
+
+ ///
+ /// Seeds a library owned by and a book with an existing cover belonging to it.
+ ///
+ /// The Id of the user that owns the library.
+ /// The relative path of the existing cover of the book.
+ /// The Ids of the seeded library and book.
+ private async Task<(Guid libraryId, Guid bookId)> SeedLibraryAndBookWithCoverAsync(Guid userId, string existingCoverFileName)
+ {
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ Guid libraryId = Guid.NewGuid();
+ Guid bookId = Guid.NewGuid();
+ LibraryEntity library = _libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Test Library", libraryType: LibraryType.EBook, contentLocations: []);
+ BookEntity book = _bookEntityFixture.Create(id: bookId, libraryId: libraryId, path: $"/books/{bookId:N}.epub", title: "Test Book", includeMetadata: false);
+ BookArtworkEntity existingCover = _bookArtworkEntityFixture.Create(bookId: bookId, artworkType: ArtworkType.Cover, fileName: existingCoverFileName, status: ArtworkStatus.Enriched);
+ book.BookArtwork.Add(existingCover);
+ dbContext.Libraries.Add(library);
+ dbContext.Books.Add(book);
+ await dbContext.SaveChangesAsync();
+ return (libraryId, bookId);
+ }
+
+ ///
+ /// Seeds a library owned by and a book belonging to it.
+ ///
+ /// The Id of the user that owns the library.
+ /// The Ids of the seeded library and book.
+ private async Task<(Guid libraryId, Guid bookId)> SeedLibraryAndBookAsync(Guid userId)
+ {
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ Guid libraryId = Guid.NewGuid();
+ Guid bookId = Guid.NewGuid();
+ LibraryEntity library = _libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Test Library", libraryType: LibraryType.EBook, contentLocations: []);
+ BookEntity book = _bookEntityFixture.Create(id: bookId, libraryId: libraryId, path: $"/books/{bookId:N}.epub", title: "Test Book", includeMetadata: false);
+ dbContext.Libraries.Add(library);
+ dbContext.Books.Add(book);
+ await dbContext.SaveChangesAsync();
+ return (libraryId, bookId);
+ }
+
+ ///
+ /// Seeds a user distinct from the authenticated test user and returns its Id.
+ ///
+ /// The Id of the seeded user and its username.
+ private async Task<(Guid userId, string username)> SeedOtherUserAsync()
+ {
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ Guid userId = Guid.NewGuid();
+ string username = $"otheruser_{Guid.NewGuid()}";
+ dbContext.Users.Add(_userEntityFixture.Create(id: userId, username: username, password: "TestPass123!"));
+ await dbContext.SaveChangesAsync();
+ return (userId, username);
+ }
+
+ ///
+ /// Gets the Id of the currently authenticated test user.
+ ///
+ /// The Id of the authenticated test user.
+ private Guid GetCurrentUserId()
+ {
+ using IServiceScope scope = _apiFactory.Services.CreateScope();
+ LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService();
+ UserEntity user = dbContext.Users.First(user => user.Username == _apiFactory.TestUsername);
+ return user.Id;
+ }
+
+ ///
+ /// Disposes API factory resources.
+ ///
+ public async Task DisposeAsync()
+ {
+ await _apiFactory.RemoveTestUserAsync();
+ }
+}
diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetLibraryBookReaders/GetLibraryBookReadersEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetLibraryBookReaders/GetLibraryBookReadersEndpointTests.cs
index 3b78fff4..f6c52213 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetLibraryBookReaders/GetLibraryBookReadersEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetLibraryBookReaders/GetLibraryBookReadersEndpointTests.cs
@@ -23,7 +23,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.Plugins.GetLibraryBookReaders;
///
-/// Contains integration tests for the /libraries/{libraryId}/book-readers route.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetLibraryBookReadersEndpointTests : IClassFixture, IAsyncLifetime
diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/SetLibraryBookReaderEnabled/SetLibraryBookReaderEnabledEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/SetLibraryBookReaderEnabled/SetLibraryBookReaderEnabledEndpointTests.cs
index 8003d20f..17dff07f 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/SetLibraryBookReaderEnabled/SetLibraryBookReaderEnabledEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/SetLibraryBookReaderEnabled/SetLibraryBookReaderEnabledEndpointTests.cs
@@ -23,7 +23,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.Plugins.SetLibraryBookReaderEnabled;
///
-/// Contains integration tests for the /libraries/{libraryId}/book-readers/{pluginId}/enabled route.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class SetLibraryBookReaderEnabledEndpointTests : IClassFixture, IAsyncLifetime
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointTests.cs
index bc029b1f..b9ac6557 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointTests.cs
@@ -19,7 +19,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Authorization.Roles.AddRole;
///
-/// Contains integration tests for the /{culture}/admin/api-create-role route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class AddRoleEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointTests.cs
index 963ad8f2..c6c11c9d 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Authorization.Roles.DeleteRole;
///
-/// Contains integration tests for the /{culture}/admin/api-delete-role/{roleId} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class DeleteRoleEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissions/GetRolePermissionsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissions/GetRolePermissionsEndpointTests.cs
index 50c497e1..7b743588 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissions/GetRolePermissionsEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissions/GetRolePermissionsEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Authorization.Roles.GetRolePermissions;
///
-/// Contains integration tests for the /{culture}/admin/api-get-permissions-by-role-id/{roleId} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetRolePermissionsEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRoles/GetRolesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRoles/GetRolesEndpointTests.cs
index 9a47f7bf..3946e36a 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRoles/GetRolesEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRoles/GetRolesEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Authorization.Roles.GetRoles;
///
-/// Contains integration tests for the /{culture}/admin/api-get-roles route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetRolesEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointTests.cs
index 34b80bc2..42cb041f 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointTests.cs
@@ -19,7 +19,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Authorization.Roles.UpdateRole;
///
-/// Contains integration tests for the /{culture}/admin/api-update-role route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class UpdateRoleEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/ManagePermissions/ManagePermissionsViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/ManagePermissions/ManagePermissionsViewEndpointTests.cs
index def9fd02..639bf999 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/ManagePermissions/ManagePermissionsViewEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/ManagePermissions/ManagePermissionsViewEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.ManagePermissions;
///
-/// Contains integration tests for the /{culture}/admin/manage-permissions route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class ManagePermissionsViewEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/ManageRoles/ManageRolesViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/ManageRoles/ManageRolesViewEndpointTests.cs
index 53bf006b..b059e5aa 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/ManageRoles/ManageRolesViewEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/ManageRoles/ManageRolesViewEndpointTests.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.ManageRoles;
///
-/// Contains integration tests for the /{culture}/admin/manage-roles route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class ManageRolesViewEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/AddScheduledJob/AddScheduledJobEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/AddScheduledJob/AddScheduledJobEndpointTests.cs
index bef4e989..70f64fe9 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/AddScheduledJob/AddScheduledJobEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/AddScheduledJob/AddScheduledJobEndpointTests.cs
@@ -18,7 +18,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Scheduler.AddScheduledJob;
///
-/// Contains integration tests for the /{culture}/admin/api-scheduled-jobs/add route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class AddScheduledJobEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/FireScheduledJob/FireScheduledJobEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/FireScheduledJob/FireScheduledJobEndpointTests.cs
index 5e47ba56..c7938435 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/FireScheduledJob/FireScheduledJobEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/FireScheduledJob/FireScheduledJobEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Scheduler.FireScheduledJob;
///
-/// Contains integration tests for the /{culture}/admin/api-scheduled-jobs/{scheduledJobId}/fire route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class FireScheduledJobEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/GetScheduledJobHistory/GetScheduledJobHistoryEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/GetScheduledJobHistory/GetScheduledJobHistoryEndpointTests.cs
index 694a0d6b..b4389e6c 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/GetScheduledJobHistory/GetScheduledJobHistoryEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/GetScheduledJobHistory/GetScheduledJobHistoryEndpointTests.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Scheduler.GetScheduledJobHistory;
///
-/// Contains integration tests for the /{culture}/admin/api-scheduled-jobs/history route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetScheduledJobHistoryEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/GetScheduledJobs/GetScheduledJobsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/GetScheduledJobs/GetScheduledJobsEndpointTests.cs
index 591527c7..58280bc6 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/GetScheduledJobs/GetScheduledJobsEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/GetScheduledJobs/GetScheduledJobsEndpointTests.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Scheduler.GetScheduledJobs;
///
-/// Contains integration tests for the /{culture}/admin/api-scheduled-jobs route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetScheduledJobsEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/GetSchedulerDisplayPreferences/GetSchedulerDisplayPreferencesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/GetSchedulerDisplayPreferences/GetSchedulerDisplayPreferencesEndpointTests.cs
index eff20ef2..67d32ba4 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/GetSchedulerDisplayPreferences/GetSchedulerDisplayPreferencesEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/GetSchedulerDisplayPreferences/GetSchedulerDisplayPreferencesEndpointTests.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Scheduler.GetSchedulerDisplayPreferences;
///
-/// Contains integration tests for the /{culture}/admin/api-scheduled-jobs/display-preferences route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetSchedulerDisplayPreferencesEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/RemoveScheduledJob/RemoveScheduledJobEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/RemoveScheduledJob/RemoveScheduledJobEndpointTests.cs
index 7a71b990..ad008a21 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/RemoveScheduledJob/RemoveScheduledJobEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/RemoveScheduledJob/RemoveScheduledJobEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Scheduler.RemoveScheduledJob;
///
-/// Contains integration tests for the /{culture}/admin/api-scheduled-jobs/{scheduledJobId} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class RemoveScheduledJobEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/SchedulerIndexViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/SchedulerIndexViewEndpointTests.cs
index ce0d355c..f6e30b3f 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/SchedulerIndexViewEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/SchedulerIndexViewEndpointTests.cs
@@ -13,7 +13,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Scheduler;
///
-/// Contains integration tests for the /{culture}/admin/scheduled-jobs route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class SchedulerIndexViewEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/StartScheduledJob/StartScheduledJobEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/StartScheduledJob/StartScheduledJobEndpointTests.cs
index 1d4da095..2ed51ce3 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/StartScheduledJob/StartScheduledJobEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/StartScheduledJob/StartScheduledJobEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Scheduler.StartScheduledJob;
///
-/// Contains integration tests for the /{culture}/admin/api-scheduled-jobs/{scheduledJobId}/start route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class StartScheduledJobEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/StopScheduledJob/StopScheduledJobEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/StopScheduledJob/StopScheduledJobEndpointTests.cs
index c8f04969..ab8c19f4 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/StopScheduledJob/StopScheduledJobEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/StopScheduledJob/StopScheduledJobEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Scheduler.StopScheduledJob;
///
-/// Contains integration tests for the /{culture}/admin/api-scheduled-jobs/{scheduledJobId}/stop route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class StopScheduledJobEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesEndpointTests.cs
index 1e1d5757..942317b2 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Scheduler/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Scheduler.UpdateSchedulerDisplayPreferences;
///
-/// Contains integration tests for the /{culture}/admin/api-scheduled-jobs/display-preferences route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class UpdateSchedulerDisplayPreferencesEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/DeleteTheme/DeleteThemeEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/DeleteTheme/DeleteThemeEndpointTests.cs
index 1078a03c..eb726407 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/DeleteTheme/DeleteThemeEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/DeleteTheme/DeleteThemeEndpointTests.cs
@@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Themes.DeleteTheme;
///
-/// Contains integration tests for the /{culture}/admin/themes/api-delete-theme/{themeId} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class DeleteThemeEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/DownloadTheme/DownloadThemeEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/DownloadTheme/DownloadThemeEndpointTests.cs
index a4f93086..9b4b6025 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/DownloadTheme/DownloadThemeEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/DownloadTheme/DownloadThemeEndpointTests.cs
@@ -13,7 +13,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Themes.DownloadTheme;
///
-/// Contains integration tests for the /{culture}/admin/themes/api-download-theme/{themeId} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class DownloadThemeEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/GetThemes/GetThemesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/GetThemes/GetThemesEndpointTests.cs
index 38c8b797..7da44346 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/GetThemes/GetThemesEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/GetThemes/GetThemesEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Themes.GetThemes;
///
-/// Contains integration tests for the /{culture}/admin/themes/api-get-themes route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetThemesEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/InstallTheme/InstallThemeEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/InstallTheme/InstallThemeEndpointTests.cs
index ea838726..75b39d94 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/InstallTheme/InstallThemeEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/InstallTheme/InstallThemeEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Themes.InstallTheme;
///
-/// Contains integration tests for the /{culture}/admin/themes/api-install-theme route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class InstallThemeEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/RestoreTheme/RestoreThemeEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/RestoreTheme/RestoreThemeEndpointTests.cs
index 37b2a082..706407da 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/RestoreTheme/RestoreThemeEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/RestoreTheme/RestoreThemeEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Themes.RestoreTheme;
///
-/// Contains integration tests for the /{culture}/admin/themes/api-restore-theme/{themeId} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class RestoreThemeEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/SetCurrentTheme/SetCurrentThemeEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/SetCurrentTheme/SetCurrentThemeEndpointTests.cs
index ec36ed94..2bf639fd 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/SetCurrentTheme/SetCurrentThemeEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/SetCurrentTheme/SetCurrentThemeEndpointTests.cs
@@ -18,7 +18,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Themes.SetCurrentTheme;
///
-/// Contains integration tests for the /{culture}/admin/themes/api-set-current-theme route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class SetCurrentThemeEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/ThemesIndexViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/ThemesIndexViewEndpointTests.cs
index f9ab2759..9e77e2f5 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/ThemesIndexViewEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/Themes/ThemesIndexViewEndpointTests.cs
@@ -13,7 +13,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.Themes;
///
-/// Contains integration tests for the /{culture}/admin/manage-themes route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class ThemesIndexViewEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/UsersManagement/Authorization/GetUserPermissions/GetUserPermissionsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/UsersManagement/Authorization/GetUserPermissions/GetUserPermissionsEndpointTests.cs
index 781e3dd4..15dfefff 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/UsersManagement/Authorization/GetUserPermissions/GetUserPermissionsEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/UsersManagement/Authorization/GetUserPermissions/GetUserPermissionsEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.UsersManagement.Authorization.GetUserPermissions;
///
-/// Contains integration tests for the /{culture}/admin/api-get-permissions-by-user-id/{userId} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetUserPermissionsEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/UsersManagement/Authorization/GetUserRole/GetUserRoleEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/UsersManagement/Authorization/GetUserRole/GetUserRoleEndpointTests.cs
index d2dab495..9f0bca43 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/UsersManagement/Authorization/GetUserRole/GetUserRoleEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/UsersManagement/Authorization/GetUserRole/GetUserRoleEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.UsersManagement.Authorization.GetUserRole;
///
-/// Contains integration tests for the /{culture}/admin/api-get-role-by-user-id/{userId} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetUserRoleEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/UsersManagement/Authorization/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/UsersManagement/Authorization/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsEndpointTests.cs
index 90843ed4..70f13d90 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/UsersManagement/Authorization/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Admin/UsersManagement/Authorization/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsEndpointTests.cs
@@ -19,7 +19,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Admin.UsersManagement.Authorization.UpdateUserRoleAndPermissions;
///
-/// Contains integration tests for the /{culture}/admin/api-update-user-authorization route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class UpdateUserRoleAndPermissionsEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectories/GetDirectoriesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectories/GetDirectoriesEndpointTests.cs
index c1ff40b9..543c9b9f 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectories/GetDirectoriesEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectories/GetDirectoriesEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.FileSystemManagement.Directories.GetDirectories;
///
-/// Contains integration tests for the /directories/api-get-directories route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetDirectoriesEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Drives/GetDrives/GetDrivesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Drives/GetDrives/GetDrivesEndpointTests.cs
index 07c7e66c..f7f4a926 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Drives/GetDrives/GetDrivesEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Drives/GetDrives/GetDrivesEndpointTests.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.FileSystemManagement.Drives.GetDrives;
///
-/// Contains integration tests for the /drives/api-get-drives route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetDrivesEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/FileSystem/GetType/GetTypeEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/FileSystem/GetType/GetTypeEndpointTests.cs
index f2153bc0..1db3b0c2 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/FileSystem/GetType/GetTypeEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/FileSystem/GetType/GetTypeEndpointTests.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.FileSystemManagement.FileSystem.GetType;
///
-/// Contains integration tests for the /file-system/api-get-type route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetTypeEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetFiles/GetFilesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetFiles/GetFilesEndpointTests.cs
index cc2ccee9..bd562e06 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetFiles/GetFilesEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetFiles/GetFilesEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.FileSystemManagement.Files.GetFiles;
///
-/// Contains integration tests for the /files/api-get-files route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetFilesEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetTreeFiles/GetTreeFilesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetTreeFiles/GetTreeFilesEndpointTests.cs
index b391ad50..1ec83afc 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetTreeFiles/GetTreeFilesEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetTreeFiles/GetTreeFilesEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.FileSystemManagement.Files.GetTreeFiles;
///
-/// Contains integration tests for the /files/api-get-tree-files route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetTreeFilesEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/CheckPathExists/CheckPathExistsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/CheckPathExists/CheckPathExistsEndpointTests.cs
index 835e0471..3e95d5b2 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/CheckPathExists/CheckPathExistsEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/CheckPathExists/CheckPathExistsEndpointTests.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.FileSystemManagement.Path.CheckPathExists;
///
-/// Contains integration tests for the /path/api-check-path-exists route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class CheckPathExistsEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathParent/GetPathParentEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathParent/GetPathParentEndpointTests.cs
index f3c3d81e..f326b8ca 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathParent/GetPathParentEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathParent/GetPathParentEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.FileSystemManagement.Path.GetPathParent;
///
-/// Contains integration tests for the /path/api-get-path-parent route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetPathParentEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathRoot/GetPathRootEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathRoot/GetPathRootEndpointTests.cs
index 5aa67b41..eb485f7e 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathRoot/GetPathRootEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathRoot/GetPathRootEndpointTests.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.FileSystemManagement.Path.GetPathRoot;
///
-/// Contains integration tests for the /path/api-get-path-root route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetPathRootEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathSeparator/GetPathSeparatorEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathSeparator/GetPathSeparatorEndpointTests.cs
index c3d971da..f14ce4f0 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathSeparator/GetPathSeparatorEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathSeparator/GetPathSeparatorEndpointTests.cs
@@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.FileSystemManagement.Path.GetPathSeparator;
///
-/// Contains integration tests for the /path/api-get-path-separator route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetPathSeparatorEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/SplitPath/SplitPathEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/SplitPath/SplitPathEndpointTests.cs
index 9099673a..f6ae9124 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/SplitPath/SplitPathEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/SplitPath/SplitPathEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.FileSystemManagement.Path.SplitPath;
///
-/// Contains integration tests for the /path/api-split route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class SplitPathEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/ValidatePath/ValidatePathEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/ValidatePath/ValidatePathEndpointTests.cs
index 01313cdc..0dde4e47 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/ValidatePath/ValidatePathEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/ValidatePath/ValidatePathEndpointTests.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.FileSystemManagement.Path.ValidatePath;
///
-/// Contains integration tests for the /path/api-validate route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class ValidatePathEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeErrorEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeErrorEndpointTests.cs
index 60fab458..5d62be31 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeErrorEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeErrorEndpointTests.cs
@@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Home;
///
-/// Contains integration tests for the /{culture}/error route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class HomeErrorEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeIndexEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeIndexEndpointTests.cs
index 25f1c76d..598e4ccb 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeIndexEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeIndexEndpointTests.cs
@@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Home;
///
-/// Contains integration tests for the /{culture} and / routes served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class HomeIndexEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeNotFoundViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeNotFoundViewEndpointTests.cs
index 09b1028f..094491a5 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeNotFoundViewEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeNotFoundViewEndpointTests.cs
@@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Home;
///
-/// Contains integration tests for the /{culture}/not-found route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class HomeNotFoundViewEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomePrivacyEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomePrivacyEndpointTests.cs
index 86ca4fb6..8e46da51 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomePrivacyEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomePrivacyEndpointTests.cs
@@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Home;
///
-/// Contains integration tests for the /{culture}/privacy route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class HomePrivacyEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/AddLibrary/AddLibraryViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/AddLibrary/AddLibraryViewEndpointTests.cs
index 63ef8b49..4f706630 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/AddLibrary/AddLibraryViewEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/AddLibrary/AddLibraryViewEndpointTests.cs
@@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.AddLibrary;
///
-/// Contains integration tests for the /{culture}/libraries/manage/item route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class AddLibraryViewEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibrariesScan/CancelLibrariesScanEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibrariesScan/CancelLibrariesScanEndpointTests.cs
index 7e85cdb0..52c3d142 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibrariesScan/CancelLibrariesScanEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibrariesScan/CancelLibrariesScanEndpointTests.cs
@@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.CancelLibrariesScan;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-cancel-libraries-scan route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class CancelLibrariesScanEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs
index 93b3b4aa..f5331ad0 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.CancelLibraryScan;
///
-/// Contains integration tests for the /{culture}/libraries/manage/{{libraryId}}/api-cancel-library-scan/{{scanId}} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class CancelLibraryScanEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs
index 16c5b86f..23f206c3 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.DeleteLibrary;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-item/{{id}} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class DeleteLibraryEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/EditLibrary/EditLibraryViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/EditLibrary/EditLibraryViewEndpointTests.cs
index 456d5e11..08724f1e 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/EditLibrary/EditLibraryViewEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/EditLibrary/EditLibraryViewEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.EditLibrary;
///
-/// Contains integration tests for the /{culture}/libraries/manage/item/{{id}} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class EditLibraryViewEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpointTests.cs
index 3b87c503..774c4a74 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.GetArtworkProviders;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-get-artwork-providers/{{libraryId}} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetArtworkProvidersEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetBookReaders/GetBookReadersEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetBookReaders/GetBookReadersEndpointTests.cs
index d12480e9..5520979d 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetBookReaders/GetBookReadersEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetBookReaders/GetBookReadersEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.GetBookReaders;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-get-book-readers/{{libraryId}} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetBookReadersEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetEnabledLibraries/GetEnabledLibrariesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetEnabledLibraries/GetEnabledLibrariesEndpointTests.cs
index 028e6e65..3521d45a 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetEnabledLibraries/GetEnabledLibrariesEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetEnabledLibraries/GetEnabledLibrariesEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.GetEnabledLibraries;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-get-enabled-libraries route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetEnabledLibrariesEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpointTests.cs
index d032e6cd..ba171a32 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpointTests.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.GetLibraries;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-get-libraries route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetLibrariesEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetMetadataProviders/GetMetadataProvidersEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetMetadataProviders/GetMetadataProvidersEndpointTests.cs
index 7ff6e394..c59cc7d7 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetMetadataProviders/GetMetadataProvidersEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetMetadataProviders/GetMetadataProvidersEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.GetMetadataProviders;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-get-metadata-providers/{{libraryId}} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetMetadataProvidersEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetRunningLibraryScans/GetRunningLibraryScansEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetRunningLibraryScans/GetRunningLibraryScansEndpointTests.cs
index 4d1fcea0..05c23235 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetRunningLibraryScans/GetRunningLibraryScansEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetRunningLibraryScans/GetRunningLibraryScansEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.GetRunningLibraryScans;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-get-running-library-scans route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetRunningLibraryScansEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/Index/LibrariesIndexViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/Index/LibrariesIndexViewEndpointTests.cs
index e36f0c3d..088b0b24 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/Index/LibrariesIndexViewEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/Index/LibrariesIndexViewEndpointTests.cs
@@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.Index;
///
-/// Contains integration tests for the /{culture}/libraries/manage route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class LibrariesIndexViewEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointTests.cs
index 2a64e24a..940c6cf0 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.ReorderArtworkProviders;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-reorder-artwork-providers route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class ReorderArtworkProvidersEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ReorderMetadataProviders/ReorderMetadataProvidersEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ReorderMetadataProviders/ReorderMetadataProvidersEndpointTests.cs
index 6765f340..059ebed5 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ReorderMetadataProviders/ReorderMetadataProvidersEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ReorderMetadataProviders/ReorderMetadataProvidersEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.ReorderMetadataProviders;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-reorder-metadata-providers route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class ReorderMetadataProvidersEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SaveLibrary/SaveLibraryEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SaveLibrary/SaveLibraryEndpointTests.cs
index 3d8485d6..121701e4 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SaveLibrary/SaveLibraryEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SaveLibrary/SaveLibraryEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.SaveLibrary;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-item route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class SaveLibraryEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs
index f9dda266..ade53321 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.ScanLibraries;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-scan-libraries route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class ScanLibrariesEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs
index e615d08e..9e7d202a 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.ScanLibrary;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-scan-library/{{id}} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class ScanLibraryEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointTests.cs
index dcbef9fb..2a2c9995 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.SetArtworkProviderEnabled;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-set-artwork-provider-enabled route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class SetArtworkProviderEnabledEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetBookReaderEnabled/SetBookReaderEnabledEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetBookReaderEnabled/SetBookReaderEnabledEndpointTests.cs
index e04ba161..25f4a8bb 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetBookReaderEnabled/SetBookReaderEnabledEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetBookReaderEnabled/SetBookReaderEnabledEndpointTests.cs
@@ -18,7 +18,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.SetBookReaderEnabled;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-set-book-reader-enabled route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class SetBookReaderEnabledEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetMetadataProviderEnabled/SetMetadataProviderEnabledEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetMetadataProviderEnabled/SetMetadataProviderEnabledEndpointTests.cs
index 093e89a2..ad6752ac 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetMetadataProviderEnabled/SetMetadataProviderEnabledEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetMetadataProviderEnabled/SetMetadataProviderEnabledEndpointTests.cs
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.SetMetadataProviderEnabled;
///
-/// Contains integration tests for the /{culture}/libraries/manage/api-set-metadata-provider-enabled route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class SetMetadataProviderEnabledEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/EditBook/EditBookViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/EditBook/EditBookViewEndpointTests.cs
index 6d694754..b90c8239 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/EditBook/EditBookViewEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/EditBook/EditBookViewEndpointTests.cs
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.EditBook;
///
-/// Contains integration tests for the /{culture}/library/written-content-library/books-library/books/{{id}} route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class EditBookViewEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBookDetails/GetBookDetailsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBookDetails/GetBookDetailsEndpointTests.cs
new file mode 100644
index 00000000..822e2952
--- /dev/null
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBookDetails/GetBookDetailsEndpointTests.cs
@@ -0,0 +1,75 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.DTO.WrittenContentLibrary.BookLibrary;
+using Lumina.Presentation.Web.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.GetBookDetails;
+using Lumina.Presentation.Web.Fixtures.Common.DTO.WrittenContentLibrary.BookLibrary;
+using Lumina.Presentation.Web.Fixtures.Common.TestHelpers;
+using Lumina.Presentation.Web.IntegrationTests.Common.Setup;
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text.Json;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.GetBookDetails;
+
+///
+/// Contains integration tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class GetBookDetailsEndpointTests : IClassFixture
+{
+ private readonly LuminaWebFactory _apiFactory;
+ private readonly BookDetailsDtoFixture _bookDetailsDtoFixture = new();
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected Web application factory.
+ public GetBookDetailsEndpointTests(LuminaWebFactory apiFactory)
+ {
+ _apiFactory = apiFactory;
+ }
+
+ [Fact]
+ public async Task GetBookDetails_WhenCalledByAuthenticatedUser_ShouldReturnBookDetailsFromApi()
+ {
+ // Arrange
+ _apiFactory.ApiClientStub.Reset();
+ Guid bookId = Guid.NewGuid();
+ BookDetailsDto expectedBook = _bookDetailsDtoFixture.Create(id: bookId);
+ _apiFactory.ApiClientStub.RegisterGetResponse($"books/{bookId}", expectedBook);
+ AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory);
+ HttpRequestMessage getRequest = new(HttpMethod.Get, $"/en-us/library/written-content-library/books-library/books/{bookId}/api-get-book");
+ getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+
+ // Act
+ HttpResponseMessage response = await webClient.Client.SendAsync(getRequest);
+ string content = await response.Content.ReadAsStringAsync();
+
+ // Assert
+ response.EnsureSuccessStatusCode();
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ using JsonDocument json = JsonDocument.Parse(content);
+ Assert.True(json.RootElement.GetProperty("success").GetBoolean());
+ Assert.Equal(bookId, json.RootElement.GetProperty("data").GetProperty("id").GetGuid());
+ Assert.Contains($"books/{bookId}", _apiFactory.ApiClientStub.GetEndpointsCalled);
+ }
+
+ [Fact]
+ public async Task GetBookDetails_WhenNotAuthenticated_ShouldRedirectToLogin()
+ {
+ // Arrange
+ _apiFactory.ApiClientStub.Reset();
+ HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory);
+
+ // Act
+ HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/written-content-library/books-library/books/{Guid.NewGuid()}/api-get-book");
+
+ // Assert
+ Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
+ Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("books/", StringComparison.OrdinalIgnoreCase));
+ }
+}
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetLibraryItems/GetLibraryItemsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetLibraryItems/GetLibraryItemsEndpointTests.cs
index 3e3ac35e..13b87003 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetLibraryItems/GetLibraryItemsEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetLibraryItems/GetLibraryItemsEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.GetLibraryItems;
///
-/// Contains integration tests for the /{culture}/library/written-content-library/books-library/books/api-get-library-items route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetLibraryItemsEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Index/BooksIndexViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Index/BooksIndexViewEndpointTests.cs
index 2661e493..eb02aaee 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Index/BooksIndexViewEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Index/BooksIndexViewEndpointTests.cs
@@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.Index;
///
-/// Contains integration tests for the /{culture}/library/written-content-library/books-library/books route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class BooksIndexViewEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs
index 1bd01bc6..1501b6c7 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.Reading.GetReadingAvailability;
///
-/// Contains integration tests for the /{culture}/library/written-content-library/books-library/books/{bookId}/api-get-reading-availability route served by the class.
+/// Contains integration tests for the class.
///
[ExcludeFromCodeCoverage]
public class GetReadingAvailabilityEndpointTests : IClassFixture
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingManifest/GetReadingManifestEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingManifest/GetReadingManifestEndpointTests.cs
index d1316190..25f8fda3 100644
--- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingManifest/GetReadingManifestEndpointTests.cs
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingManifest/GetReadingManifestEndpointTests.cs
@@ -18,7 +18,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.Reading.GetReadingManifest;
///
-/// Contains integration tests for the