mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Removes the umbrella include flag from the fixtures and their consumers
This commit is contained in:
1 parent
ab5cbfb949
commit
4d96fe10dd
43 files changed
+930
-349
No files matched your search
+3
-3
@@ -23,17 +23,17 @@ public class RoleEntityFixture
|
||||
/// <param name="id">Optional. The Id of the role.</param>
|
||||
/// <param name="roleName">Optional. The name of the role.</param>
|
||||
/// <param name="rolePermissions">Optional. The role permission associations of the role.</param>
|
||||
/// <param name="includeRolePermissions">Whether the role permission associations should be included, or forced to an empty collection.</param>
|
||||
/// <param name="createdBy">Optional. The Id of the user that created the role.</param>
|
||||
/// <param name="createdOnUtc">Optional. The time and date when the role was added.</param>
|
||||
/// <param name="includeRolePermissions">Whether the role permission associations should be included, or forced to an empty collection.</param>
|
||||
/// <returns>The created <see cref="RoleEntity"/>.</returns>
|
||||
public RoleEntity Create(
|
||||
Guid? id = null,
|
||||
string? roleName = null,
|
||||
IEnumerable<RolePermissionEntity>? rolePermissions = null,
|
||||
bool includeRolePermissions = false,
|
||||
Guid? createdBy = null,
|
||||
DateTime? createdOnUtc = null)
|
||||
DateTime? createdOnUtc = null,
|
||||
bool includeRolePermissions = false)
|
||||
{
|
||||
return new Faker<RoleEntity>()
|
||||
.CustomInstantiator(faker => new RoleEntity
|
||||
|
||||
+9
-10
@@ -20,7 +20,6 @@ namespace Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Au
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class TrackEntityFixture
|
||||
{
|
||||
private readonly Random _random = new();
|
||||
private readonly Faker _faker = new();
|
||||
private readonly TagEntityFixture _tagEntityFixture = new();
|
||||
private readonly GenreEntityFixture _genreEntityFixture = new();
|
||||
@@ -38,11 +37,11 @@ public class TrackEntityFixture
|
||||
/// <param name="path">Optional. The file system path of the track.</param>
|
||||
/// <param name="title">Optional. The title of the track.</param>
|
||||
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
|
||||
/// <param name="includeMetadata">Whether the owned metadata collections (Tags, Genres, Moods, ISRCs, Contributors, Ratings) should be included, or forced to empty collections.</param>
|
||||
/// <param name="originalReleaseDate">Optional. The original release date of the track.</param>
|
||||
/// <param name="originalReleaseYear">Optional. The original release year of the track.</param>
|
||||
/// <param name="reReleaseDate">Optional. The re-release date of the track.</param>
|
||||
/// <param name="reReleaseYear">Optional. The re-release year of the track.</param>
|
||||
/// <param name="includeMetadata">Whether the owned metadata collections (Tags, Genres, Moods, ISRCs, Contributors, Ratings) should be included, or forced to empty collections.</param>
|
||||
/// <param name="includeOriginalReleaseDate">Whether the original release date should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOriginalReleaseYear">Whether the original release year should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeReReleaseDate">Whether the re-release date should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -55,11 +54,11 @@ public class TrackEntityFixture
|
||||
string? path = null,
|
||||
string? title = null,
|
||||
int? trackNumber = null,
|
||||
bool includeMetadata = true,
|
||||
DateOnly? originalReleaseDate = null,
|
||||
int? originalReleaseYear = null,
|
||||
DateOnly? reReleaseDate = null,
|
||||
int? reReleaseYear = null,
|
||||
bool includeMetadata = true,
|
||||
bool includeOriginalReleaseDate = true,
|
||||
bool includeOriginalReleaseYear = true,
|
||||
bool includeReReleaseDate = true,
|
||||
@@ -69,9 +68,9 @@ public class TrackEntityFixture
|
||||
Guid resolvedAlbumId = albumId ?? Guid.NewGuid();
|
||||
Guid resolvedLibraryId = libraryId ?? Guid.NewGuid();
|
||||
const int MAXIMUM_RELEASE_YEAR = 2026;
|
||||
int resolvedOriginalReleaseYear = originalReleaseYear ?? _random.Next(1900, MAXIMUM_RELEASE_YEAR);
|
||||
int resolvedOriginalReleaseYear = originalReleaseYear ?? Random.Shared.Next(1900, MAXIMUM_RELEASE_YEAR);
|
||||
int resolvedReReleaseYearUpperBound = Math.Max(resolvedOriginalReleaseYear + 1, MAXIMUM_RELEASE_YEAR);
|
||||
int resolvedReReleaseYear = reReleaseYear ?? _random.Next(resolvedOriginalReleaseYear, resolvedReReleaseYearUpperBound);
|
||||
int resolvedReReleaseYear = reReleaseYear ?? Random.Shared.Next(resolvedOriginalReleaseYear, resolvedReReleaseYearUpperBound);
|
||||
DateOnly resolvedOriginalReleaseDate = originalReleaseDate ?? _faker.DateOnlyBetween(new DateOnly(resolvedOriginalReleaseYear, 1, 1), new DateOnly(resolvedOriginalReleaseYear, 12, 31));
|
||||
DateOnly resolvedReReleaseDate = reReleaseDate ?? _faker.DateOnlyBetween(resolvedReReleaseYear == resolvedOriginalReleaseYear ? resolvedOriginalReleaseDate : new DateOnly(resolvedReReleaseYear, 1, 1), new DateOnly(resolvedReReleaseYear, 12, 31));
|
||||
|
||||
@@ -103,17 +102,17 @@ public class TrackEntityFixture
|
||||
.RuleFor(x => x.OriginalLanguageCode, f => f.Random.String2(2))
|
||||
.RuleFor(x => x.OriginalLanguageName, f => f.Random.String2(f.Random.Number(1, 50)))
|
||||
.RuleFor(x => x.OriginalLanguageNativeName, f => f.Random.String2(f.Random.Number(1, 50)))
|
||||
.RuleFor(x => x.DurationInSeconds, _random.Next(60, 7200))
|
||||
.RuleFor(x => x.DurationInSeconds, Random.Shared.Next(60, 7200))
|
||||
.RuleFor(x => x.SampleRate, f => f.PickRandom(44100, 48000, 96000))
|
||||
.RuleFor(x => x.Channels, f => f.PickRandom(1, 2, 6))
|
||||
.RuleFor(x => x.BitDepth, _random.Next(8, 32))
|
||||
.RuleFor(x => x.BitDepth, Random.Shared.Next(8, 32))
|
||||
.RuleFor(x => x.AudioCodec, f => f.PickRandom("FLAC", "MP3", "AAC", "ALAC"))
|
||||
.RuleFor(x => x.Bitrate, _random.Next(96, 1411))
|
||||
.RuleFor(x => x.Bitrate, Random.Shared.Next(96, 1411))
|
||||
.RuleFor(x => x.TrackNumber, f => trackNumber ?? f.Random.Int(1, 20))
|
||||
.RuleFor(x => x.DiscNumber, _random.Next(1, 3))
|
||||
.RuleFor(x => x.DiscNumber, Random.Shared.Next(1, 3))
|
||||
.RuleFor(x => x.Script, f => f.Random.String2(f.Random.Number(1, 50)))
|
||||
.RuleFor(x => x.Key, f => f.PickRandom<MusicKey>())
|
||||
.RuleFor(x => x.Bpm, _random.Next(40, 240))
|
||||
.RuleFor(x => x.Bpm, Random.Shared.Next(40, 240))
|
||||
.RuleFor(x => x.Work, f => f.Music.Genre())
|
||||
.RuleFor(x => x.MusicBrainzRecordingId, f => f.Random.Guid())
|
||||
.RuleFor(x => x.MusicBrainzTrackId, f => f.Random.Guid())
|
||||
|
||||
+6
-6
@@ -26,17 +26,17 @@ public class ThemeEntityFixture
|
||||
/// <param name="author">Optional author of the theme.</param>
|
||||
/// <param name="version">Optional version of the theme.</param>
|
||||
/// <param name="previewPath">Optional preview image path of the theme, or <see langword="null"/> when the theme has no preview.</param>
|
||||
/// <param name="includePreviewPath">Whether the preview path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="installSource">Optional source the theme was installed from.</param>
|
||||
/// <param name="isCurrent">Optional value indicating whether the theme is the currently active one.</param>
|
||||
/// <param name="includeIsCurrent">Whether the currently active flag should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="isDeleted">Optional value indicating whether the theme was soft deleted.</param>
|
||||
/// <param name="installedAtUtc">Optional UTC timestamp when the theme was installed.</param>
|
||||
/// <param name="createdOnUtc">Optional UTC timestamp when the entity was created.</param>
|
||||
/// <param name="createdBy">Optional Id of the user that created the entity.</param>
|
||||
/// <param name="updatedOnUtc">Optional UTC timestamp when the entity was updated.</param>
|
||||
/// <param name="includeUpdatedOnUtc">Whether the updated-on timestamp should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="updatedBy">Optional Id of the user that updated the entity.</param>
|
||||
/// <param name="includePreviewPath">Whether the preview path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsCurrent">Whether the currently active flag should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeUpdatedOnUtc">Whether the updated-on timestamp should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeUpdatedBy">Whether the updated-by user Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="ThemeEntity"/> instance.</returns>
|
||||
public ThemeEntity Create(
|
||||
@@ -47,17 +47,17 @@ public class ThemeEntityFixture
|
||||
string? author = null,
|
||||
string? version = null,
|
||||
string? previewPath = null,
|
||||
bool includePreviewPath = false,
|
||||
ThemeInstallSource? installSource = null,
|
||||
bool? isCurrent = null,
|
||||
bool includeIsCurrent = false,
|
||||
bool? isDeleted = null,
|
||||
DateTime? installedAtUtc = null,
|
||||
DateTime? createdOnUtc = null,
|
||||
Guid? createdBy = null,
|
||||
DateTime? updatedOnUtc = null,
|
||||
bool includeUpdatedOnUtc = false,
|
||||
Guid? updatedBy = null,
|
||||
bool includePreviewPath = false,
|
||||
bool includeIsCurrent = false,
|
||||
bool includeUpdatedOnUtc = false,
|
||||
bool includeUpdatedBy = false)
|
||||
{
|
||||
Guid resolvedCreatedBy = createdBy ?? Guid.NewGuid();
|
||||
|
||||
+3
-3
@@ -29,9 +29,9 @@ public class UserEntityFixture
|
||||
/// <param name="id">Optional Id to pin, or <see langword="null"/> to generate a random one.</param>
|
||||
/// <param name="userRole">Optional user role association to pin when including it.</param>
|
||||
/// <param name="userPermissions">Optional user permission associations to pin when including them.</param>
|
||||
/// <param name="libraries">Optional collection of libraries to pin for the user, or <see langword="null"/> to generate them based on <paramref name="libraryCount"/>.</param>
|
||||
/// <param name="includeUserRole">Whether the user role association should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeUserPermissions">Whether the user permission associations should be included, or forced to an empty collection.</param>
|
||||
/// <param name="libraries">Optional collection of libraries to pin for the user, or <see langword="null"/> to generate them based on <paramref name="libraryCount"/>.</param>
|
||||
/// <returns>The created user entity.</returns>
|
||||
public UserEntity Create(
|
||||
int libraryCount = 0,
|
||||
@@ -40,9 +40,9 @@ public class UserEntityFixture
|
||||
Guid? id = null,
|
||||
UserRoleEntity? userRole = null,
|
||||
IEnumerable<UserPermissionEntity>? userPermissions = null,
|
||||
ICollection<LibraryEntity>? libraries = null,
|
||||
bool includeUserRole = false,
|
||||
bool includeUserPermissions = false,
|
||||
ICollection<LibraryEntity>? libraries = null)
|
||||
bool includeUserPermissions = false)
|
||||
{
|
||||
Guid userId = id ?? Guid.NewGuid();
|
||||
ICollection<LibraryEntity> resolvedLibraries = libraries ?? (libraryCount > 0
|
||||
|
||||
+3
-3
@@ -25,8 +25,8 @@ public class ThemeManifestDtoFixture
|
||||
/// <param name="author">Optional author of the theme.</param>
|
||||
/// <param name="version">Optional version of the theme.</param>
|
||||
/// <param name="preview">Optional preview image path of the theme, or <see langword="null"/> when the theme has no preview.</param>
|
||||
/// <param name="includePreview">Whether the preview path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="templates">Optional template mappings of the theme.</param>
|
||||
/// <param name="includePreview">Whether the preview path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="ThemeManifestDto"/> instance.</returns>
|
||||
public ThemeManifestDto Create(
|
||||
int? schemaVersion = null,
|
||||
@@ -36,8 +36,8 @@ public class ThemeManifestDtoFixture
|
||||
string? author = null,
|
||||
string? version = null,
|
||||
string? preview = null,
|
||||
bool includePreview = false,
|
||||
Dictionary<string, string>? templates = null)
|
||||
Dictionary<string, string>? templates = null,
|
||||
bool includePreview = false)
|
||||
{
|
||||
return new Faker<ThemeManifestDto>()
|
||||
.CustomInstantiator(f => new ThemeManifestDto
|
||||
|
||||
+30
-12
@@ -60,7 +60,16 @@ public class AddTrackCommandFixture
|
||||
/// <param name="includePath">Whether the path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeTrackNumber">Whether the track number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOptionalProperties">Whether the properties that are not explicitly provided should be randomized, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDiscNumber">Whether the disc number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeKey">Whether the musical key should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBpm">Whether the tempo should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created command to add a track.</returns>
|
||||
@@ -90,7 +99,16 @@ public class AddTrackCommandFixture
|
||||
bool includePath = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeTrackNumber = true,
|
||||
bool includeOptionalProperties = true,
|
||||
bool includeDiscNumber = true,
|
||||
bool includeScript = true,
|
||||
bool includeKey = true,
|
||||
bool includeBpm = true,
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMusicBrainzWorkId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true)
|
||||
{
|
||||
@@ -101,16 +119,16 @@ public class AddTrackCommandFixture
|
||||
includePath ? path ?? Path.Combine(Path.GetTempPath(), "lumina-tracks", _faker.System.FileName()) : null,
|
||||
includeMetadata ? metadata ?? _audioMetadataDtoFixture.Create() : null,
|
||||
includeTrackNumber ? trackNumber ?? _faker.Random.Int(1, 30) : null,
|
||||
includeOptionalProperties ? discNumber ?? _faker.Random.Int(1, 3) : null,
|
||||
includeOptionalProperties ? script ?? _faker.Random.AlphaNumeric(4) : null,
|
||||
includeOptionalProperties ? key ?? _faker.PickRandom<MusicKey>() : null,
|
||||
includeOptionalProperties ? bpm ?? _faker.Random.Int(40, 220) : null,
|
||||
includeOptionalProperties ? work ?? _faker.Lorem.Sentence() : null,
|
||||
includeOptionalProperties ? musicBrainzRecordingId ?? _faker.Random.Guid() : null,
|
||||
includeOptionalProperties ? musicBrainzTrackId ?? _faker.Random.Guid() : null,
|
||||
includeOptionalProperties ? musicBrainzWorkId ?? _faker.Random.Guid() : null,
|
||||
includeOptionalProperties ? moods ?? _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeOptionalProperties ? isrcs ?? _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeDiscNumber ? discNumber ?? _faker.Random.Int(1, 3) : null,
|
||||
includeScript ? script ?? _faker.Random.AlphaNumeric(4) : null,
|
||||
includeKey ? key ?? _faker.PickRandom<MusicKey>() : null,
|
||||
includeBpm ? bpm ?? _faker.Random.Int(40, 220) : null,
|
||||
includeWork ? work ?? _faker.Lorem.Sentence() : null,
|
||||
includeMusicBrainzRecordingId ? musicBrainzRecordingId ?? _faker.Random.Guid() : null,
|
||||
includeMusicBrainzTrackId ? musicBrainzTrackId ?? _faker.Random.Guid() : null,
|
||||
includeMusicBrainzWorkId ? musicBrainzWorkId ?? _faker.Random.Guid() : null,
|
||||
includeMoods ? moods ?? _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeIsrcs ? isrcs ?? _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeContributors ? contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeRatings ? ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
trackId);
|
||||
|
||||
+30
-12
@@ -53,7 +53,16 @@ public class UpdateTrackCommandFixture
|
||||
/// <param name="isrcs">Optional. The ISRC codes of the track.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that performed on the track.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the track.</param>
|
||||
/// <param name="includeOptionalProperties">Whether the optional properties that are not explicitly provided should be randomized, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDiscNumber">Whether the disc number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeKey">Whether the musical key should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBpm">Whether the tempo should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -84,7 +93,16 @@ public class UpdateTrackCommandFixture
|
||||
List<IsrcDto>? isrcs = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
bool includeOptionalProperties = true,
|
||||
bool includeDiscNumber = true,
|
||||
bool includeScript = true,
|
||||
bool includeKey = true,
|
||||
bool includeBpm = true,
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMusicBrainzWorkId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
@@ -103,16 +121,16 @@ public class UpdateTrackCommandFixture
|
||||
includePath ? (path ?? _faker.System.FilePath()) : null,
|
||||
includeMetadata ? (metadata ?? _audioMetadataDtoFixture.Create()) : null,
|
||||
includeTrackNumber ? (trackNumber ?? _faker.Random.Int(1, 20)) : null,
|
||||
includeOptionalProperties ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
|
||||
includeOptionalProperties ? (script ?? _faker.Random.String2(_faker.Random.Number(1, 50))) : null,
|
||||
includeOptionalProperties ? (key ?? _faker.PickRandom<MusicKey>()) : null,
|
||||
includeOptionalProperties ? (bpm ?? _faker.Random.Int(40, 240)) : null,
|
||||
includeOptionalProperties ? (work ?? _faker.Music.Genre()) : null,
|
||||
includeOptionalProperties ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
|
||||
includeOptionalProperties ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
|
||||
includeOptionalProperties ? (musicBrainzWorkId ?? _faker.Random.Guid()) : null,
|
||||
includeOptionalProperties ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeOptionalProperties ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
|
||||
includeScript ? (script ?? _faker.Random.String2(_faker.Random.Number(1, 50))) : null,
|
||||
includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
|
||||
includeBpm ? (bpm ?? _faker.Random.Int(40, 240)) : null,
|
||||
includeWork ? (work ?? _faker.Music.Genre()) : null,
|
||||
includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzWorkId ? (musicBrainzWorkId ?? _faker.Random.Guid()) : null,
|
||||
includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null);
|
||||
}
|
||||
|
||||
+45
-17
@@ -51,7 +51,21 @@ public class AddBookCommandFixture
|
||||
/// <param name="contributors">Optional. The contributors of the book.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the book.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOptionalProperties">Whether the properties that are not explicitly provided should be randomized, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFormat">Whether the format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeEdition">Whether the edition should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeVolumeNumber">Whether the volume number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoodreadsId">Whether the Goodreads Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLccn">Whether the LCCN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOclcNumber">Whether the OCLC number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOpenLibraryId">Whether the Open Library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLibraryThingId">Whether the LibraryThing Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoogleBooksId">Whether the Google Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarnesAndNobleId">Whether the Barnes and Noble Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAppleBooksId">Whether the Apple Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsbns">Whether the ISBNs should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created command to add a book.</returns>
|
||||
public AddBookCommand Create(
|
||||
string? libraryId = null,
|
||||
@@ -74,7 +88,21 @@ public class AddBookCommandFixture
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<BookRatingDto>? ratings = null,
|
||||
bool includeMetadata = true,
|
||||
bool includeOptionalProperties = true)
|
||||
bool includeFormat = true,
|
||||
bool includeEdition = true,
|
||||
bool includeVolumeNumber = true,
|
||||
bool includeAsin = true,
|
||||
bool includeGoodreadsId = true,
|
||||
bool includeLccn = true,
|
||||
bool includeOclcNumber = true,
|
||||
bool includeOpenLibraryId = true,
|
||||
bool includeLibraryThingId = true,
|
||||
bool includeGoogleBooksId = true,
|
||||
bool includeBarnesAndNobleId = true,
|
||||
bool includeAppleBooksId = true,
|
||||
bool includeIsbns = true,
|
||||
bool includeRatings = true,
|
||||
bool includeContributors = true)
|
||||
{
|
||||
return new Faker<AddBookCommand>()
|
||||
.CustomInstantiator(f => new AddBookCommand(
|
||||
@@ -101,22 +129,22 @@ public class AddBookCommandFixture
|
||||
.RuleFor(x => x.LibraryId, libraryId ?? Guid.NewGuid().ToString())
|
||||
.RuleFor(x => x.Path, f => path ?? Path.Combine(Path.GetTempPath(), "lumina-books", f.System.FileName()))
|
||||
.RuleFor(x => x.Metadata, includeMetadata ? (metadata ?? _writtenContentMetadataDtoFixture.Create()) : null)
|
||||
.RuleFor(x => x.Format, f => format ?? (includeOptionalProperties ? f.PickRandom<BookFormat>() : 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.Format, f => format ?? (includeFormat ? f.PickRandom<BookFormat>() : null))
|
||||
.RuleFor(x => x.Edition, f => edition ?? (includeEdition ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.VolumeNumber, f => volumeNumber ?? (includeVolumeNumber ? (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 ? [.. _mediaContributorReferenceDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
|
||||
.RuleFor(x => x.ASIN, f => asin ?? (includeAsin ? f.Random.String2(10) : null))
|
||||
.RuleFor(x => x.GoodreadsId, f => goodreadsId ?? (includeGoodreadsId ? f.Random.Number(100000, 500000).ToString() : null))
|
||||
.RuleFor(x => x.LCCN, f => lccn ?? (includeLccn ? CreateLccn(f) : null))
|
||||
.RuleFor(x => x.OCLCNumber, f => oclcNumber ?? (includeOclcNumber ? CreateOclcNumber(f) : null))
|
||||
.RuleFor(x => x.OpenLibraryId, f => openLibraryId ?? (includeOpenLibraryId ? CreateOpenLibraryId(f) : null))
|
||||
.RuleFor(x => x.LibraryThingId, f => libraryThingId ?? (includeLibraryThingId ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.GoogleBooksId, f => googleBooksId ?? (includeGoogleBooksId ? CreateGoogleBooksId(f) : null))
|
||||
.RuleFor(x => x.BarnesAndNobleId, f => barnesAndNobleId ?? (includeBarnesAndNobleId ? f.Random.String2(10, "0123456789") : null))
|
||||
.RuleFor(x => x.AppleBooksId, f => appleBooksId ?? (includeAppleBooksId ? $"id{f.Random.Number(1, 999999)}" : null))
|
||||
.RuleFor(p => p.ISBNs, f => isbns ?? (includeIsbns ? [.. _isbnDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
|
||||
.RuleFor(p => p.Ratings, f => ratings ?? (includeRatings ? [.. _bookRatingDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
|
||||
.RuleFor(x => x.Contributors, f => contributors ?? (includeContributors ? [.. _mediaContributorReferenceDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+45
-17
@@ -51,7 +51,21 @@ public class UpdateBookCommandFixture
|
||||
/// <param name="contributors">Optional. The contributors of the book.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the book.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOptionalProperties">Whether the properties that are not explicitly provided should be randomized, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFormat">Whether the format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeEdition">Whether the edition should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeVolumeNumber">Whether the volume number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoodreadsId">Whether the Goodreads Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLccn">Whether the LCCN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOclcNumber">Whether the OCLC number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOpenLibraryId">Whether the Open Library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLibraryThingId">Whether the LibraryThing Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoogleBooksId">Whether the Google Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarnesAndNobleId">Whether the Barnes and Noble Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAppleBooksId">Whether the Apple Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsbns">Whether the ISBNs should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created command to update a book.</returns>
|
||||
public UpdateBookCommand Create(
|
||||
string? libraryId = null,
|
||||
@@ -74,7 +88,21 @@ public class UpdateBookCommandFixture
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<BookRatingDto>? ratings = null,
|
||||
bool includeMetadata = true,
|
||||
bool includeOptionalProperties = true)
|
||||
bool includeFormat = true,
|
||||
bool includeEdition = true,
|
||||
bool includeVolumeNumber = true,
|
||||
bool includeAsin = true,
|
||||
bool includeGoodreadsId = true,
|
||||
bool includeLccn = true,
|
||||
bool includeOclcNumber = true,
|
||||
bool includeOpenLibraryId = true,
|
||||
bool includeLibraryThingId = true,
|
||||
bool includeGoogleBooksId = true,
|
||||
bool includeBarnesAndNobleId = true,
|
||||
bool includeAppleBooksId = true,
|
||||
bool includeIsbns = true,
|
||||
bool includeRatings = true,
|
||||
bool includeContributors = true)
|
||||
{
|
||||
return new Faker<UpdateBookCommand>()
|
||||
.CustomInstantiator(f => new UpdateBookCommand(
|
||||
@@ -101,22 +129,22 @@ public class UpdateBookCommandFixture
|
||||
.RuleFor(x => x.LibraryId, libraryId ?? Guid.NewGuid().ToString())
|
||||
.RuleFor(x => x.BookId, bookId ?? Guid.NewGuid().ToString())
|
||||
.RuleFor(x => x.Metadata, includeMetadata ? (metadata ?? _writtenContentMetadataDtoFixture.Create()) : null)
|
||||
.RuleFor(x => x.Format, f => format ?? (includeOptionalProperties ? f.PickRandom<BookFormat>() : 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.Format, f => format ?? (includeFormat ? f.PickRandom<BookFormat>() : null))
|
||||
.RuleFor(x => x.Edition, f => edition ?? (includeEdition ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.VolumeNumber, f => volumeNumber ?? (includeVolumeNumber ? (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 ? [.. _mediaContributorReferenceDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
|
||||
.RuleFor(x => x.ASIN, f => asin ?? (includeAsin ? f.Random.String2(10) : null))
|
||||
.RuleFor(x => x.GoodreadsId, f => goodreadsId ?? (includeGoodreadsId ? f.Random.Number(100000, 500000).ToString() : null))
|
||||
.RuleFor(x => x.LCCN, f => lccn ?? (includeLccn ? CreateLccn(f) : null))
|
||||
.RuleFor(x => x.OCLCNumber, f => oclcNumber ?? (includeOclcNumber ? CreateOclcNumber(f) : null))
|
||||
.RuleFor(x => x.OpenLibraryId, f => openLibraryId ?? (includeOpenLibraryId ? CreateOpenLibraryId(f) : null))
|
||||
.RuleFor(x => x.LibraryThingId, f => libraryThingId ?? (includeLibraryThingId ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.GoogleBooksId, f => googleBooksId ?? (includeGoogleBooksId ? CreateGoogleBooksId(f) : null))
|
||||
.RuleFor(x => x.BarnesAndNobleId, f => barnesAndNobleId ?? (includeBarnesAndNobleId ? f.Random.String2(10, "0123456789") : null))
|
||||
.RuleFor(x => x.AppleBooksId, f => appleBooksId ?? (includeAppleBooksId ? $"id{f.Random.Number(1, 999999)}" : null))
|
||||
.RuleFor(p => p.ISBNs, f => isbns ?? (includeIsbns ? [.. _isbnDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
|
||||
.RuleFor(p => p.Ratings, f => ratings ?? (includeRatings ? [.. _bookRatingDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
|
||||
.RuleFor(x => x.Contributors, f => contributors ?? (includeContributors ? [.. _mediaContributorReferenceDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+7
-4
@@ -17,7 +17,6 @@ namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
public class AudioRatingDtoFixture
|
||||
{
|
||||
private readonly Fixture _fixture = new();
|
||||
private readonly Random _random = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="AudioRatingDto"/>.
|
||||
@@ -26,6 +25,8 @@ public class AudioRatingDtoFixture
|
||||
/// <param name="maxValue">Optional. The maximum possible rating value.</param>
|
||||
/// <param name="source">Optional. The rating source.</param>
|
||||
/// <param name="voteCount">Optional. The number of votes.</param>
|
||||
/// <param name="includeValue">Whether the rating value should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMaxValue">Whether the maximum possible rating value should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSource">Whether the rating source should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeVoteCount">Whether the number of votes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="AudioRatingDto"/>.</returns>
|
||||
@@ -34,14 +35,16 @@ public class AudioRatingDtoFixture
|
||||
decimal? maxValue = null,
|
||||
AudioRatingSource? source = null,
|
||||
int? voteCount = null,
|
||||
bool includeValue = true,
|
||||
bool includeMaxValue = true,
|
||||
bool includeSource = true,
|
||||
bool includeVoteCount = true)
|
||||
{
|
||||
return new AudioRatingDto(
|
||||
value ?? _random.Next(1, 5),
|
||||
maxValue ?? 5,
|
||||
includeValue ? (value ?? Random.Shared.Next(1, 5)) : null,
|
||||
includeMaxValue ? (maxValue ?? 5) : null,
|
||||
includeSource ? (source ?? _fixture.Create<AudioRatingSource>()) : null,
|
||||
includeVoteCount ? (voteCount ?? _random.Next(1, 1000)) : null
|
||||
includeVoteCount ? (voteCount ?? Random.Shared.Next(1, 1000)) : null
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+20
-10
@@ -57,7 +57,12 @@ public class BookMetadataDtoFixture
|
||||
/// <param name="ratings">Optional. The ratings of the book.</param>
|
||||
/// <param name="coverImagePath">Optional. The path of the cover image of the book.</param>
|
||||
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOptionalProperties">Whether the properties that are not explicitly provided should be randomized, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeReleaseInfo">Whether the release info should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLanguage">Whether the language should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFormat">Whether the format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeVolumeNumber">Whether the volume number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="BookMetadataDto"/>.</returns>
|
||||
public BookMetadataDto Create(
|
||||
string? title = null,
|
||||
@@ -88,26 +93,31 @@ public class BookMetadataDtoFixture
|
||||
List<BookRatingDto>? ratings = null,
|
||||
string? coverImagePath = null,
|
||||
bool includeTitle = true,
|
||||
bool includeOptionalProperties = true)
|
||||
bool includeReleaseInfo = true,
|
||||
bool includeGenres = true,
|
||||
bool includeTags = true,
|
||||
bool includeLanguage = true,
|
||||
bool includeFormat = true,
|
||||
bool includeVolumeNumber = true)
|
||||
{
|
||||
int releaseYear = _faker.Random.Int(1900, 2024);
|
||||
return new BookMetadataDto(
|
||||
includeTitle ? title ?? (includeOptionalProperties ? _faker.Lorem.Sentence(3) : null) : null,
|
||||
includeTitle ? title ?? _faker.Lorem.Sentence(3) : null,
|
||||
originalTitle,
|
||||
description,
|
||||
releaseInfo ?? (includeOptionalProperties ? _releaseInfoDtoFixture.Create(
|
||||
includeReleaseInfo ? (releaseInfo ?? _releaseInfoDtoFixture.Create(
|
||||
originalReleaseDate: new DateOnly(releaseYear, 1, 1),
|
||||
originalReleaseYear: releaseYear,
|
||||
releaseCountry: _faker.PickRandom<ReleaseCountry>()) : null),
|
||||
genres ?? (includeOptionalProperties ? [_genreDtoFixture.Create()] : null),
|
||||
tags ?? (includeOptionalProperties ? [_tagDtoFixture.Create()] : null),
|
||||
language ?? (includeOptionalProperties ? _languageInfoDtoFixture.Create() : null),
|
||||
releaseCountry: _faker.PickRandom<ReleaseCountry>())) : null,
|
||||
includeGenres ? (genres ?? [_genreDtoFixture.Create()]) : null,
|
||||
includeTags ? (tags ?? [_tagDtoFixture.Create()]) : null,
|
||||
includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null,
|
||||
originalLanguage,
|
||||
publisher,
|
||||
pageCount,
|
||||
format ?? (includeOptionalProperties ? _faker.PickRandom<BookFormat>() : null),
|
||||
includeFormat ? (format ?? _faker.PickRandom<BookFormat>()) : null,
|
||||
edition,
|
||||
volumeNumber ?? (includeOptionalProperties ? _faker.Random.Int(1, 10) : null),
|
||||
includeVolumeNumber ? (volumeNumber ?? _faker.Random.Int(1, 10)) : null,
|
||||
series,
|
||||
asin,
|
||||
goodreadsId,
|
||||
|
||||
+7
-6
@@ -17,7 +17,6 @@ namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.
|
||||
public class BookRatingDtoFixture
|
||||
{
|
||||
private readonly Fixture _fixture = new();
|
||||
private readonly Random _random = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="BookRatingDto"/>.
|
||||
@@ -26,20 +25,22 @@ public class BookRatingDtoFixture
|
||||
/// <param name="maxValue">Optional. The maximum possible rating value.</param>
|
||||
/// <param name="source">Optional. The rating source.</param>
|
||||
/// <param name="voteCount">Optional. The number of votes.</param>
|
||||
/// <param name="includeOptionalProperties">Whether the optional source and vote count should be randomized, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSource">Whether the source should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeVoteCount">Whether the vote count should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="BookRatingDto"/>.</returns>
|
||||
public BookRatingDto Create(
|
||||
decimal? value = null,
|
||||
decimal? maxValue = null,
|
||||
BookRatingSource? source = null,
|
||||
int? voteCount = null,
|
||||
bool includeOptionalProperties = true)
|
||||
bool includeSource = true,
|
||||
bool includeVoteCount = true)
|
||||
{
|
||||
return new BookRatingDto(
|
||||
value ?? _random.Next(1, 5),
|
||||
value ?? Random.Shared.Next(1, 5),
|
||||
maxValue ?? 5,
|
||||
source ?? (includeOptionalProperties ? _fixture.Create<BookRatingSource>() : null),
|
||||
voteCount ?? (includeOptionalProperties ? _random.Next(1, 1000) : null)
|
||||
includeSource ? (source ?? _fixture.Create<BookRatingSource>()) : null,
|
||||
includeVoteCount ? (voteCount ?? Random.Shared.Next(1, 1000)) : null
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+30
-12
@@ -53,7 +53,16 @@ public class AddTrackRequestFixture
|
||||
/// <param name="includePath">Whether the path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeTrackNumber">Whether the track number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOptionalProperties">Whether the properties that are not explicitly provided should be randomized, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDiscNumber">Whether the disc number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeKey">Whether the musical key should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBpm">Whether the tempo should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to add a track.</returns>
|
||||
@@ -76,7 +85,16 @@ public class AddTrackRequestFixture
|
||||
bool includePath = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeTrackNumber = true,
|
||||
bool includeOptionalProperties = true,
|
||||
bool includeDiscNumber = true,
|
||||
bool includeScript = true,
|
||||
bool includeKey = true,
|
||||
bool includeBpm = true,
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMusicBrainzWorkId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true)
|
||||
{
|
||||
@@ -84,16 +102,16 @@ public class AddTrackRequestFixture
|
||||
includePath ? path ?? Path.Combine(Path.GetTempPath(), "lumina-tracks", _faker.System.FileName()) : null,
|
||||
includeMetadata ? metadata ?? _audioMetadataDtoFixture.Create() : null,
|
||||
includeTrackNumber ? trackNumber ?? _faker.Random.Int(1, 30) : null,
|
||||
includeOptionalProperties ? discNumber ?? _faker.Random.Int(1, 3) : null,
|
||||
includeOptionalProperties ? script ?? _faker.Random.AlphaNumeric(4) : null,
|
||||
includeOptionalProperties ? key ?? _faker.PickRandom<MusicKey>() : null,
|
||||
includeOptionalProperties ? bpm ?? _faker.Random.Int(40, 220) : null,
|
||||
includeOptionalProperties ? work ?? _faker.Lorem.Sentence() : null,
|
||||
includeOptionalProperties ? musicBrainzRecordingId ?? _faker.Random.Guid() : null,
|
||||
includeOptionalProperties ? musicBrainzTrackId ?? _faker.Random.Guid() : null,
|
||||
includeOptionalProperties ? musicBrainzWorkId ?? _faker.Random.Guid() : null,
|
||||
includeOptionalProperties ? moods ?? _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeOptionalProperties ? isrcs ?? _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeDiscNumber ? discNumber ?? _faker.Random.Int(1, 3) : null,
|
||||
includeScript ? script ?? _faker.Random.AlphaNumeric(4) : null,
|
||||
includeKey ? key ?? _faker.PickRandom<MusicKey>() : null,
|
||||
includeBpm ? bpm ?? _faker.Random.Int(40, 220) : null,
|
||||
includeWork ? work ?? _faker.Lorem.Sentence() : null,
|
||||
includeMusicBrainzRecordingId ? musicBrainzRecordingId ?? _faker.Random.Guid() : null,
|
||||
includeMusicBrainzTrackId ? musicBrainzTrackId ?? _faker.Random.Guid() : null,
|
||||
includeMusicBrainzWorkId ? musicBrainzWorkId ?? _faker.Random.Guid() : null,
|
||||
includeMoods ? moods ?? _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeIsrcs ? isrcs ?? _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeContributors ? contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeRatings ? ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null);
|
||||
}
|
||||
|
||||
+30
-12
@@ -49,7 +49,16 @@ public class UpdateTrackRequestFixture
|
||||
/// <param name="isrcs">Optional. The ISRC codes of the track.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that performed on the track.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the track.</param>
|
||||
/// <param name="includeOptionalProperties">Whether the optional properties that are not explicitly provided should be randomized, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDiscNumber">Whether the disc number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeKey">Whether the musical key should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBpm">Whether the tempo should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePath">Whether the path should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -72,7 +81,16 @@ public class UpdateTrackRequestFixture
|
||||
List<IsrcDto>? isrcs = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
bool includeOptionalProperties = true,
|
||||
bool includeDiscNumber = true,
|
||||
bool includeScript = true,
|
||||
bool includeKey = true,
|
||||
bool includeBpm = true,
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMusicBrainzWorkId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includePath = true,
|
||||
@@ -83,16 +101,16 @@ public class UpdateTrackRequestFixture
|
||||
includePath ? (path ?? _faker.System.FilePath()) : null,
|
||||
includeMetadata ? (metadata ?? _audioMetadataDtoFixture.Create()) : null,
|
||||
includeTrackNumber ? (trackNumber ?? _faker.Random.Int(1, 20)) : null,
|
||||
includeOptionalProperties ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
|
||||
includeOptionalProperties ? (script ?? _faker.Random.String2(_faker.Random.Number(1, 50))) : null,
|
||||
includeOptionalProperties ? (key ?? _faker.PickRandom<MusicKey>()) : null,
|
||||
includeOptionalProperties ? (bpm ?? _faker.Random.Int(40, 240)) : null,
|
||||
includeOptionalProperties ? (work ?? _faker.Music.Genre()) : null,
|
||||
includeOptionalProperties ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
|
||||
includeOptionalProperties ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
|
||||
includeOptionalProperties ? (musicBrainzWorkId ?? _faker.Random.Guid()) : null,
|
||||
includeOptionalProperties ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeOptionalProperties ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
|
||||
includeScript ? (script ?? _faker.Random.String2(_faker.Random.Number(1, 50))) : null,
|
||||
includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
|
||||
includeBpm ? (bpm ?? _faker.Random.Int(40, 240)) : null,
|
||||
includeWork ? (work ?? _faker.Music.Genre()) : null,
|
||||
includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzWorkId ? (musicBrainzWorkId ?? _faker.Random.Guid()) : null,
|
||||
includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null);
|
||||
}
|
||||
|
||||
+45
-17
@@ -49,7 +49,21 @@ public class AddBookRequestFixture
|
||||
/// <param name="isbns">Optional. The ISBNs of the book.</param>
|
||||
/// <param name="contributors">Optional. The contributors of the book.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the book.</param>
|
||||
/// <param name="includeOptionalProperties">Whether the properties that are not explicitly provided should be randomized, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFormat">Whether the format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeEdition">Whether the edition should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeVolumeNumber">Whether the volume number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoodreadsId">Whether the Goodreads Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLccn">Whether the LCCN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOclcNumber">Whether the OCLC number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOpenLibraryId">Whether the Open Library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLibraryThingId">Whether the LibraryThing Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoogleBooksId">Whether the Google Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarnesAndNobleId">Whether the Barnes and Noble Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAppleBooksId">Whether the Apple Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsbns">Whether the ISBNs should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to add a book.</returns>
|
||||
public AddBookRequest Create(
|
||||
string? path = null,
|
||||
@@ -70,7 +84,21 @@ public class AddBookRequestFixture
|
||||
List<IsbnDto>? isbns = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<BookRatingDto>? ratings = null,
|
||||
bool includeOptionalProperties = true)
|
||||
bool includeFormat = true,
|
||||
bool includeEdition = true,
|
||||
bool includeVolumeNumber = true,
|
||||
bool includeAsin = true,
|
||||
bool includeGoodreadsId = true,
|
||||
bool includeLccn = true,
|
||||
bool includeOclcNumber = true,
|
||||
bool includeOpenLibraryId = true,
|
||||
bool includeLibraryThingId = true,
|
||||
bool includeGoogleBooksId = true,
|
||||
bool includeBarnesAndNobleId = true,
|
||||
bool includeAppleBooksId = true,
|
||||
bool includeIsbns = true,
|
||||
bool includeRatings = true,
|
||||
bool includeContributors = true)
|
||||
{
|
||||
return new Faker<AddBookRequest>()
|
||||
.CustomInstantiator(f => new AddBookRequest(
|
||||
@@ -95,22 +123,22 @@ public class AddBookRequestFixture
|
||||
))
|
||||
.RuleFor(x => x.Path, f => path ?? Path.Combine(Path.GetTempPath(), "lumina-books", f.System.FileName()))
|
||||
.RuleFor(x => x.Metadata, metadata ?? _writtenContentMetadataDtoFixture.Create())
|
||||
.RuleFor(x => x.Format, f => format ?? (includeOptionalProperties ? f.PickRandom<BookFormat>() : 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.Format, f => format ?? (includeFormat ? f.PickRandom<BookFormat>() : null))
|
||||
.RuleFor(x => x.Edition, f => edition ?? (includeEdition ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.VolumeNumber, f => volumeNumber ?? (includeVolumeNumber ? (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 ? [.. _mediaContributorReferenceDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
|
||||
.RuleFor(x => x.ASIN, f => asin ?? (includeAsin ? f.Random.String2(10) : null))
|
||||
.RuleFor(x => x.GoodreadsId, f => goodreadsId ?? (includeGoodreadsId ? f.Random.Number(100000, 500000).ToString() : null))
|
||||
.RuleFor(x => x.LCCN, f => lccn ?? (includeLccn ? CreateLccn(f) : null))
|
||||
.RuleFor(x => x.OCLCNumber, f => oclcNumber ?? (includeOclcNumber ? CreateOclcNumber(f) : null))
|
||||
.RuleFor(x => x.OpenLibraryId, f => openLibraryId ?? (includeOpenLibraryId ? CreateOpenLibraryId(f) : null))
|
||||
.RuleFor(x => x.LibraryThingId, f => libraryThingId ?? (includeLibraryThingId ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.GoogleBooksId, f => googleBooksId ?? (includeGoogleBooksId ? CreateGoogleBooksId(f) : null))
|
||||
.RuleFor(x => x.BarnesAndNobleId, f => barnesAndNobleId ?? (includeBarnesAndNobleId ? f.Random.String2(10, "0123456789") : null))
|
||||
.RuleFor(x => x.AppleBooksId, f => appleBooksId ?? (includeAppleBooksId ? $"id{f.Random.Number(1, 999999)}" : null))
|
||||
.RuleFor(p => p.ISBNs, f => isbns ?? (includeIsbns ? [.. _isbnDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
|
||||
.RuleFor(p => p.Ratings, f => ratings ?? (includeRatings ? [.. _bookRatingDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
|
||||
.RuleFor(x => x.Contributors, f => contributors ?? (includeContributors ? [.. _mediaContributorReferenceDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+45
-17
@@ -47,7 +47,21 @@ public class UpdateBookRequestFixture
|
||||
/// <param name="isbns">Optional. The ISBNs of the book.</param>
|
||||
/// <param name="contributors">Optional. The contributors of the book.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the book.</param>
|
||||
/// <param name="includeOptionalProperties">Whether the properties that are not explicitly provided should be randomized, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFormat">Whether the format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeEdition">Whether the edition should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeVolumeNumber">Whether the volume number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoodreadsId">Whether the Goodreads Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLccn">Whether the LCCN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOclcNumber">Whether the OCLC number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOpenLibraryId">Whether the Open Library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLibraryThingId">Whether the LibraryThing Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoogleBooksId">Whether the Google Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarnesAndNobleId">Whether the Barnes and Noble Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAppleBooksId">Whether the Apple Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsbns">Whether the ISBNs should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to update a book.</returns>
|
||||
public UpdateBookRequest Create(
|
||||
WrittenContentMetadataDto? metadata = null,
|
||||
@@ -67,7 +81,21 @@ public class UpdateBookRequestFixture
|
||||
List<IsbnDto>? isbns = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<BookRatingDto>? ratings = null,
|
||||
bool includeOptionalProperties = true)
|
||||
bool includeFormat = true,
|
||||
bool includeEdition = true,
|
||||
bool includeVolumeNumber = true,
|
||||
bool includeAsin = true,
|
||||
bool includeGoodreadsId = true,
|
||||
bool includeLccn = true,
|
||||
bool includeOclcNumber = true,
|
||||
bool includeOpenLibraryId = true,
|
||||
bool includeLibraryThingId = true,
|
||||
bool includeGoogleBooksId = true,
|
||||
bool includeBarnesAndNobleId = true,
|
||||
bool includeAppleBooksId = true,
|
||||
bool includeIsbns = true,
|
||||
bool includeRatings = true,
|
||||
bool includeContributors = true)
|
||||
{
|
||||
return new Faker<UpdateBookRequest>()
|
||||
.CustomInstantiator(f => new UpdateBookRequest(
|
||||
@@ -90,22 +118,22 @@ public class UpdateBookRequestFixture
|
||||
default!
|
||||
))
|
||||
.RuleFor(x => x.Metadata, metadata ?? _writtenContentMetadataDtoFixture.Create())
|
||||
.RuleFor(x => x.Format, f => format ?? (includeOptionalProperties ? f.PickRandom<BookFormat>() : 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.Format, f => format ?? (includeFormat ? f.PickRandom<BookFormat>() : null))
|
||||
.RuleFor(x => x.Edition, f => edition ?? (includeEdition ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.VolumeNumber, f => volumeNumber ?? (includeVolumeNumber ? (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 ? [.. _mediaContributorReferenceDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
|
||||
.RuleFor(x => x.ASIN, f => asin ?? (includeAsin ? f.Random.String2(10) : null))
|
||||
.RuleFor(x => x.GoodreadsId, f => goodreadsId ?? (includeGoodreadsId ? f.Random.Number(100000, 500000).ToString() : null))
|
||||
.RuleFor(x => x.LCCN, f => lccn ?? (includeLccn ? CreateLccn(f) : null))
|
||||
.RuleFor(x => x.OCLCNumber, f => oclcNumber ?? (includeOclcNumber ? CreateOclcNumber(f) : null))
|
||||
.RuleFor(x => x.OpenLibraryId, f => openLibraryId ?? (includeOpenLibraryId ? CreateOpenLibraryId(f) : null))
|
||||
.RuleFor(x => x.LibraryThingId, f => libraryThingId ?? (includeLibraryThingId ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.GoogleBooksId, f => googleBooksId ?? (includeGoogleBooksId ? CreateGoogleBooksId(f) : null))
|
||||
.RuleFor(x => x.BarnesAndNobleId, f => barnesAndNobleId ?? (includeBarnesAndNobleId ? f.Random.String2(10, "0123456789") : null))
|
||||
.RuleFor(x => x.AppleBooksId, f => appleBooksId ?? (includeAppleBooksId ? $"id{f.Random.Number(1, 999999)}" : null))
|
||||
.RuleFor(p => p.ISBNs, f => isbns ?? (includeIsbns ? [.. _isbnDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
|
||||
.RuleFor(p => p.Ratings, f => ratings ?? (includeRatings ? [.. _bookRatingDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
|
||||
.RuleFor(x => x.Contributors, f => contributors ?? (includeContributors ? [.. _mediaContributorReferenceDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+5
-5
@@ -28,12 +28,12 @@ public class ThemeResponseFixture
|
||||
/// <param name="author">Optional. The author of the theme.</param>
|
||||
/// <param name="version">Optional. The version of the theme.</param>
|
||||
/// <param name="previewPath">Optional. The preview image path of the theme, or <see langword="null"/> when the theme has no preview.</param>
|
||||
/// <param name="includePreviewPath">Whether the preview path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="installSource">Optional. The source the theme was installed from.</param>
|
||||
/// <param name="isCurrent">Optional. Whether the theme is the currently active one.</param>
|
||||
/// <param name="includeIsCurrent">Whether the currently active flag should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="installedAtUtc">Optional. The UTC timestamp when the theme was installed.</param>
|
||||
/// <param name="isDeleted">Optional. Whether the theme was deleted by the user.</param>
|
||||
/// <param name="includePreviewPath">Whether the preview path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsCurrent">Whether the currently active flag should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="ThemeResponse"/>.</returns>
|
||||
public ThemeResponse Create(
|
||||
Guid? id = null,
|
||||
@@ -43,12 +43,12 @@ public class ThemeResponseFixture
|
||||
string? author = null,
|
||||
string? version = null,
|
||||
string? previewPath = null,
|
||||
bool includePreviewPath = false,
|
||||
ThemeInstallSource? installSource = null,
|
||||
bool? isCurrent = null,
|
||||
bool includeIsCurrent = false,
|
||||
DateTime? installedAtUtc = null,
|
||||
bool? isDeleted = null)
|
||||
bool? isDeleted = null,
|
||||
bool includePreviewPath = false,
|
||||
bool includeIsCurrent = false)
|
||||
{
|
||||
return new ThemeResponse(
|
||||
id ?? Guid.NewGuid(),
|
||||
|
||||
+5
-6
@@ -23,7 +23,6 @@ namespace Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedCo
|
||||
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();
|
||||
@@ -37,13 +36,13 @@ public class LibraryFixture
|
||||
/// <param name="libraryType">Optional. The library type.</param>
|
||||
/// <param name="contentLocations">Optional. The content locations of the library.</param>
|
||||
/// <param name="coverImage">Optional. The cover image of the library.</param>
|
||||
/// <param name="includeCoverImage">Whether the cover image should be included, or left unset, meaning the library has no cover.</param>
|
||||
/// <param name="isEnabled">Whether the library is enabled.</param>
|
||||
/// <param name="isLocked">Whether the library is locked.</param>
|
||||
/// <param name="canDownloadMetadataFromWeb">Whether metadata download from the web is enabled.</param>
|
||||
/// <param name="shouldSaveMetadataInMediaDirectories">Whether metadata should be saved in the media directories.</param>
|
||||
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged directories should be skipped during scan.</param>
|
||||
/// <param name="scanIds">Optional. The scan Ids associated with the library.</param>
|
||||
/// <param name="includeCoverImage">Whether the cover image should be included, or left unset, meaning the library has no cover.</param>
|
||||
/// <returns>The created <see cref="Library"/>.</returns>
|
||||
public Library Create(
|
||||
Guid? id = null,
|
||||
@@ -52,13 +51,13 @@ public class LibraryFixture
|
||||
LibraryType? libraryType = null,
|
||||
IEnumerable<string>? contentLocations = null,
|
||||
string? coverImage = null,
|
||||
bool includeCoverImage = true,
|
||||
bool isEnabled = true,
|
||||
bool isLocked = false,
|
||||
bool canDownloadMetadataFromWeb = true,
|
||||
bool shouldSaveMetadataInMediaDirectories = false,
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan = false,
|
||||
IEnumerable<Guid>? scanIds = null)
|
||||
IEnumerable<Guid>? scanIds = null,
|
||||
bool includeCoverImage = true)
|
||||
{
|
||||
List<string> validPaths =
|
||||
[
|
||||
@@ -77,7 +76,7 @@ public class LibraryFixture
|
||||
resolvedUserId,
|
||||
title ?? _faker.Random.String2(_faker.Random.Number(1, 50)),
|
||||
libraryType ?? _faker.PickRandom<LibraryType>(),
|
||||
contentLocations ?? validPaths.Take(_random.Next(1, validPaths.Count)),
|
||||
contentLocations ?? validPaths.Take(Random.Shared.Next(1, validPaths.Count)),
|
||||
Optional<string>.FromNullable(resolvedCoverImage),
|
||||
isEnabled,
|
||||
isLocked,
|
||||
@@ -91,7 +90,7 @@ public class LibraryFixture
|
||||
resolvedUserId,
|
||||
title ?? _faker.Random.String2(_faker.Random.Number(1, 50)),
|
||||
libraryType ?? _faker.PickRandom<LibraryType>(),
|
||||
contentLocations ?? validPaths.Take(_random.Next(1, validPaths.Count)),
|
||||
contentLocations ?? validPaths.Take(Random.Shared.Next(1, validPaths.Count)),
|
||||
Optional<string>.FromNullable(resolvedCoverImage),
|
||||
isEnabled,
|
||||
isLocked,
|
||||
|
||||
@@ -28,8 +28,8 @@ public sealed class ThemePackFixture
|
||||
/// <param name="templates">Optional template mappings written to the manifest.</param>
|
||||
/// <param name="preview">Optional preview path written to the manifest, or <see langword="null"/> to omit the preview.</param>
|
||||
/// <param name="defaultTemplateContent">Optional content for the default template file.</param>
|
||||
/// <param name="includePreviewAsset">Whether to include the preview asset file in the archive or not.</param>
|
||||
/// <param name="additionalFiles">Optional additional files written into the archive.</param>
|
||||
/// <param name="includePreviewAsset">Whether to include the preview asset file in the archive or not.</param>
|
||||
/// <returns>The created theme pack ZIP archive.</returns>
|
||||
public byte[] Create(
|
||||
string themeId = "test-theme",
|
||||
@@ -41,8 +41,8 @@ public sealed class ThemePackFixture
|
||||
Dictionary<string, string>? templates = null,
|
||||
string? preview = "assets/preview.png",
|
||||
string? defaultTemplateContent = null,
|
||||
bool includePreviewAsset = true,
|
||||
IReadOnlyDictionary<string, string>? additionalFiles = null)
|
||||
IReadOnlyDictionary<string, string>? additionalFiles = null,
|
||||
bool includePreviewAsset = true)
|
||||
{
|
||||
Dictionary<string, string> manifestTemplates = templates ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
|
||||
+5
-5
@@ -21,18 +21,18 @@ public class ThemeNavEntryDtoFixture
|
||||
/// </summary>
|
||||
/// <param name="label">Optional label of the entry.</param>
|
||||
/// <param name="url">Optional URL of the link, or <see langword="null"/> for a submenu.</param>
|
||||
/// <param name="includeUrl">Whether the URL should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="cssClass">Optional CSS classes of the link.</param>
|
||||
/// <param name="includeCssClass">Whether the CSS class should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="children">Optional child links of a submenu.</param>
|
||||
/// <param name="includeUrl">Whether the URL should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCssClass">Whether the CSS class should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="ThemeNavEntryDto"/>.</returns>
|
||||
public ThemeNavEntryDto Create(
|
||||
string? label = null,
|
||||
string? url = null,
|
||||
bool includeUrl = false,
|
||||
string? cssClass = null,
|
||||
bool includeCssClass = false,
|
||||
IReadOnlyList<ThemeNavEntryDto>? children = null)
|
||||
IReadOnlyList<ThemeNavEntryDto>? children = null,
|
||||
bool includeUrl = false,
|
||||
bool includeCssClass = false)
|
||||
{
|
||||
return new ThemeNavEntryDto(
|
||||
Label: label ?? _faker.Lorem.Word(),
|
||||
|
||||
+5
-5
@@ -28,12 +28,12 @@ public class ThemeResponseDtoFixture
|
||||
/// <param name="author">Optional author of the theme.</param>
|
||||
/// <param name="version">Optional semantic version of the theme.</param>
|
||||
/// <param name="previewPath">Optional preview image path of the theme, or <see langword="null"/> when the theme has no preview.</param>
|
||||
/// <param name="includePreviewPath">Whether the preview path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="installSource">Optional source the theme was installed from.</param>
|
||||
/// <param name="isCurrent">Optional value indicating whether the theme is the active one.</param>
|
||||
/// <param name="includeIsCurrent">Whether the currently active flag should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="installedAtUtc">Optional UTC timestamp at which the theme was installed.</param>
|
||||
/// <param name="isDeleted">Optional value indicating whether the theme was deleted by the user.</param>
|
||||
/// <param name="includePreviewPath">Whether the preview path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsCurrent">Whether the currently active flag should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="ThemeResponseDto"/> instance.</returns>
|
||||
public ThemeResponseDto Create(
|
||||
Guid? id = null,
|
||||
@@ -43,12 +43,12 @@ public class ThemeResponseDtoFixture
|
||||
string? author = null,
|
||||
string? version = null,
|
||||
string? previewPath = null,
|
||||
bool includePreviewPath = false,
|
||||
ThemeInstallSource? installSource = null,
|
||||
bool? isCurrent = null,
|
||||
bool includeIsCurrent = false,
|
||||
DateTime? installedAtUtc = null,
|
||||
bool? isDeleted = null)
|
||||
bool? isDeleted = null,
|
||||
bool includePreviewPath = false,
|
||||
bool includeIsCurrent = false)
|
||||
{
|
||||
return new ThemeResponseDto(
|
||||
Id: id ?? Guid.NewGuid(),
|
||||
|
||||
+51
-19
@@ -33,35 +33,67 @@ public class UpdateBookRequestFixture
|
||||
/// <param name="id">Optional Id of the book to update.</param>
|
||||
/// <param name="libraryId">Optional Id of the media library the book belongs to.</param>
|
||||
/// <param name="metadata">Optional written content metadata of the book.</param>
|
||||
/// <param name="includeOptionalProperties">Whether the properties that are not explicitly provided should be randomized, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFormat">Whether the format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeEdition">Whether the edition should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeVolumeNumber">Whether the volume number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSeries">Whether the series should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoodreadsId">Whether the Goodreads Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLccn">Whether the LCCN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOclcNumber">Whether the OCLC number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOpenLibraryId">Whether the Open Library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLibraryThingId">Whether the LibraryThing Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoogleBooksId">Whether the Google Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarnesAndNobleId">Whether the Barnes and Noble Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAppleBooksId">Whether the Apple Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsbns">Whether the ISBNs should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="UpdateBookRequest"/> instance.</returns>
|
||||
public UpdateBookRequest Create(
|
||||
Guid? id = null,
|
||||
Guid? libraryId = null,
|
||||
WrittenContentMetadataDto? metadata = null,
|
||||
bool includeOptionalProperties = true)
|
||||
bool includeMetadata = true,
|
||||
bool includeFormat = true,
|
||||
bool includeEdition = true,
|
||||
bool includeVolumeNumber = true,
|
||||
bool includeSeries = true,
|
||||
bool includeAsin = true,
|
||||
bool includeGoodreadsId = true,
|
||||
bool includeLccn = true,
|
||||
bool includeOclcNumber = true,
|
||||
bool includeOpenLibraryId = true,
|
||||
bool includeLibraryThingId = true,
|
||||
bool includeGoogleBooksId = true,
|
||||
bool includeBarnesAndNobleId = true,
|
||||
bool includeAppleBooksId = true,
|
||||
bool includeIsbns = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true)
|
||||
{
|
||||
return new UpdateBookRequest
|
||||
{
|
||||
BookId = id?.ToString() ?? Guid.NewGuid().ToString(),
|
||||
LibraryId = libraryId ?? Guid.NewGuid(),
|
||||
Metadata = metadata ?? (includeOptionalProperties ? _writtenContentMetadataDtoFixture.Create() : null),
|
||||
Format = includeOptionalProperties ? _faker.PickRandom<BookFormat>() : 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
|
||||
Metadata = includeMetadata ? (metadata ?? _writtenContentMetadataDtoFixture.Create()) : null,
|
||||
Format = includeFormat ? _faker.PickRandom<BookFormat>() : null,
|
||||
Edition = includeEdition ? _faker.Random.String2(_faker.Random.Number(1, 50)) : null,
|
||||
VolumeNumber = includeVolumeNumber ? _faker.Random.Number(1, 3) : null,
|
||||
Series = includeSeries ? _bookSeriesDtoFixture.Create() : null,
|
||||
ASIN = includeAsin ? _faker.Random.String2(10) : null,
|
||||
GoodreadsId = includeGoodreadsId ? _faker.Random.Number(100000, 500000).ToString() : null,
|
||||
LCCN = includeLccn ? "n78890351" : null,
|
||||
OCLCNumber = includeOclcNumber ? "ocm12345678" : null,
|
||||
OpenLibraryId = includeOpenLibraryId ? "OL123456M" : null,
|
||||
LibraryThingId = includeLibraryThingId ? _faker.Random.String2(_faker.Random.Number(1, 50)) : null,
|
||||
GoogleBooksId = includeGoogleBooksId ? CreateGoogleBooksId() : null,
|
||||
BarnesAndNobleId = includeBarnesAndNobleId ? _faker.Random.String2(10, "0123456789") : null,
|
||||
AppleBooksId = includeAppleBooksId ? $"id{_faker.Random.Number(1, 999999)}" : null,
|
||||
ISBNs = includeIsbns ? [.. _isbnDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null,
|
||||
Contributors = includeContributors ? [.. _mediaContributorDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null,
|
||||
Ratings = includeRatings ? [.. _bookRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+17
-3
@@ -121,7 +121,14 @@ public class UpdateTrackEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
isrcs: [],
|
||||
contributors: [],
|
||||
ratings: [],
|
||||
includeOptionalProperties: false);
|
||||
includeDiscNumber: false,
|
||||
includeScript: false,
|
||||
includeKey: false,
|
||||
includeBpm: false,
|
||||
includeWork: false,
|
||||
includeMusicBrainzRecordingId: false,
|
||||
includeMusicBrainzTrackId: false,
|
||||
includeMusicBrainzWorkId: false);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}", request);
|
||||
@@ -157,7 +164,14 @@ public class UpdateTrackEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
isrcs: [],
|
||||
contributors: [],
|
||||
ratings: [],
|
||||
includeOptionalProperties: false);
|
||||
includeDiscNumber: false,
|
||||
includeScript: false,
|
||||
includeKey: false,
|
||||
includeBpm: false,
|
||||
includeWork: false,
|
||||
includeMusicBrainzRecordingId: false,
|
||||
includeMusicBrainzTrackId: false,
|
||||
includeMusicBrainzWorkId: false);
|
||||
(HttpClient adminClient, _) = await CreateAdminClientAsync();
|
||||
|
||||
// Act
|
||||
@@ -1039,7 +1053,7 @@ public class UpdateTrackEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
string content = await response.Content.ReadAsStringAsync();
|
||||
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
|
||||
Assert.NotNull(problemDetails);
|
||||
Assert.Equal(422, problemDetails!["status"].GetInt32());
|
||||
Assert.Equal((int)HttpStatusCode.UnprocessableEntity, problemDetails!["status"].GetInt32());
|
||||
Assert.Equal("General.Validation", problemDetails["title"].GetString());
|
||||
Assert.Equal("OneOrMoreValidationErrorsOccurred", problemDetails["detail"].GetString());
|
||||
|
||||
|
||||
+16
-16
@@ -702,7 +702,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyFormat_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
@@ -725,7 +725,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyEdition_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
@@ -748,7 +748,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyVolumeNumber_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
@@ -812,7 +812,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyAsin_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
@@ -835,7 +835,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyGoodreadsId_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
@@ -858,7 +858,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyLccn_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
@@ -881,7 +881,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyOclcNumber_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
@@ -904,7 +904,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyOpenLibraryId_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
@@ -927,7 +927,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyLibraryThingId_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
@@ -950,7 +950,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyGoogleBooksId_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
@@ -986,7 +986,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyBarnesAndNobleId_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
@@ -1022,7 +1022,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyAppleBooksId_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
@@ -1045,7 +1045,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithNullIsbns_ShouldReturnUnprocessableEntity()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await PostBookAsync(bookRequest);
|
||||
@@ -1148,7 +1148,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithNullRatings_ShouldReturnUnprocessableEntity()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await PostBookAsync(bookRequest);
|
||||
@@ -1197,7 +1197,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
public async Task AddBook_WhenCalledWithEmptyRatingVoteCount_ShouldAddBook()
|
||||
{
|
||||
// Arrange
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(source: BookRatingSource.Goodreads, includeOptionalProperties: false)]);
|
||||
AddBookRequest bookRequest = _requestBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(source: BookRatingSource.Goodreads, includeVoteCount: false)]);
|
||||
// Act & Assert
|
||||
await AssertCreated(bookRequest);
|
||||
}
|
||||
@@ -1838,7 +1838,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
|
||||
private async Task AssertUnprocessableEntityWithValidationErrors(HttpResponseMessage response, params string[] expectedErrorCodes)
|
||||
{
|
||||
Assert.Equal(HttpStatusCode.UnprocessableContent, response.StatusCode);
|
||||
Assert.Equal(HttpStatusCode.UnprocessableEntity, response.StatusCode);
|
||||
Assert.Equal("application/problem+json", response.Content.Headers.ContentType?.MediaType);
|
||||
|
||||
string content = await response.Content.ReadAsStringAsync();
|
||||
|
||||
+9
-10
@@ -92,7 +92,7 @@ public class UpdateBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
// Arrange
|
||||
Guid userId = GetCurrentUserId();
|
||||
(Guid libraryId, Guid bookId) = await SeedLibraryAndBookAsync(userId, "Original Title");
|
||||
UpdateBookRequest request = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(title: "Updated Title"), isbns: [], contributors: [], ratings: [], includeOptionalProperties: false);
|
||||
UpdateBookRequest request = _requestBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(title: "Updated Title"), isbns: [], contributors: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/libraries/{libraryId}/books/{bookId}", request);
|
||||
@@ -125,7 +125,7 @@ public class UpdateBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
_mediaContributorReferenceDtoFixture.Create(contributorId: contributorId, role: MediaContributorRole.Illustrator)
|
||||
];
|
||||
await SeedContributorsAsync(duplicatedContributors);
|
||||
UpdateBookRequest request = _requestBookFixture.Create(contributors: duplicatedContributors, isbns: [], ratings: [], includeOptionalProperties: false);
|
||||
UpdateBookRequest request = _requestBookFixture.Create(contributors: duplicatedContributors, isbns: [], ratings: [], includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/libraries/{libraryId}/books/{bookId}", request);
|
||||
@@ -134,11 +134,10 @@ public class UpdateBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
|
||||
List<BookContributorEntity> links = dbContext.Books
|
||||
List<BookContributorEntity> links = [.. dbContext.Books
|
||||
.Include(book => book.Contributors)
|
||||
.Single(book => book.Id == bookId)
|
||||
.Contributors
|
||||
.ToList();
|
||||
.Contributors];
|
||||
Assert.Equal(2, links.Count);
|
||||
Assert.All(links, link => Assert.Equal(contributorId, link.MediaContributorId));
|
||||
Assert.Contains(links, link => link.Role == MediaContributorRole.Author);
|
||||
@@ -1563,7 +1562,7 @@ public class UpdateBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
public async Task UpdateBook_WhenCalledWithNullIsbns_ShouldReturnUnprocessableEntity()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookRequest bookRequest = _requestBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookRequest bookRequest = _requestBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await PutBookAsync(bookRequest);
|
||||
@@ -1706,7 +1705,7 @@ public class UpdateBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
public async Task UpdateBook_WhenCalledWithNullRatings_ShouldReturnUnprocessableEntity()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookRequest bookRequest = _requestBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookRequest bookRequest = _requestBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await PutBookAsync(bookRequest);
|
||||
@@ -1784,7 +1783,7 @@ public class UpdateBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
public async Task UpdateBook_WhenCalledWithNullVoteCount_ShouldUpdateBook()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookRequest bookRequest = _requestBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(source: BookRatingSource.Goodreads, includeOptionalProperties: false)]);
|
||||
UpdateBookRequest bookRequest = _requestBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(source: BookRatingSource.Goodreads, includeVoteCount: false)]);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await PutBookAsync(bookRequest);
|
||||
@@ -1853,7 +1852,7 @@ public class UpdateBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
string content = await response.Content.ReadAsStringAsync();
|
||||
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
|
||||
Assert.NotNull(problemDetails);
|
||||
Assert.Equal(422, problemDetails!["status"].GetInt32());
|
||||
Assert.Equal((int)HttpStatusCode.UnprocessableEntity, problemDetails!["status"].GetInt32());
|
||||
Assert.Equal("General.Validation", problemDetails["title"].GetString());
|
||||
Assert.Equal("OneOrMoreValidationErrorsOccurred", problemDetails["detail"].GetString());
|
||||
|
||||
@@ -1937,4 +1936,4 @@ public class UpdateBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
{
|
||||
await _apiFactory.RemoveTestUserAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-1
@@ -63,7 +63,16 @@ public class AddTrackRequestMappingTests
|
||||
AddTrackRequest request = _addTrackRequestFixture.Create(
|
||||
path: "/music/queen/bohemian-rhapsody.flac",
|
||||
metadata: _audioMetadataDtoFixture.Create(title: "Love of My Life"),
|
||||
includeOptionalProperties: false);
|
||||
includeDiscNumber: false,
|
||||
includeScript: false,
|
||||
includeKey: false,
|
||||
includeBpm: false,
|
||||
includeWork: false,
|
||||
includeMusicBrainzRecordingId: false,
|
||||
includeMusicBrainzTrackId: false,
|
||||
includeMusicBrainzWorkId: false,
|
||||
includeMoods: false,
|
||||
includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
AddTrackCommand result = request.ToCommand(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ public class UpdateTrackCommandMappingTests
|
||||
Guid libraryId = Guid.NewGuid();
|
||||
(Artist artist, Guid albumId, Guid trackId) = CreateDomainArtist(libraryId);
|
||||
string updatedPath = "/music/queen/a-night-at-the-opera/03-you-re-my-best-friend.flac";
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(libraryId: libraryId.ToString(), artistId: artist.Id.Value.ToString(), albumId: albumId.ToString(), trackId: trackId.ToString(), path: updatedPath, includeOptionalProperties: false, contributors: [], ratings: []);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(libraryId: libraryId.ToString(), artistId: artist.Id.Value.ToString(), albumId: albumId.ToString(), trackId: trackId.ToString(), path: updatedPath, includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false, contributors: [], ratings: []);
|
||||
|
||||
// Act
|
||||
Result<Artist> result = command.ToDomainEntity(artist);
|
||||
|
||||
+21
-2
@@ -63,7 +63,19 @@ public class UpdateTrackRequestMappingTests
|
||||
Guid artistId = Guid.NewGuid();
|
||||
Guid albumId = Guid.NewGuid();
|
||||
Guid trackId = Guid.NewGuid();
|
||||
UpdateTrackRequest request = _updateTrackRequestFixture.Create(includeOptionalProperties: false, contributors: [], ratings: []);
|
||||
UpdateTrackRequest request = _updateTrackRequestFixture.Create(
|
||||
includeDiscNumber: false,
|
||||
includeScript: false,
|
||||
includeKey: false,
|
||||
includeBpm: false,
|
||||
includeWork: false,
|
||||
includeMusicBrainzRecordingId: false,
|
||||
includeMusicBrainzTrackId: false,
|
||||
includeMusicBrainzWorkId: false,
|
||||
includeMoods: false,
|
||||
includeIsrcs: false,
|
||||
contributors: [],
|
||||
ratings: []);
|
||||
|
||||
// Act
|
||||
UpdateTrackCommand result = request.ToCommand(libraryId.ToString(), artistId.ToString(), albumId.ToString(), trackId.ToString());
|
||||
@@ -103,7 +115,14 @@ public class UpdateTrackRequestMappingTests
|
||||
isrcs: [new("GBUM71029604")],
|
||||
contributors: [new(Guid.NewGuid(), MediaContributorRole.Vocals)],
|
||||
ratings: [new(4.5m, 5m, AudioRatingSource.MusicBrainz, 1000)],
|
||||
includeOptionalProperties: false);
|
||||
includeDiscNumber: false,
|
||||
includeScript: false,
|
||||
includeKey: false,
|
||||
includeBpm: false,
|
||||
includeWork: false,
|
||||
includeMusicBrainzRecordingId: false,
|
||||
includeMusicBrainzTrackId: false,
|
||||
includeMusicBrainzWorkId: false);
|
||||
|
||||
// Act
|
||||
UpdateTrackCommand result = request.ToCommand(libraryId.ToString(), artistId.ToString(), albumId.ToString(), trackId.ToString());
|
||||
|
||||
+13
-2
@@ -62,7 +62,18 @@ public class AddBookCommandMappingTests
|
||||
isbns: [],
|
||||
contributors: [],
|
||||
ratings: [],
|
||||
includeOptionalProperties: false);
|
||||
includeFormat: false,
|
||||
includeEdition: false,
|
||||
includeVolumeNumber: false,
|
||||
includeAsin: false,
|
||||
includeGoodreadsId: false,
|
||||
includeLccn: false,
|
||||
includeOclcNumber: false,
|
||||
includeOpenLibraryId: false,
|
||||
includeLibraryThingId: false,
|
||||
includeGoogleBooksId: false,
|
||||
includeBarnesAndNobleId: false,
|
||||
includeAppleBooksId: false);
|
||||
|
||||
// Act
|
||||
Result<Book> result = command.ToDomainEntity(libraryId);
|
||||
@@ -92,7 +103,7 @@ public class AddBookCommandMappingTests
|
||||
public void ToDomainEntity_WhenRatingCreationFails_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand command = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeOptionalProperties: false)]);
|
||||
AddBookCommand command = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeSource: false, includeVoteCount: false)]);
|
||||
|
||||
// Act
|
||||
Result<Book> result = command.ToDomainEntity(Guid.NewGuid());
|
||||
|
||||
+27
-2
@@ -64,7 +64,21 @@ public class AddBookRequestMappingTests
|
||||
AddBookRequest request = _requestFixture.Create(
|
||||
path: "/books/test.epub",
|
||||
metadata: _writtenContentMetadataDtoFixture.Create(title: "Test Book"),
|
||||
includeOptionalProperties: false
|
||||
includeFormat: false,
|
||||
includeEdition: false,
|
||||
includeVolumeNumber: false,
|
||||
includeAsin: false,
|
||||
includeGoodreadsId: false,
|
||||
includeLccn: false,
|
||||
includeOclcNumber: false,
|
||||
includeOpenLibraryId: false,
|
||||
includeLibraryThingId: false,
|
||||
includeGoogleBooksId: false,
|
||||
includeBarnesAndNobleId: false,
|
||||
includeAppleBooksId: false,
|
||||
includeIsbns: false,
|
||||
includeRatings: false,
|
||||
includeContributors: false
|
||||
);
|
||||
|
||||
// Act
|
||||
@@ -105,7 +119,18 @@ public class AddBookRequestMappingTests
|
||||
_mediaContributorReferenceDtoFixture.Create(role: MediaContributorRole.Author)
|
||||
],
|
||||
ratings: [new(4.5m, 5m, BookRatingSource.Goodreads, 1000)],
|
||||
includeOptionalProperties: false
|
||||
includeFormat: false,
|
||||
includeEdition: false,
|
||||
includeVolumeNumber: false,
|
||||
includeAsin: false,
|
||||
includeGoodreadsId: false,
|
||||
includeLccn: false,
|
||||
includeOclcNumber: false,
|
||||
includeOpenLibraryId: false,
|
||||
includeLibraryThingId: false,
|
||||
includeGoogleBooksId: false,
|
||||
includeBarnesAndNobleId: false,
|
||||
includeAppleBooksId: false
|
||||
);
|
||||
|
||||
// Act
|
||||
|
||||
+10
-5
@@ -24,6 +24,7 @@ public class BookMetadataDtoMappingTests
|
||||
private readonly BookFixture _bookFixture = new();
|
||||
private readonly BookMetadataDtoFixture _bookMetadataDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void ApplyMetadata_WhenCalledWithValidMetadata_ShouldApplyItToTheBook()
|
||||
@@ -76,7 +77,7 @@ public class BookMetadataDtoMappingTests
|
||||
{
|
||||
// Arrange
|
||||
Book book = _bookFixture.Create();
|
||||
BookMetadataDto metadata = _bookMetadataDtoFixture.Create(title: title, includeOptionalProperties: false);
|
||||
BookMetadataDto metadata = _bookMetadataDtoFixture.Create(includeTitle: title is not null, title: title, includeReleaseInfo: false, includeGenres: false, includeTags: false, includeLanguage: false, includeFormat: false, includeVolumeNumber: false);
|
||||
|
||||
// Act
|
||||
Result<Success> result = book.ApplyMetadata(metadata);
|
||||
@@ -91,7 +92,7 @@ public class BookMetadataDtoMappingTests
|
||||
{
|
||||
// Arrange
|
||||
Book book = _bookFixture.Create();
|
||||
BookMetadataDto metadata = _bookMetadataDtoFixture.Create(title: "A valid title", includeOptionalProperties: false);
|
||||
BookMetadataDto metadata = _bookMetadataDtoFixture.Create(title: "A valid title", includeReleaseInfo: false, includeGenres: false, includeTags: false, includeLanguage: false, includeFormat: false, includeVolumeNumber: false);
|
||||
|
||||
// Act
|
||||
Result<Success> result = book.ApplyMetadata(metadata);
|
||||
@@ -108,7 +109,7 @@ public class BookMetadataDtoMappingTests
|
||||
Book book = _bookFixture.Create();
|
||||
BookMetadataDto metadata = _bookMetadataDtoFixture.Create(
|
||||
title: "A valid title",
|
||||
releaseInfo: new ReleaseInfoDto(new DateOnly(2000, 1, 1), 1999, null, null, null, null));
|
||||
releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2000, 1, 1), originalReleaseYear: 1999));
|
||||
|
||||
// Act
|
||||
Result<Success> result = book.ApplyMetadata(metadata);
|
||||
@@ -173,8 +174,12 @@ public class BookMetadataDtoMappingTests
|
||||
Book book = _bookFixture.Create();
|
||||
BookMetadataDto metadata = _bookMetadataDtoFixture.Create(
|
||||
title: "A valid title",
|
||||
releaseInfo: new ReleaseInfoDto(new DateOnly(2000, 1, 1), 2000, null, null, null, null),
|
||||
includeOptionalProperties: false);
|
||||
releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2000, 1, 1), originalReleaseYear: 2000),
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false);
|
||||
|
||||
// Act
|
||||
Result<Success> result = book.ApplyMetadata(metadata);
|
||||
|
||||
+13
-2
@@ -72,7 +72,18 @@ public class UpdateBookCommandMappingTests
|
||||
isbns: [],
|
||||
contributors: [],
|
||||
ratings: [],
|
||||
includeOptionalProperties: false);
|
||||
includeFormat: false,
|
||||
includeEdition: false,
|
||||
includeVolumeNumber: false,
|
||||
includeAsin: false,
|
||||
includeGoodreadsId: false,
|
||||
includeLccn: false,
|
||||
includeOclcNumber: false,
|
||||
includeOpenLibraryId: false,
|
||||
includeLibraryThingId: false,
|
||||
includeGoogleBooksId: false,
|
||||
includeBarnesAndNobleId: false,
|
||||
includeAppleBooksId: false);
|
||||
BookEntity existingBook = _bookEntityFixture.Create(id: bookId, libraryId: libraryId, path: "/books/the-book.epub");
|
||||
|
||||
// Act
|
||||
@@ -104,7 +115,7 @@ public class UpdateBookCommandMappingTests
|
||||
public void ToDomainEntity_WhenRatingCreationFails_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand command = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeOptionalProperties: false)]);
|
||||
UpdateBookCommand command = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeSource: false, includeVoteCount: false)]);
|
||||
BookEntity existingBook = _bookEntityFixture.Create();
|
||||
|
||||
// Act
|
||||
|
||||
+14
-3
@@ -61,7 +61,7 @@ public class UpdateBookRequestMappingTests
|
||||
// Arrange
|
||||
Guid libraryId = Guid.NewGuid();
|
||||
Guid bookId = Guid.NewGuid();
|
||||
UpdateBookRequest request = _requestFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookRequest request = _requestFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
UpdateBookCommand result = request.ToCommand(libraryId.ToString(), bookId.ToString());
|
||||
@@ -102,7 +102,18 @@ public class UpdateBookRequestMappingTests
|
||||
_mediaContributorReferenceDtoFixture.Create(role: MediaContributorRole.Author)
|
||||
],
|
||||
ratings: [new(4.5m, 5m, BookRatingSource.Goodreads, 1000)],
|
||||
includeOptionalProperties: false
|
||||
includeFormat: false,
|
||||
includeEdition: false,
|
||||
includeVolumeNumber: false,
|
||||
includeAsin: false,
|
||||
includeGoodreadsId: false,
|
||||
includeLccn: false,
|
||||
includeOclcNumber: false,
|
||||
includeOpenLibraryId: false,
|
||||
includeLibraryThingId: false,
|
||||
includeGoogleBooksId: false,
|
||||
includeBarnesAndNobleId: false,
|
||||
includeAppleBooksId: false
|
||||
);
|
||||
|
||||
// Act
|
||||
@@ -119,7 +130,7 @@ public class UpdateBookRequestMappingTests
|
||||
public void ToCommand_WhenRouteValuesAreNotParseable_ShouldMapThemAsIs()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookRequest request = _requestFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookRequest request = _requestFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
UpdateBookCommand result = request.ToCommand("not-a-library-guid", "not-a-guid");
|
||||
|
||||
+3
-3
@@ -56,7 +56,7 @@ public class BookRatingDtoMappingTests
|
||||
public void ToDomainEntity_WhenMappingMinimalBookRatingDto_ShouldMapRequiredPropertiesCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
BookRatingDto dto = _bookRatingDtoFixture.Create(includeOptionalProperties: false);
|
||||
BookRatingDto dto = _bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false);
|
||||
|
||||
// Act
|
||||
Result<BookRating> result = dto.ToDomainEntity();
|
||||
@@ -90,7 +90,7 @@ public class BookRatingDtoMappingTests
|
||||
List<BookRatingDto> dtos =
|
||||
[
|
||||
_bookRatingDtoFixture.Create(),
|
||||
_bookRatingDtoFixture.Create(includeOptionalProperties: false)
|
||||
_bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false)
|
||||
];
|
||||
|
||||
// Act
|
||||
@@ -125,7 +125,7 @@ public class BookRatingDtoMappingTests
|
||||
[
|
||||
_bookRatingDtoFixture.Create(),
|
||||
_bookRatingDtoFixture.Create(value: 10, maxValue: 5),
|
||||
_bookRatingDtoFixture.Create(includeOptionalProperties: false)
|
||||
_bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false)
|
||||
];
|
||||
|
||||
// Act
|
||||
|
||||
+10
-10
@@ -419,7 +419,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenOriginalReleaseYearIsLessThan1_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, 0, null, null, null, null)));
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 0)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -432,7 +432,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenOriginalReleaseYearIsGreaterThan9999_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, 10000, null, null, null, null)));
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 10000)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -458,7 +458,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenReReleaseYearIsLessThan1_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, null, null, 0, null, null)));
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 0)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -471,7 +471,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenReReleaseYearIsGreaterThan9999_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, null, null, 10000, null, null)));
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 10000)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -943,7 +943,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzRecordingIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1054,7 +1054,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenDiscNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1093,7 +1093,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenScriptIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1132,7 +1132,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenKeyIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1173,7 +1173,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenBpmIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1212,7 +1212,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenWorkIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
+8
-8
@@ -1175,7 +1175,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzRecordingIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1214,7 +1214,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzTrackIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1253,7 +1253,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzWorkIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1357,7 +1357,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenDiscNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1396,7 +1396,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenScriptIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1435,7 +1435,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenKeyIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1487,7 +1487,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenBpmIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1526,7 +1526,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenWorkIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
+1
-1
@@ -226,7 +226,7 @@ public class AddBookCommandHandlerTests
|
||||
public async Task HandleAsync_WhenCalledWithInvalidRating_ShouldReturnFailureResult()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeOptionalProperties: false)]);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeSource: false, includeVoteCount: false)]);
|
||||
|
||||
// Act
|
||||
Result<BookResponse> result = await _sut.HandleAsync(bookCommand, CancellationToken.None);
|
||||
|
||||
+19
-19
@@ -210,7 +210,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenOriginalReleaseYearIsLessThan1_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, 0, null, null, null, null)));
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 0)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -223,7 +223,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenOriginalReleaseYearIsGreaterThan9999_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, 10000, null, null, null, null)));
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 10000)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -249,7 +249,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenReReleaseYearIsLessThan1_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, null, null, 0, null, null)));
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 0)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -262,7 +262,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenReReleaseYearIsGreaterThan9999_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, null, null, 10000, null, null)));
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 10000)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -756,7 +756,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenFormatIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -795,7 +795,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenEditionIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -834,7 +834,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenVolumeNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -954,7 +954,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenAsinIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -980,7 +980,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenGoodreadsIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1045,7 +1045,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenLccnIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1110,7 +1110,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyOclcNumber_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1201,7 +1201,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenOpenLibraryIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1266,7 +1266,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyLibraryThingId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1305,7 +1305,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyGoogleBooksId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1357,7 +1357,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyBarnesAndNobleId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1409,7 +1409,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyAppleBooksId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1448,7 +1448,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithNullIsbns_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1591,7 +1591,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithNullRatings_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1669,7 +1669,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithNullVoteCount_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(includeOptionalProperties: false)]);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
|
||||
+1
-1
@@ -343,7 +343,7 @@ public class UpdateBookCommandHandlerTests
|
||||
public async Task HandleAsync_WhenCalledWithInvalidRating_ShouldReturnFailureResult()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand command = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeOptionalProperties: false)]);
|
||||
UpdateBookCommand command = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeSource: false, includeVoteCount: false)]);
|
||||
BookEntity existingBook = _bookEntityFixture.Create(id: Guid.Parse(command.BookId!), libraryId: Guid.Parse(command.LibraryId!));
|
||||
_mockBookRepository.GetByIdAsync(Arg.Any<Guid>(), Arg.Any<bool>(), Arg.Any<bool>(), Arg.Any<CancellationToken>())
|
||||
.Returns(Result.From<BookEntity?>(existingBook));
|
||||
|
||||
+19
-19
@@ -197,7 +197,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenOriginalReleaseYearIsLessThan1_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, 0, null, null, null, null)));
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 0)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -210,7 +210,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenOriginalReleaseYearIsGreaterThan9999_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, 10000, null, null, null, null)));
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 10000)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -236,7 +236,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenReReleaseYearIsLessThan1_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, null, null, 0, null, null)));
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 0)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -249,7 +249,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenReReleaseYearIsGreaterThan9999_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, null, null, 10000, null, null)));
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 10000)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -743,7 +743,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenFormatIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -782,7 +782,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenEditionIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -821,7 +821,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenVolumeNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -941,7 +941,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenAsinIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -967,7 +967,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenGoodreadsIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1032,7 +1032,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenLccnIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1097,7 +1097,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyOclcNumber_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1188,7 +1188,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenOpenLibraryIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1253,7 +1253,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyLibraryThingId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1292,7 +1292,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyGoogleBooksId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1344,7 +1344,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyBarnesAndNobleId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1396,7 +1396,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyAppleBooksId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1435,7 +1435,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithNullIsbns_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1578,7 +1578,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithNullRatings_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1656,7 +1656,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithNullVoteCount_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(includeOptionalProperties: false)]);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public class BookRatingDtoTests
|
||||
public void Create_WhenOmittingOptionalProperties_ShouldReturnNullSourceAndVoteCount()
|
||||
{
|
||||
// Act
|
||||
BookRatingDto sut = _bookRatingDtoFixture.Create(includeOptionalProperties: false);
|
||||
BookRatingDto sut = _bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false);
|
||||
|
||||
// Assert
|
||||
Assert.Null(sut.Source);
|
||||
|
||||
+281
-32
@@ -32,7 +32,11 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothMetadataHaveScalarValues_ShouldKeepTheFirstValues()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(includeOptionalProperties: false,
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
title: "First Title",
|
||||
originalTitle: "First Original Title",
|
||||
description: "First Description",
|
||||
@@ -51,7 +55,11 @@ public class MetadataAggregatorTests
|
||||
barnesAndNobleId: "FIRST-BN",
|
||||
appleBooksId: "FIRST-APPLE",
|
||||
coverImagePath: "First Cover");
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(includeOptionalProperties: false,
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
title: "Second Title",
|
||||
originalTitle: "Second Original Title",
|
||||
description: "Second Description",
|
||||
@@ -99,8 +107,29 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenFirstHasNullScalars_ShouldFallBackToTheSecondValues()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(includeOptionalProperties: false, title: null, description: null, publisher: null, pageCount: null);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(includeOptionalProperties: false, title: "Second Title", description: "Second Description", publisher: "Second Publisher", pageCount: 200);
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeTitle: false,
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: null,
|
||||
description: null,
|
||||
publisher: null,
|
||||
pageCount: null);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Second Title",
|
||||
description: "Second Description",
|
||||
publisher: "Second Publisher",
|
||||
pageCount: 200);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -116,8 +145,26 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveNullScalars_ShouldReturnNullScalars()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(includeOptionalProperties: false, title: null, coverImagePath: null);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(includeOptionalProperties: false, title: null, coverImagePath: null);
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeTitle: false,
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: null,
|
||||
coverImagePath: null);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeTitle: false,
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: null,
|
||||
coverImagePath: null);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -137,10 +184,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveReleaseInfo_ShouldCoalesceEachField()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false);
|
||||
first = first with { ReleaseInfo = _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2001, 1, 1), originalReleaseYear: 2001, releaseCountry: ReleaseCountry.US) };
|
||||
second = second with { ReleaseInfo = _releaseInfoDtoFixture.Create(reReleaseDate: new DateOnly(2010, 5, 5), reReleaseYear: 2010, releaseCountry: ReleaseCountry.GB, releaseVersion: "2.0") };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2001, 1, 1), originalReleaseYear: 2001, releaseCountry: ReleaseCountry.US));
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
releaseInfo: _releaseInfoDtoFixture.Create(reReleaseDate: new DateOnly(2010, 5, 5), reReleaseYear: 2010, releaseCountry: ReleaseCountry.GB, releaseVersion: "2.0"));
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -158,8 +219,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenFirstReleaseInfoIsNull_ShouldUseTheSecondReleaseInfo()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { ReleaseInfo = null };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { ReleaseInfo = _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2001, 1, 1), originalReleaseYear: 2001) };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2001, 1, 1), originalReleaseYear: 2001));
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -172,8 +249,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothReleaseInfosAreNull_ShouldReturnNullReleaseInfo()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { ReleaseInfo = null };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { ReleaseInfo = null };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -186,8 +279,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveGenres_ShouldUnionAndDeDuplicateByName()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Genres = [_genreDtoFixture.Create(name: "Science fiction"), _genreDtoFixture.Create(name: "Space opera")] };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Genres = [_genreDtoFixture.Create(name: "Science fiction"), _genreDtoFixture.Create(name: "Fantasy")] };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
genres: [_genreDtoFixture.Create(name: "Science fiction"), _genreDtoFixture.Create(name: "Space opera")]);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
genres: [_genreDtoFixture.Create(name: "Science fiction"), _genreDtoFixture.Create(name: "Fantasy")]);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -203,8 +312,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveTags_ShouldUnionAndDeDuplicateByName()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = [_tagDtoFixture.Create(name: "Tag A"), _tagDtoFixture.Create(name: "Tag B")] };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = [_tagDtoFixture.Create(name: "Tag A"), _tagDtoFixture.Create(name: "Tag C")] };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
tags: [_tagDtoFixture.Create(name: "Tag A"), _tagDtoFixture.Create(name: "Tag B")]);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
tags: [_tagDtoFixture.Create(name: "Tag A"), _tagDtoFixture.Create(name: "Tag C")]);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -220,8 +345,26 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveIsbns_ShouldUnionAndDeDuplicateByValue()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Isbns = [_isbnDtoFixture.Create(value: "9780306406157", format: IsbnFormat.Isbn13)] };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Isbns = [_isbnDtoFixture.Create(value: "9780306406157", format: IsbnFormat.Isbn13), _isbnDtoFixture.Create(value: "0306406152", format: IsbnFormat.Isbn10)] };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
isbns: [_isbnDtoFixture.Create(value: "9780306406157", format: IsbnFormat.Isbn13)]);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
isbns: [_isbnDtoFixture.Create(value: "9780306406157", format: IsbnFormat.Isbn13), _isbnDtoFixture.Create(value: "0306406152", format: IsbnFormat.Isbn10)]);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -236,8 +379,26 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveContributors_ShouldUnionAndDeDuplicateByDisplayNameAndRole()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Contributors = [_mediaContributorDtoFixture.Create("Author A", MediaContributorRole.Author)] };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Contributors = [_mediaContributorDtoFixture.Create("Author A", MediaContributorRole.Author), _mediaContributorDtoFixture.Create("Translator B", MediaContributorRole.Translator)] };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
contributors: [_mediaContributorDtoFixture.Create("Author A", MediaContributorRole.Author)]);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
contributors: [_mediaContributorDtoFixture.Create("Author A", MediaContributorRole.Author), _mediaContributorDtoFixture.Create("Translator B", MediaContributorRole.Translator)]);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -252,8 +413,26 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveRatings_ShouldUnionAndDeDuplicateBySource()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Ratings = [_bookRatingDtoFixture.Create(value: 8m, maxValue: 10m, source: BookRatingSource.Calibre, voteCount: null)] };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Ratings = [_bookRatingDtoFixture.Create(value: 8m, maxValue: 10m, source: BookRatingSource.Calibre, voteCount: null), _bookRatingDtoFixture.Create(value: 4.2m, maxValue: 5m, source: BookRatingSource.OpenLibrary, voteCount: 100)] };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
ratings: [_bookRatingDtoFixture.Create(value: 8m, maxValue: 10m, source: BookRatingSource.Calibre, voteCount: null)]);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
ratings: [_bookRatingDtoFixture.Create(value: 8m, maxValue: 10m, source: BookRatingSource.Calibre, voteCount: null), _bookRatingDtoFixture.Create(value: 4.2m, maxValue: 5m, source: BookRatingSource.OpenLibrary, voteCount: 100)]);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -268,8 +447,27 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenOnlyFirstHasCollections_ShouldReturnTheFirstCollections()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = [_tagDtoFixture.Create(name: "Tag A")], Genres = [_genreDtoFixture.Create(name: "Genre A")], Isbns = [_isbnDtoFixture.Create(value: "9780306406157", format: IsbnFormat.Isbn13)], Contributors = [_mediaContributorDtoFixture.Create("Author A", MediaContributorRole.Author)], Ratings = [_bookRatingDtoFixture.Create(value: 8m, maxValue: 10m, source: BookRatingSource.Calibre, voteCount: null)] };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = null, Genres = null, Isbns = null, Contributors = null, Ratings = null };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
tags: [_tagDtoFixture.Create(name: "Tag A")],
|
||||
genres: [_genreDtoFixture.Create(name: "Genre A")],
|
||||
isbns: [_isbnDtoFixture.Create(value: "9780306406157", format: IsbnFormat.Isbn13)],
|
||||
contributors: [_mediaContributorDtoFixture.Create("Author A", MediaContributorRole.Author)],
|
||||
ratings: [_bookRatingDtoFixture.Create(value: 8m, maxValue: 10m, source: BookRatingSource.Calibre, voteCount: null)]);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -286,8 +484,27 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenOnlySecondHasCollections_ShouldReturnTheSecondCollections()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = null, Genres = null, Isbns = null, Contributors = null, Ratings = null };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = [_tagDtoFixture.Create(name: "Tag B")], Genres = [_genreDtoFixture.Create(name: "Genre B")], Isbns = [_isbnDtoFixture.Create(value: "0306406152", format: IsbnFormat.Isbn10)], Contributors = [_mediaContributorDtoFixture.Create("Author B", MediaContributorRole.Author)], Ratings = [_bookRatingDtoFixture.Create(value: 4.2m, maxValue: 5m, source: BookRatingSource.OpenLibrary, voteCount: 100)] };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
tags: [_tagDtoFixture.Create(name: "Tag B")],
|
||||
genres: [_genreDtoFixture.Create(name: "Genre B")],
|
||||
isbns: [_isbnDtoFixture.Create(value: "0306406152", format: IsbnFormat.Isbn10)],
|
||||
contributors: [_mediaContributorDtoFixture.Create("Author B", MediaContributorRole.Author)],
|
||||
ratings: [_bookRatingDtoFixture.Create(value: 4.2m, maxValue: 5m, source: BookRatingSource.OpenLibrary, voteCount: 100)]);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -304,8 +521,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveNullCollections_ShouldReturnNullCollections()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = null, Genres = null, Isbns = null, Contributors = null, Ratings = null };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = null, Genres = null, Isbns = null, Contributors = null, Ratings = null };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -322,8 +555,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveLanguages_ShouldKeepTheFirstLanguage()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Language = _languageInfoDtoFixture.Create(languageCode: "en", languageName: "English", nativeName: "English") };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Language = _languageInfoDtoFixture.Create(languageCode: "de", languageName: "German", nativeName: "Deutsch") };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
language: _languageInfoDtoFixture.Create(languageCode: "en", languageName: "English", nativeName: "English"));
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
language: _languageInfoDtoFixture.Create(languageCode: "de", languageName: "German", nativeName: "Deutsch"));
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
|
||||
+4
-4
@@ -30,7 +30,7 @@ public class IMetadataProviderGenericTests
|
||||
// Arrange
|
||||
BookMetadataLookupDto lookup = _bookMetadataLookupDtoFixture.Create();
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
BookMetadataDto expectedMetadata = _bookMetadataDtoFixture.Create(title: "Search Result", includeOptionalProperties: false);
|
||||
BookMetadataDto expectedMetadata = _bookMetadataDtoFixture.Create(title: "Search Result", includeReleaseInfo: false, includeGenres: false, includeTags: false, includeLanguage: false, includeFormat: false, includeVolumeNumber: false);
|
||||
TestBookMetadataProvider provider = new(expectedMetadata);
|
||||
IMetadataProvider baseProvider = provider;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class IMetadataProviderGenericTests
|
||||
// Arrange
|
||||
BookMetadataLookupDto lookup = _bookMetadataLookupDtoFixture.Create();
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
BookMetadataDto expectedMetadata = _bookMetadataDtoFixture.Create(title: "Exact Result", includeOptionalProperties: false);
|
||||
BookMetadataDto expectedMetadata = _bookMetadataDtoFixture.Create(title: "Exact Result", includeReleaseInfo: false, includeGenres: false, includeTags: false, includeLanguage: false, includeFormat: false, includeVolumeNumber: false);
|
||||
TestBookMetadataProvider provider = new(expectedMetadata);
|
||||
IMetadataProvider baseProvider = provider;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class IMetadataProviderGenericTests
|
||||
{
|
||||
// Arrange
|
||||
MetadataLookupDto otherLookup = _otherMetadataLookupDtoFixture.Create();
|
||||
TestBookMetadataProvider provider = new(_bookMetadataDtoFixture.Create(title: "Search Result", includeOptionalProperties: false));
|
||||
TestBookMetadataProvider provider = new(_bookMetadataDtoFixture.Create(title: "Search Result", includeReleaseInfo: false, includeGenres: false, includeTags: false, includeLanguage: false, includeFormat: false, includeVolumeNumber: false));
|
||||
IMetadataProvider baseProvider = provider;
|
||||
|
||||
// Act
|
||||
@@ -87,7 +87,7 @@ public class IMetadataProviderGenericTests
|
||||
{
|
||||
// Arrange
|
||||
MetadataLookupDto otherLookup = _otherMetadataLookupDtoFixture.Create();
|
||||
TestBookMetadataProvider provider = new(_bookMetadataDtoFixture.Create(title: "Exact Result", includeOptionalProperties: false));
|
||||
TestBookMetadataProvider provider = new(_bookMetadataDtoFixture.Create(title: "Exact Result", includeReleaseInfo: false, includeGenres: false, includeTags: false, includeLanguage: false, includeFormat: false, includeVolumeNumber: false));
|
||||
IMetadataProvider baseProvider = provider;
|
||||
|
||||
// Act
|
||||
|
||||
Reference in new issue
Block a user