#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Common;
using Lumina.Presentation.Web.Common.Requests.Libraries;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Libraries;
///
/// Fixture class for generating test data.
///
[ExcludeFromCodeCoverage]
public class GetBooksLiteRequestFixture
{
///
/// Creates a new instance with randomized test data.
///
/// Optional identifier of the media library.
/// Optional page of results to retrieve.
/// Optional number of books to retrieve per page.
/// Optional search term used to filter results.
/// Optional alpha key used to filter the results.
/// Whether the leading "The " prefix is ignored by the alpha picker.
/// Optional name of the field by which to sort the results.
/// Optional direction in which to sort the results.
/// A configured instance.
public GetBooksLiteRequest Create(
Guid? libraryId = null,
int? currentPage = null,
int? perPage = null,
string? searchTerm = null,
string? filterAlphaKey = null,
bool shouldIgnoreThePrefixForAlphaPicker = false,
string? sortBy = null,
SortOrder? sortOrder = null)
{
return new GetBooksLiteRequest
{
LibraryId = libraryId ?? Guid.NewGuid(),
CurrentPage = currentPage,
PerPage = perPage,
SearchTerm = searchTerm,
FilterAlphaKey = filterAlphaKey,
ShouldIgnoreThePrefixForAlphaPicker = shouldIgnoreThePrefixForAlphaPicker,
SortBy = sortBy,
SortOrder = sortOrder
};
}
///
/// Creates multiple instances with randomized test data.
///
/// Number of instances to create.
/// List of configured instances.
public List CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}