mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
Standardizes test conventions and documentation
This commit is contained in:
1 parent
7aeed04255
commit
f42dc709de
190 files changed
+2180
-2814
No files matched your search
+70
-29
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
|
||||
using System;
|
||||
@@ -25,53 +26,93 @@ public class BookMetadataDtoFixture
|
||||
/// <param name="title">Optional. The title of the book.</param>
|
||||
/// <param name="originalTitle">Optional. The original title of the book.</param>
|
||||
/// <param name="description">Optional. A brief description or summary of the book.</param>
|
||||
/// <param name="goodreadsId">Optional. The Goodreads ID of the book.</param>
|
||||
/// <param name="format">Optional. The format of the book.</param>
|
||||
/// <param name="releaseInfo">Optional. The release information of the book.</param>
|
||||
/// <param name="genres">Optional. The genres of the book.</param>
|
||||
/// <param name="tags">Optional. The tags of the book.</param>
|
||||
/// <param name="language">Optional. The language of the book.</param>
|
||||
/// <param name="originalLanguage">Optional. The original language of the book.</param>
|
||||
/// <param name="publisher">Optional. The name of the publisher of the book.</param>
|
||||
/// <param name="pageCount">Optional. The number of pages in the book.</param>
|
||||
/// <param name="includeOptionalProperties">Whether optional properties should be included.</param>
|
||||
/// <param name="format">Optional. The format of the book.</param>
|
||||
/// <param name="edition">Optional. The edition of the book.</param>
|
||||
/// <param name="volumeNumber">Optional. The volume or book number in the series.</param>
|
||||
/// <param name="series">Optional. The series the book is part of.</param>
|
||||
/// <param name="asin">Optional. The ASIN of the book.</param>
|
||||
/// <param name="goodreadsId">Optional. The Goodreads ID of the book.</param>
|
||||
/// <param name="lccn">Optional. The LCCN of the book.</param>
|
||||
/// <param name="oclcNumber">Optional. The OCLC number of the book.</param>
|
||||
/// <param name="openLibraryId">Optional. The Open Library ID of the book.</param>
|
||||
/// <param name="libraryThingId">Optional. The LibraryThing ID of the book.</param>
|
||||
/// <param name="googleBooksId">Optional. The Google Books ID of the book.</param>
|
||||
/// <param name="barnesAndNobleId">Optional. The Barnes and Noble ID of the book.</param>
|
||||
/// <param name="appleBooksId">Optional. The Apple Books ID of the book.</param>
|
||||
/// <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="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 left <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="BookMetadataDto"/>.</returns>
|
||||
public BookMetadataDto Create(
|
||||
string? title = null,
|
||||
string? originalTitle = null,
|
||||
string? description = null,
|
||||
string? goodreadsId = null,
|
||||
BookFormat? format = null,
|
||||
ReleaseInfoDto? releaseInfo = null,
|
||||
List<GenreDto>? genres = null,
|
||||
List<TagDto>? tags = null,
|
||||
LanguageInfoDto? language = null,
|
||||
LanguageInfoDto? originalLanguage = null,
|
||||
string? publisher = null,
|
||||
int? pageCount = null,
|
||||
BookFormat? format = null,
|
||||
string? edition = null,
|
||||
float? volumeNumber = null,
|
||||
BookSeriesDto? series = null,
|
||||
string? asin = null,
|
||||
string? goodreadsId = null,
|
||||
string? lccn = null,
|
||||
string? oclcNumber = null,
|
||||
string? openLibraryId = null,
|
||||
string? libraryThingId = null,
|
||||
string? googleBooksId = null,
|
||||
string? barnesAndNobleId = null,
|
||||
string? appleBooksId = null,
|
||||
List<IsbnDto>? isbns = null,
|
||||
List<MediaContributorDto>? contributors = null,
|
||||
List<BookRatingDto>? ratings = null,
|
||||
string? coverImagePath = null,
|
||||
bool includeTitle = true,
|
||||
bool includeOptionalProperties = true)
|
||||
{
|
||||
int releaseYear = _faker.Random.Int(1900, 2024);
|
||||
return new BookMetadataDto(
|
||||
title ?? _faker.Lorem.Sentence(3),
|
||||
includeTitle ? title ?? (includeOptionalProperties ? _faker.Lorem.Sentence(3) : null) : null,
|
||||
originalTitle,
|
||||
description,
|
||||
includeOptionalProperties
|
||||
? new ReleaseInfoDto(new DateOnly(releaseYear, 1, 1), releaseYear, null, null, _faker.Address.CountryCode(), null)
|
||||
: null,
|
||||
includeOptionalProperties ? [new GenreDto(_faker.Lorem.Word())] : null,
|
||||
includeOptionalProperties ? [new TagDto(_faker.Lorem.Word())] : null,
|
||||
includeOptionalProperties ? new LanguageInfoDto("en", "English", "English") : null,
|
||||
null,
|
||||
releaseInfo ?? (includeOptionalProperties ? new ReleaseInfoDto(new DateOnly(releaseYear, 1, 1), releaseYear, null, null, _faker.Address.CountryCode(), null) : null),
|
||||
genres ?? (includeOptionalProperties ? [new GenreDto(_faker.Lorem.Word())] : null),
|
||||
tags ?? (includeOptionalProperties ? [new TagDto(_faker.Lorem.Word())] : null),
|
||||
language ?? (includeOptionalProperties ? new LanguageInfoDto("en", "English", "English") : null),
|
||||
originalLanguage,
|
||||
publisher,
|
||||
pageCount,
|
||||
format ?? _faker.PickRandom<BookFormat>(),
|
||||
null,
|
||||
includeOptionalProperties ? _faker.Random.Int(1, 10) : null,
|
||||
null,
|
||||
null,
|
||||
format ?? (includeOptionalProperties ? _faker.PickRandom<BookFormat>() : null),
|
||||
edition,
|
||||
volumeNumber ?? (includeOptionalProperties ? _faker.Random.Int(1, 10) : null),
|
||||
series,
|
||||
asin,
|
||||
goodreadsId,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
lccn,
|
||||
oclcNumber,
|
||||
openLibraryId,
|
||||
libraryThingId,
|
||||
googleBooksId,
|
||||
barnesAndNobleId,
|
||||
appleBooksId,
|
||||
isbns,
|
||||
contributors,
|
||||
ratings,
|
||||
coverImagePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+129
-59
@@ -9,6 +9,7 @@ using Lumina.Contracts.Fixtures.Common.Setup;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
@@ -37,8 +38,48 @@ public class AddBookRequestFixture
|
||||
/// <summary>
|
||||
/// Creates a random valid request to add a book.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the book belongs to.</param>
|
||||
/// <param name="path">Optional. The file system path of the book.</param>
|
||||
/// <param name="metadata">Optional. The written content metadata of the book.</param>
|
||||
/// <param name="format">Optional. The format of the book.</param>
|
||||
/// <param name="edition">Optional. The edition of the book.</param>
|
||||
/// <param name="volumeNumber">Optional. The volume or book number in the series.</param>
|
||||
/// <param name="series">Optional. The series the book is part of.</param>
|
||||
/// <param name="asin">Optional. The ASIN of the book.</param>
|
||||
/// <param name="goodreadsId">Optional. The Goodreads Id of the book.</param>
|
||||
/// <param name="lccn">Optional. The LCCN of the book.</param>
|
||||
/// <param name="oclcNumber">Optional. The OCLC number of the book.</param>
|
||||
/// <param name="openLibraryId">Optional. The Open Library Id of the book.</param>
|
||||
/// <param name="libraryThingId">Optional. The LibraryThing Id of the book.</param>
|
||||
/// <param name="googleBooksId">Optional. The Google Books Id of the book.</param>
|
||||
/// <param name="barnesAndNobleId">Optional. The Barnes and Noble Id of the book.</param>
|
||||
/// <param name="appleBooksId">Optional. The Apple Books Id of the book.</param>
|
||||
/// <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 left <see langword="null"/>.</param>
|
||||
/// <returns>The created request to add a book.</returns>
|
||||
public AddBookRequest Create()
|
||||
public AddBookRequest Create(
|
||||
Guid? libraryId = null,
|
||||
string? path = null,
|
||||
WrittenContentMetadataDto? metadata = null,
|
||||
BookFormat? format = null,
|
||||
string? edition = null,
|
||||
float? volumeNumber = null,
|
||||
BookSeriesDto? series = null,
|
||||
string? asin = null,
|
||||
string? goodreadsId = null,
|
||||
string? lccn = null,
|
||||
string? oclcNumber = null,
|
||||
string? openLibraryId = null,
|
||||
string? libraryThingId = null,
|
||||
string? googleBooksId = null,
|
||||
string? barnesAndNobleId = null,
|
||||
string? appleBooksId = null,
|
||||
List<IsbnDto>? isbns = null,
|
||||
List<MediaContributorDto>? contributors = null,
|
||||
List<BookRatingDto>? ratings = null,
|
||||
bool includeOptionalProperties = true)
|
||||
{
|
||||
int releaseYear = _random.Next(2000, 2010);
|
||||
int reReleaseYear = _random.Next(2010, 2020);
|
||||
@@ -128,7 +169,7 @@ public class AddBookRequestFixture
|
||||
.RuleFor(e => e.LanguageCode, f => f.Random.String2(2))
|
||||
.RuleFor(e => e.NativeName, f => f.Random.String2(f.Random.Number(1, 50)));
|
||||
|
||||
Faker<WrittenContentMetadataDto> metadata = new Faker<WrittenContentMetadataDto>()
|
||||
Faker<WrittenContentMetadataDto> metadataFaker = new Faker<WrittenContentMetadataDto>()
|
||||
.CustomInstantiator(f => new WrittenContentMetadataDto(
|
||||
default!,
|
||||
default,
|
||||
@@ -210,62 +251,91 @@ public class AddBookRequestFixture
|
||||
default!,
|
||||
default!
|
||||
))
|
||||
.RuleFor(x => x.LibraryId, _fixture.Create<Guid>())
|
||||
.RuleFor(x => x.Path, f => f.System.FilePath())
|
||||
.RuleFor(x => x.Metadata, metadata)
|
||||
.RuleFor(x => x.Format, _fixture.Create<BookFormat>())
|
||||
.RuleFor(x => x.Edition, f => f.Random.String2(f.Random.Number(1, 50)))
|
||||
.RuleFor(x => x.VolumeNumber, _random.Next(1, 3))
|
||||
.RuleFor(x => x.ASIN, f => f.Random.String2(10))
|
||||
.RuleFor(x => x.GoodreadsId, _random.Next(100000, 500000).ToString())
|
||||
.RuleFor(x => x.LCCN, f =>
|
||||
{
|
||||
string letters = new([.. Enumerable.Range(0, f.Random.Number(0, 3)).Select(_ => f.Random.Char('a', 'z'))]);
|
||||
string digits = f.Random.String2(f.Random.Number(8, 10), "0123456789");
|
||||
return letters + digits;
|
||||
})
|
||||
.RuleFor(x => x.OCLCNumber, f =>
|
||||
{
|
||||
string[] prefixes = ["ocm", "ocn", "on", "(OCoLC)"];
|
||||
string prefix = f.Random.ArrayElement(prefixes);
|
||||
string number;
|
||||
switch (prefix)
|
||||
{
|
||||
case "ocm":
|
||||
number = f.Random.String2(8, "0123456789");
|
||||
break;
|
||||
case "ocn":
|
||||
number = f.Random.String2(f.Random.Number(9, 11), "0123456789");
|
||||
break;
|
||||
case "on":
|
||||
number = f.Random.String2(10, "0123456789");
|
||||
break;
|
||||
case "(OCoLC)":
|
||||
number = f.Random.String2(f.Random.Number(8, 10), "0123456789");
|
||||
break;
|
||||
default:
|
||||
number = f.Random.String2(f.Random.Number(8, 10), "0123456789");
|
||||
return number;
|
||||
}
|
||||
return prefix + number;
|
||||
})
|
||||
.RuleFor(x => x.OpenLibraryId, f =>
|
||||
{
|
||||
int firstDigit = f.Random.Number(1, 9);
|
||||
string remainingDigits = f.Random.String2(f.Random.Number(0, 6), "0123456789");
|
||||
char suffix = f.Random.ArrayElement(['A', 'M', 'W']);
|
||||
return $"OL{firstDigit}{remainingDigits}{suffix}";
|
||||
})
|
||||
.RuleFor(x => x.LibraryThingId, f => f.Random.String2(f.Random.Number(1, 50)))
|
||||
.RuleFor(x => x.GoogleBooksId, f =>
|
||||
{
|
||||
const string VALID_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
||||
return new string([.. Enumerable.Repeat(VALID_CHARS, 12).Select(s => s[f.Random.Number(VALID_CHARS.Length - 1)])]);
|
||||
})
|
||||
.RuleFor(x => x.BarnesAndNobleId, f => f.Random.String2(10, "0123456789"))
|
||||
.RuleFor(x => x.AppleBooksId, f => $"id{f.Random.Number(1, 999999)}")
|
||||
.RuleFor(p => p.ISBNs, f => isbn.Generate(f.Random.Number(1, 5)))
|
||||
.RuleFor(p => p.Ratings, f => rating.Generate(f.Random.Number(1, 5)))
|
||||
.RuleFor(x => x.Contributors, f => mediaContributor.Generate(f.Random.Number(1, 5)));
|
||||
.RuleFor(x => x.LibraryId, libraryId ?? _fixture.Create<Guid>())
|
||||
.RuleFor(x => x.Path, f => path ?? f.System.FilePath())
|
||||
.RuleFor(x => x.Metadata, metadata ?? metadataFaker)
|
||||
.RuleFor(x => x.Format, format ?? (includeOptionalProperties ? _fixture.Create<BookFormat>() : null))
|
||||
.RuleFor(x => x.Edition, f => edition ?? (includeOptionalProperties ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.VolumeNumber, volumeNumber ?? (includeOptionalProperties ? (float?)_random.Next(1, 3) : null))
|
||||
.RuleFor(x => x.Series, series)
|
||||
.RuleFor(x => x.ASIN, f => asin ?? (includeOptionalProperties ? f.Random.String2(10) : null))
|
||||
.RuleFor(x => x.GoodreadsId, goodreadsId ?? (includeOptionalProperties ? _random.Next(100000, 500000).ToString() : null))
|
||||
.RuleFor(x => x.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 ? isbn.Generate(f.Random.Number(1, 5)) : null))
|
||||
.RuleFor(p => p.Ratings, f => ratings ?? (includeOptionalProperties ? rating.Generate(f.Random.Number(1, 5)) : null))
|
||||
.RuleFor(x => x.Contributors, f => contributors ?? (includeOptionalProperties ? mediaContributor.Generate(f.Random.Number(1, 5)) : null));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random LCCN (Library of Congress Control Number).
|
||||
/// </summary>
|
||||
/// <param name="faker">The faker used to generate the value.</param>
|
||||
/// <returns>The generated LCCN.</returns>
|
||||
private static string CreateLccn(Faker faker)
|
||||
{
|
||||
string letters = new([.. Enumerable.Range(0, faker.Random.Number(0, 3)).Select(_ => faker.Random.Char('a', 'z'))]);
|
||||
string digits = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
|
||||
return letters + digits;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random OCLC number (WorldCat identifier).
|
||||
/// </summary>
|
||||
/// <param name="faker">The faker used to generate the value.</param>
|
||||
/// <returns>The generated OCLC number.</returns>
|
||||
private static string CreateOclcNumber(Faker faker)
|
||||
{
|
||||
string[] prefixes = ["ocm", "ocn", "on", "(OCoLC)"];
|
||||
string prefix = faker.Random.ArrayElement(prefixes);
|
||||
string number;
|
||||
switch (prefix)
|
||||
{
|
||||
case "ocm":
|
||||
number = faker.Random.String2(8, "0123456789");
|
||||
break;
|
||||
case "ocn":
|
||||
number = faker.Random.String2(faker.Random.Number(9, 11), "0123456789");
|
||||
break;
|
||||
case "on":
|
||||
number = faker.Random.String2(10, "0123456789");
|
||||
break;
|
||||
case "(OCoLC)":
|
||||
number = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
|
||||
break;
|
||||
default:
|
||||
number = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
|
||||
return number;
|
||||
}
|
||||
return prefix + number;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random Open Library Id.
|
||||
/// </summary>
|
||||
/// <param name="faker">The faker used to generate the value.</param>
|
||||
/// <returns>The generated Open Library Id.</returns>
|
||||
private static string CreateOpenLibraryId(Faker faker)
|
||||
{
|
||||
int firstDigit = faker.Random.Number(1, 9);
|
||||
string remainingDigits = faker.Random.String2(faker.Random.Number(0, 6), "0123456789");
|
||||
char suffix = faker.Random.ArrayElement(['A', 'M', 'W']);
|
||||
return $"OL{firstDigit}{remainingDigits}{suffix}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random Google Books Id.
|
||||
/// </summary>
|
||||
/// <param name="faker">The faker used to generate the value.</param>
|
||||
/// <returns>The generated Google Books Id.</returns>
|
||||
private static string CreateGoogleBooksId(Faker faker)
|
||||
{
|
||||
const string VALID_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
||||
return new string([.. Enumerable.Repeat(VALID_CHARS, 12).Select(s => s[faker.Random.Number(VALID_CHARS.Length - 1)])]);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -26,7 +26,7 @@ public class GetBooksLiteRequestFixture
|
||||
/// <param name="perPage">Optional. The maximum number of books to retrieve per page.</param>
|
||||
/// <param name="searchTerm">Optional. The search term used to filter results.</param>
|
||||
/// <param name="filterAlphaKey">Optional. The alpha key used to filter the results by the first character of their title, for the alpha picker.</param>
|
||||
/// <param name="ignoreThePrefixForAlphaPicker">Optional. Whether the leading "The " prefix of a title should be ignored when computing the alpha key, or not.</param>
|
||||
/// <param name="shouldIgnoreThePrefixForAlphaPicker">Optional. Whether the leading "The " prefix of a title should be ignored when computing the alpha key, or not.</param>
|
||||
/// <param name="sortBy">Optional. The name of the field by which to sort the results.</param>
|
||||
/// <param name="sortOrder">Optional. The direction in which to sort the results.</param>
|
||||
/// <returns>The created <see cref="GetBooksLiteRequest"/>.</returns>
|
||||
@@ -36,7 +36,7 @@ public class GetBooksLiteRequestFixture
|
||||
int? perPage = null,
|
||||
string? searchTerm = null,
|
||||
string? filterAlphaKey = null,
|
||||
bool ignoreThePrefixForAlphaPicker = false,
|
||||
bool shouldIgnoreThePrefixForAlphaPicker = false,
|
||||
string? sortBy = null,
|
||||
SortOrder? sortOrder = null)
|
||||
{
|
||||
@@ -46,7 +46,7 @@ public class GetBooksLiteRequestFixture
|
||||
PerPage: perPage ?? _faker.Random.Number(1, 200),
|
||||
SearchTerm: searchTerm ?? _faker.Lorem.Word(),
|
||||
FilterAlphaKey: filterAlphaKey,
|
||||
IgnoreThePrefixForAlphaPicker: ignoreThePrefixForAlphaPicker,
|
||||
ShouldIgnoreThePrefixForAlphaPicker: shouldIgnoreThePrefixForAlphaPicker,
|
||||
SortBy: sortBy ?? _faker.Lorem.Word(),
|
||||
SortOrder: sortOrder ?? _faker.PickRandom<SortOrder>()
|
||||
);
|
||||
|
||||
+4
-3
@@ -15,6 +15,8 @@ namespace Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.Thumbnai
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ThumbnailResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="ThumbnailResponse"/>.
|
||||
/// </summary>
|
||||
@@ -23,10 +25,9 @@ public class ThumbnailResponseFixture
|
||||
/// <returns>The created <see cref="ThumbnailResponse"/>.</returns>
|
||||
public ThumbnailResponse Create(ImageType? type = null, byte[]? bytes = null)
|
||||
{
|
||||
Faker faker = new();
|
||||
return new ThumbnailResponse(
|
||||
type ?? faker.PickRandom<ImageType>(),
|
||||
bytes ?? faker.Random.Bytes(20)
|
||||
type ?? _faker.PickRandom<ImageType>(),
|
||||
bytes ?? _faker.Random.Bytes(20)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -40,7 +40,8 @@ public class BookResponseFixture
|
||||
WrittenContentMetadataDto? metadata = null,
|
||||
BookFormat? format = null,
|
||||
MetadataStatus? metadataStatus = null,
|
||||
DateTime? createdOnUtc = null)
|
||||
DateTime? createdOnUtc = null,
|
||||
string? coverPath = null)
|
||||
{
|
||||
DateTime resolvedCreatedOnUtc = createdOnUtc ?? _faker.Date.Past().ToUniversalTime();
|
||||
return new BookResponse(
|
||||
@@ -70,7 +71,8 @@ public class BookResponseFixture
|
||||
_faker.Date.Recent().ToUniversalTime(),
|
||||
_faker.Company.CompanyName(),
|
||||
resolvedCreatedOnUtc,
|
||||
_faker.Random.Bool() ? _faker.Date.Recent().ToUniversalTime() : null
|
||||
_faker.Random.Bool() ? _faker.Date.Recent().ToUniversalTime() : null,
|
||||
coverPath ?? (_faker.Random.Bool() ? _faker.System.FilePath() : null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user