mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 17:11:10 +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
+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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user