#region ========================================================================= USING =====================================================================================
using Bogus;
using Nemera.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Nemera.Contracts.Fixtures.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
///
/// Fixture class for the record.
///
[ExcludeFromCodeCoverage]
public class DeletedBookResponseFixture
{
private readonly Faker _faker = new();
///
/// Creates a random valid .
///
/// Optional. The Id of the deleted book.
/// Optional. The Id of the media library the deleted book belongs to.
/// Optional. The title of the deleted book.
/// Optional. The original title of the deleted book.
/// Optional. The file system path of the deleted book.
/// Optional. The date and time when the book was deleted.
/// Optional. The path of the cover image of the deleted book.
/// Whether the original title should be included, or forced to .
/// Whether the cover path should be included, or forced to .
/// The created .
public DeletedBookResponse Create(
Guid? id = null,
Guid? libraryId = null,
string? title = null,
string? originalTitle = null,
string? path = null,
DateTime? deletedOnUtc = null,
string? coverPath = null,
bool includeOriginalTitle = true,
bool includeCoverPath = true)
{
return new DeletedBookResponse(
id ?? _faker.Random.Guid(),
libraryId ?? _faker.Random.Guid(),
title ?? _faker.Lorem.Sentence(3),
includeOriginalTitle ? (originalTitle ?? _faker.Lorem.Sentence(3)) : null,
path ?? _faker.System.FilePath(),
deletedOnUtc ?? _faker.Date.Recent(),
includeCoverPath ? (coverPath ?? $"/covers/{_faker.Random.Guid()}.jpg") : null
);
}
///
/// Creates a list of instances with randomized test data.
///
/// Number of instances to create.
/// List of configured instances.
public List CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}