Updates the provider configuration and ownership tests

Covers the provider and reader choices saved with a library, the reconciliation and stale configuration deletion in the provider store, the library type lookups, the ownership and permission checks for update and delete, and the validator behavior for enum names.
This commit is contained in:
BinaryAlley committed 2026-11-03 10:00:00 +02:00
1 parent 48ad8692af
commit 64e5163229
127 files changed
+5541 -5296

No files matched your search

@@ -0,0 +1,43 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DTO.MediaLibrary.Management;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Common.DTO.MediaLibrary.Management;
/// <summary>
/// Fixture class for the <see cref="LibraryProviderSelectionDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class LibraryProviderSelectionDtoFixture
{
/// <summary>
/// Creates a random valid <see cref="LibraryProviderSelectionDto"/>.
/// </summary>
/// <param name="pluginId">Optional. The Id of the plugin providing the provider or reader.</param>
/// <param name="isEnabled">Whether the provider or reader is enabled.</param>
/// <param name="includeIsEnabled">Whether the choice carries an enabled state. When <see langword="false"/>, the enabled state is <see langword="null"/>.</param>
/// <returns>The created <see cref="LibraryProviderSelectionDto"/>.</returns>
public LibraryProviderSelectionDto Create(
Guid? pluginId = null,
bool isEnabled = true,
bool includeIsEnabled = true)
{
return new LibraryProviderSelectionDto(
pluginId ?? Guid.NewGuid(),
includeIsEnabled ? isEnabled : null);
}
/// <summary>
/// Creates a list of <see cref="LibraryProviderSelectionDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<LibraryProviderSelectionDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -32,6 +32,9 @@ public class AddLibraryCommandFixture
/// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param>
/// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param>
/// <param name="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
/// <param name="metadataProviders">Optional. The choices made for the metadata providers of the media library.</param>
/// <param name="artworkProviders">Optional. The choices made for the artwork providers of the media library.</param>
/// <param name="bookReaders">Optional. The choices made for the book readers of the media library.</param>
/// <returns>The created command.</returns>
public AddLibraryCommand Create(
string? title = null,
@@ -46,7 +49,10 @@ public class AddLibraryCommandFixture
bool isContentOnSsd = false,
bool? shouldTrackConsumptionProgress = null,
int? completionThresholdPercentage = null,
LibraryPathTemplatePartDto[]? pathTemplateParts = null)
LibraryPathTemplatePartDto[]? pathTemplateParts = null,
LibraryProviderSelectionDto[]? metadataProviders = null,
LibraryProviderSelectionDto[]? artworkProviders = null,
LibraryProviderSelectionDto[]? bookReaders = null)
{
return new Faker<AddLibraryCommand>()
.CustomInstantiator(f => new AddLibraryCommand(
@@ -62,6 +68,9 @@ public class AddLibraryCommandFixture
false,
shouldTrackConsumptionProgress,
completionThresholdPercentage,
null,
null,
null,
null
))
.RuleFor(x => x.Title, f => title ?? f.Lorem.Word())
@@ -75,6 +84,9 @@ public class AddLibraryCommandFixture
.RuleFor(x => x.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan)
.RuleFor(x => x.IsContentOnSsd, isContentOnSsd)
.RuleFor(x => x.PathTemplateParts, pathTemplateParts)
.RuleFor(x => x.MetadataProviders, metadataProviders)
.RuleFor(x => x.ArtworkProviders, artworkProviders)
.RuleFor(x => x.BookReaders, bookReaders)
.Generate();
}
@@ -21,7 +21,6 @@ public class UpdateLibraryCommandFixture
/// Creates a random valid command to update a media library.
/// </summary>
/// <param name="id">Optional. The Id of the media library.</param>
/// <param name="ownerId">Optional. The Id of the user owning the media library.</param>
/// <param name="title">Optional. The title of the media library.</param>
/// <param name="libraryType">Optional. The type of the media library.</param>
/// <param name="contentLocations">Optional. The content locations of the media library.</param>
@@ -35,10 +34,12 @@ public class UpdateLibraryCommandFixture
/// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param>
/// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param>
/// <param name="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
/// <param name="metadataProviders">Optional. The choices made for the metadata providers of the media library.</param>
/// <param name="artworkProviders">Optional. The choices made for the artwork providers of the media library.</param>
/// <param name="bookReaders">Optional. The choices made for the book readers of the media library.</param>
/// <returns>The created command.</returns>
public UpdateLibraryCommand Create(
Guid? id = null,
Guid? ownerId = null,
string? title = null,
string? libraryType = null,
string[]? contentLocations = null,
@@ -51,11 +52,13 @@ public class UpdateLibraryCommandFixture
bool isContentOnSsd = false,
bool? shouldTrackConsumptionProgress = null,
int? completionThresholdPercentage = null,
LibraryPathTemplatePartDto[]? pathTemplateParts = null)
LibraryPathTemplatePartDto[]? pathTemplateParts = null,
LibraryProviderSelectionDto[]? metadataProviders = null,
LibraryProviderSelectionDto[]? artworkProviders = null,
LibraryProviderSelectionDto[]? bookReaders = null)
{
return new Faker<UpdateLibraryCommand>()
.CustomInstantiator(f => new UpdateLibraryCommand(
default,
default,
default!,
default!,
@@ -69,10 +72,12 @@ public class UpdateLibraryCommandFixture
false,
shouldTrackConsumptionProgress,
completionThresholdPercentage,
null,
null,
null,
null
))
.RuleFor(x => x.Id, id ?? Guid.NewGuid())
.RuleFor(x => x.OwnerId, ownerId ?? Guid.NewGuid())
.RuleFor(x => x.Title, f => title ?? f.Lorem.Word())
.RuleFor(x => x.LibraryType, f => libraryType ?? f.Random.Enum<LibraryType>().ToString())
.RuleFor(x => x.ContentLocations, f => contentLocations ?? [f.System.DirectoryPath(), f.System.DirectoryPath(), f.System.DirectoryPath()])
@@ -84,6 +89,9 @@ public class UpdateLibraryCommandFixture
.RuleFor(x => x.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan)
.RuleFor(x => x.IsContentOnSsd, isContentOnSsd)
.RuleFor(x => x.PathTemplateParts, pathTemplateParts)
.RuleFor(x => x.MetadataProviders, metadataProviders)
.RuleFor(x => x.ArtworkProviders, artworkProviders)
.RuleFor(x => x.BookReaders, bookReaders)
.Generate();
}
@@ -1,46 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Application.Core.Plugins.Commands.ReorderLibraryArtworkProviders;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.Plugins.Commands.ReorderLibraryArtworkProviders;
/// <summary>
/// Fixture class for the <see cref="ReorderLibraryArtworkProvidersCommand"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class ReorderLibraryArtworkProvidersCommandFixture
{
/// <summary>
/// Creates a random valid command to reorder the artwork providers of a media library.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose artwork providers are reordered.</param>
/// <param name="pluginIds">Optional. The plugin Ids in the new order.</param>
/// <returns>The created command.</returns>
public ReorderLibraryArtworkProvidersCommand Create(
Guid? libraryId = null,
IReadOnlyList<Guid>? pluginIds = null)
{
return new Faker<ReorderLibraryArtworkProvidersCommand>()
.CustomInstantiator(f => new ReorderLibraryArtworkProvidersCommand(
default,
default!))
.RuleFor(x => x.LibraryId, libraryId ?? Guid.NewGuid())
.RuleFor(x => x.PluginIds, f => pluginIds ?? [Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()])
.Generate();
}
/// <summary>
/// Creates a list of <see cref="ReorderLibraryArtworkProvidersCommand"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<ReorderLibraryArtworkProvidersCommand> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,44 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Application.Core.Plugins.Commands.ReorderLibraryMetadataProviders;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.Plugins.Commands.ReorderLibraryMetadataProviders;
/// <summary>
/// Fixture class for the <see cref="ReorderLibraryMetadataProvidersCommand"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class ReorderLibraryMetadataProvidersCommandFixture
{
/// <summary>
/// Creates a random valid command to reorder the metadata providers of a media library.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose metadata providers are reordered.</param>
/// <param name="pluginIds">Optional. The plugin Ids in the new order.</param>
/// <returns>The created command.</returns>
public ReorderLibraryMetadataProvidersCommand Create(Guid? libraryId = null, IReadOnlyList<Guid>? pluginIds = null)
{
return new Faker<ReorderLibraryMetadataProvidersCommand>()
.CustomInstantiator(f => new ReorderLibraryMetadataProvidersCommand(
default,
default!))
.RuleFor(x => x.LibraryId, libraryId ?? Guid.NewGuid())
.RuleFor(x => x.PluginIds, f => pluginIds ?? [Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()])
.Generate();
}
/// <summary>
/// Creates a list of <see cref="ReorderLibraryMetadataProvidersCommand"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<ReorderLibraryMetadataProvidersCommand> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,50 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Application.Core.Plugins.Commands.SetLibraryArtworkProviderEnabled;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.Plugins.Commands.SetLibraryArtworkProviderEnabled;
/// <summary>
/// Fixture class for the <see cref="SetLibraryArtworkProviderEnabledCommand"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class SetLibraryArtworkProviderEnabledCommandFixture
{
/// <summary>
/// Creates a random valid command to enable or disable an artwork provider for a media library.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose artwork provider is enabled or disabled.</param>
/// <param name="pluginId">Optional. The Id of the plugin providing the artwork.</param>
/// <param name="isEnabled">Whether the artwork provider should be enabled for the media library.</param>
/// <returns>The created command.</returns>
public SetLibraryArtworkProviderEnabledCommand Create(
Guid? libraryId = null,
Guid? pluginId = null,
bool isEnabled = true)
{
return new Faker<SetLibraryArtworkProviderEnabledCommand>()
.CustomInstantiator(f => new SetLibraryArtworkProviderEnabledCommand(
default,
default,
true))
.RuleFor(x => x.LibraryId, libraryId ?? Guid.NewGuid())
.RuleFor(x => x.PluginId, pluginId ?? Guid.NewGuid())
.RuleFor(x => x.IsEnabled, isEnabled)
.Generate();
}
/// <summary>
/// Creates a list of <see cref="SetLibraryArtworkProviderEnabledCommand"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<SetLibraryArtworkProviderEnabledCommand> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,41 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.Plugins.Commands.SetLibraryBookReaderEnabled;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.Plugins.Commands.SetLibraryBookReaderEnabled;
/// <summary>
/// Fixture class for the <see cref="SetLibraryBookReaderEnabledCommand"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class SetLibraryBookReaderEnabledCommandFixture
{
/// <summary>
/// Creates a random valid command to enable or disable a book reader for a media library.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose book reader is enabled or disabled.</param>
/// <param name="pluginId">Optional. The unique identifier of the plugin providing the book reader.</param>
/// <param name="isEnabled">Optional. Whether the book reader should be enabled for the media library.</param>
/// <returns>The created <see cref="SetLibraryBookReaderEnabledCommand"/>.</returns>
public SetLibraryBookReaderEnabledCommand Create(
Guid? libraryId = null,
Guid? pluginId = null,
bool? isEnabled = null)
{
return new SetLibraryBookReaderEnabledCommand(libraryId ?? Guid.NewGuid(), pluginId ?? Guid.NewGuid(), isEnabled ?? true);
}
/// <summary>
/// Creates a list of <see cref="SetLibraryBookReaderEnabledCommand"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<SetLibraryBookReaderEnabledCommand> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,47 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Application.Core.Plugins.Commands.SetLibraryMetadataProviderEnabled;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.Plugins.Commands.SetLibraryMetadataProviderEnabled;
/// <summary>
/// Fixture class for the <see cref="SetLibraryMetadataProviderEnabledCommand"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class SetLibraryMetadataProviderEnabledCommandFixture
{
/// <summary>
/// Creates a random valid command to enable or disable a metadata provider for a media library.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose metadata provider is enabled or disabled.</param>
/// <param name="pluginId">Optional. The Id of the plugin providing the metadata.</param>
/// <param name="isEnabled">Whether the metadata provider should be enabled for the media library.</param>
/// <returns>The created command.</returns>
public SetLibraryMetadataProviderEnabledCommand Create(Guid? libraryId = null, Guid? pluginId = null, bool isEnabled = true)
{
return new Faker<SetLibraryMetadataProviderEnabledCommand>()
.CustomInstantiator(f => new SetLibraryMetadataProviderEnabledCommand(
default,
default,
true))
.RuleFor(x => x.LibraryId, libraryId ?? Guid.NewGuid())
.RuleFor(x => x.PluginId, pluginId ?? Guid.NewGuid())
.RuleFor(x => x.IsEnabled, isEnabled)
.Generate();
}
/// <summary>
/// Creates a list of <see cref="SetLibraryMetadataProviderEnabledCommand"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<SetLibraryMetadataProviderEnabledCommand> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,35 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.Plugins.Queries.GetLibraryTypeArtworkProviders;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.Plugins.Queries.GetLibraryTypeArtworkProviders;
/// <summary>
/// Fixture class for the <see cref="GetLibraryTypeArtworkProvidersQuery"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetLibraryTypeArtworkProvidersQueryFixture
{
/// <summary>
/// Creates a random valid <see cref="GetLibraryTypeArtworkProvidersQuery"/>.
/// </summary>
/// <param name="libraryType">Optional. The media library type whose available artwork providers are retrieved.</param>
/// <returns>The created <see cref="GetLibraryTypeArtworkProvidersQuery"/>.</returns>
public GetLibraryTypeArtworkProvidersQuery Create(string? libraryType = null)
{
return new GetLibraryTypeArtworkProvidersQuery(libraryType ?? "Book");
}
/// <summary>
/// Creates a list of <see cref="GetLibraryTypeArtworkProvidersQuery"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetLibraryTypeArtworkProvidersQuery> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,35 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.Plugins.Queries.GetLibraryTypeBookReaders;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.Plugins.Queries.GetLibraryTypeBookReaders;
/// <summary>
/// Fixture class for the <see cref="GetLibraryTypeBookReadersQuery"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetLibraryTypeBookReadersQueryFixture
{
/// <summary>
/// Creates a random valid <see cref="GetLibraryTypeBookReadersQuery"/>.
/// </summary>
/// <param name="libraryType">Optional. The media library type whose available book readers are retrieved.</param>
/// <returns>The created <see cref="GetLibraryTypeBookReadersQuery"/>.</returns>
public GetLibraryTypeBookReadersQuery Create(string? libraryType = null)
{
return new GetLibraryTypeBookReadersQuery(libraryType ?? "Book");
}
/// <summary>
/// Creates a list of <see cref="GetLibraryTypeBookReadersQuery"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetLibraryTypeBookReadersQuery> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,35 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.Plugins.Queries.GetLibraryTypeMetadataProviders;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.Plugins.Queries.GetLibraryTypeMetadataProviders;
/// <summary>
/// Fixture class for the <see cref="GetLibraryTypeMetadataProvidersQuery"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetLibraryTypeMetadataProvidersQueryFixture
{
/// <summary>
/// Creates a random valid <see cref="GetLibraryTypeMetadataProvidersQuery"/>.
/// </summary>
/// <param name="libraryType">Optional. The media library type whose available metadata providers are retrieved.</param>
/// <returns>The created <see cref="GetLibraryTypeMetadataProvidersQuery"/>.</returns>
public GetLibraryTypeMetadataProvidersQuery Create(string? libraryType = null)
{
return new GetLibraryTypeMetadataProvidersQuery(libraryType ?? "Book");
}
/// <summary>
/// Creates a list of <see cref="GetLibraryTypeMetadataProvidersQuery"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetLibraryTypeMetadataProvidersQuery> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -32,6 +32,9 @@ public class AddLibraryRequestFixture
/// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param>
/// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param>
/// <param name="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
/// <param name="metadataProviders">Optional. The choices made for the metadata providers of the media library.</param>
/// <param name="artworkProviders">Optional. The choices made for the artwork providers of the media library.</param>
/// <param name="bookReaders">Optional. The choices made for the book readers of the media library.</param>
/// <returns>The created <see cref="AddLibraryRequest"/>.</returns>
public AddLibraryRequest Create(
string? title = null,
@@ -46,7 +49,10 @@ public class AddLibraryRequestFixture
bool? isContentOnSsd = null,
bool? shouldTrackConsumptionProgress = null,
int? completionThresholdPercentage = null,
LibraryPathTemplatePartRequest[]? pathTemplateParts = null)
LibraryPathTemplatePartRequest?[]? pathTemplateParts = null,
LibraryProviderSelectionRequest?[]? metadataProviders = null,
LibraryProviderSelectionRequest?[]? artworkProviders = null,
LibraryProviderSelectionRequest?[]? bookReaders = null)
{
return new AddLibraryRequest(
title ?? _faker.Commerce.Department(),
@@ -61,7 +67,10 @@ public class AddLibraryRequestFixture
isContentOnSsd ?? false,
shouldTrackConsumptionProgress,
completionThresholdPercentage,
pathTemplateParts
pathTemplateParts,
metadataProviders,
artworkProviders,
bookReaders
);
}
@@ -0,0 +1,43 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Requests.MediaLibrary.Management;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
/// <summary>
/// Fixture class for the <see cref="LibraryProviderSelectionRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class LibraryProviderSelectionRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="LibraryProviderSelectionRequest"/>.
/// </summary>
/// <param name="pluginId">Optional. The Id of the plugin providing the provider or reader.</param>
/// <param name="isEnabled">Whether the provider or reader is enabled.</param>
/// <param name="includeIsEnabled">Whether the choice carries an enabled state. When <see langword="false"/>, the enabled state is <see langword="null"/>.</param>
/// <returns>The created <see cref="LibraryProviderSelectionRequest"/>.</returns>
public LibraryProviderSelectionRequest Create(
Guid? pluginId = null,
bool isEnabled = true,
bool includeIsEnabled = true)
{
return new LibraryProviderSelectionRequest(
pluginId ?? Guid.NewGuid(),
includeIsEnabled ? isEnabled : null);
}
/// <summary>
/// Creates a list of <see cref="LibraryProviderSelectionRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<LibraryProviderSelectionRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -21,7 +21,6 @@ public class UpdateLibraryRequestFixture
/// Creates a random valid <see cref="UpdateLibraryRequest"/>.
/// </summary>
/// <param name="id">Optional. The Id of the media library to update.</param>
/// <param name="userId">Optional. The Id of the user owning the media library.</param>
/// <param name="title">Optional. The title of the media library.</param>
/// <param name="libraryType">Optional. The type of the media library.</param>
/// <param name="contentLocations">Optional. The file system paths of the media library content directories.</param>
@@ -35,10 +34,12 @@ public class UpdateLibraryRequestFixture
/// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param>
/// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param>
/// <param name="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
/// <param name="metadataProviders">Optional. The choices made for the metadata providers of the media library.</param>
/// <param name="artworkProviders">Optional. The choices made for the artwork providers of the media library.</param>
/// <param name="bookReaders">Optional. The choices made for the book readers of the media library.</param>
/// <returns>The created <see cref="UpdateLibraryRequest"/>.</returns>
public UpdateLibraryRequest Create(
Guid? id = null,
Guid? userId = null,
string? title = null,
string? libraryType = null,
string[]? contentLocations = null,
@@ -51,11 +52,13 @@ public class UpdateLibraryRequestFixture
bool? isContentOnSsd = null,
bool? shouldTrackConsumptionProgress = null,
int? completionThresholdPercentage = null,
LibraryPathTemplatePartRequest[]? pathTemplateParts = null)
LibraryPathTemplatePartRequest?[]? pathTemplateParts = null,
LibraryProviderSelectionRequest?[]? metadataProviders = null,
LibraryProviderSelectionRequest?[]? artworkProviders = null,
LibraryProviderSelectionRequest?[]? bookReaders = null)
{
return new UpdateLibraryRequest(
id ?? _faker.Random.Guid(),
userId ?? _faker.Random.Guid(),
title ?? _faker.Commerce.Department(),
libraryType ?? "EBook",
contentLocations ?? [_faker.System.DirectoryPath()],
@@ -68,7 +71,10 @@ public class UpdateLibraryRequestFixture
isContentOnSsd ?? false,
shouldTrackConsumptionProgress,
completionThresholdPercentage,
pathTemplateParts
pathTemplateParts,
metadataProviders,
artworkProviders,
bookReaders
);
}
@@ -0,0 +1,35 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Requests.Plugins;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="GetLibraryTypeArtworkProvidersRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetLibraryTypeArtworkProvidersRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="GetLibraryTypeArtworkProvidersRequest"/>.
/// </summary>
/// <param name="libraryType">Optional. The media library type whose available artwork providers are retrieved.</param>
/// <returns>The created <see cref="GetLibraryTypeArtworkProvidersRequest"/>.</returns>
public GetLibraryTypeArtworkProvidersRequest Create(string? libraryType = null)
{
return new GetLibraryTypeArtworkProvidersRequest(libraryType ?? "Book");
}
/// <summary>
/// Creates a list of <see cref="GetLibraryTypeArtworkProvidersRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetLibraryTypeArtworkProvidersRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,35 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Requests.Plugins;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="GetLibraryTypeBookReadersRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetLibraryTypeBookReadersRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="GetLibraryTypeBookReadersRequest"/>.
/// </summary>
/// <param name="libraryType">Optional. The media library type whose available book readers are retrieved.</param>
/// <returns>The created <see cref="GetLibraryTypeBookReadersRequest"/>.</returns>
public GetLibraryTypeBookReadersRequest Create(string? libraryType = null)
{
return new GetLibraryTypeBookReadersRequest(libraryType ?? "Book");
}
/// <summary>
/// Creates a list of <see cref="GetLibraryTypeBookReadersRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetLibraryTypeBookReadersRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,35 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Requests.Plugins;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="GetLibraryTypeMetadataProvidersRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetLibraryTypeMetadataProvidersRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="GetLibraryTypeMetadataProvidersRequest"/>.
/// </summary>
/// <param name="libraryType">Optional. The media library type whose available metadata providers are retrieved.</param>
/// <returns>The created <see cref="GetLibraryTypeMetadataProvidersRequest"/>.</returns>
public GetLibraryTypeMetadataProvidersRequest Create(string? libraryType = null)
{
return new GetLibraryTypeMetadataProvidersRequest(libraryType ?? "Book");
}
/// <summary>
/// Creates a list of <see cref="GetLibraryTypeMetadataProvidersRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetLibraryTypeMetadataProvidersRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,45 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Requests.Plugins;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="ReorderLibraryArtworkProvidersRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class ReorderLibraryArtworkProvidersRequestFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="ReorderLibraryArtworkProvidersRequest"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose artwork providers are reordered.</param>
/// <param name="pluginIds">Optional. The plugin Ids in the new order.</param>
/// <returns>The created <see cref="ReorderLibraryArtworkProvidersRequest"/>.</returns>
public ReorderLibraryArtworkProvidersRequest Create(
Guid? libraryId = null,
IReadOnlyList<Guid>? pluginIds = null)
{
return new ReorderLibraryArtworkProvidersRequest(
libraryId ?? _faker.Random.Guid(),
pluginIds ?? [Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()]
);
}
/// <summary>
/// Creates a list of <see cref="ReorderLibraryArtworkProvidersRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<ReorderLibraryArtworkProvidersRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,45 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Requests.Plugins;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="ReorderLibraryMetadataProvidersRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class ReorderLibraryMetadataProvidersRequestFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="ReorderLibraryMetadataProvidersRequest"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose metadata providers are reordered.</param>
/// <param name="pluginIds">Optional. The plugin Ids in the new order.</param>
/// <returns>The created <see cref="ReorderLibraryMetadataProvidersRequest"/>.</returns>
public ReorderLibraryMetadataProvidersRequest Create(
Guid? libraryId = null,
IReadOnlyList<Guid>? pluginIds = null)
{
return new ReorderLibraryMetadataProvidersRequest(
libraryId ?? _faker.Random.Guid(),
pluginIds ?? [Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()]
);
}
/// <summary>
/// Creates a list of <see cref="ReorderLibraryMetadataProvidersRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<ReorderLibraryMetadataProvidersRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,48 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Requests.Plugins;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="SetLibraryArtworkProviderEnabledRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class SetLibraryArtworkProviderEnabledRequestFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="SetLibraryArtworkProviderEnabledRequest"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose artwork provider is enabled or disabled.</param>
/// <param name="pluginId">Optional. The Id of the plugin providing the artwork.</param>
/// <param name="isEnabled">Optional. Whether the artwork provider should be enabled.</param>
/// <returns>The created <see cref="SetLibraryArtworkProviderEnabledRequest"/>.</returns>
public SetLibraryArtworkProviderEnabledRequest Create(
Guid? libraryId = null,
Guid? pluginId = null,
bool? isEnabled = null)
{
return new SetLibraryArtworkProviderEnabledRequest(
libraryId ?? _faker.Random.Guid(),
pluginId ?? _faker.Random.Guid(),
isEnabled ?? _faker.Random.Bool()
);
}
/// <summary>
/// Creates a list of <see cref="SetLibraryArtworkProviderEnabledRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<SetLibraryArtworkProviderEnabledRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,41 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Requests.Plugins;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="SetLibraryBookReaderEnabledRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class SetLibraryBookReaderEnabledRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="SetLibraryBookReaderEnabledRequest"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose book reader is enabled or disabled.</param>
/// <param name="pluginId">Optional. The unique identifier of the plugin providing the book reader.</param>
/// <param name="isEnabled">Optional. Whether the book reader should be enabled for the media library.</param>
/// <returns>The created <see cref="SetLibraryBookReaderEnabledRequest"/>.</returns>
public SetLibraryBookReaderEnabledRequest Create(
Guid? libraryId = null,
Guid? pluginId = null,
bool? isEnabled = null)
{
return new SetLibraryBookReaderEnabledRequest(libraryId ?? Guid.NewGuid(), pluginId ?? Guid.NewGuid(), isEnabled ?? true);
}
/// <summary>
/// Creates a list of <see cref="SetLibraryBookReaderEnabledRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<SetLibraryBookReaderEnabledRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,48 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Requests.Plugins;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="SetLibraryMetadataProviderEnabledRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class SetLibraryMetadataProviderEnabledRequestFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="SetLibraryMetadataProviderEnabledRequest"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose metadata provider is enabled or disabled.</param>
/// <param name="pluginId">Optional. The Id of the plugin providing the metadata.</param>
/// <param name="isEnabled">Optional. Whether the metadata provider should be enabled.</param>
/// <returns>The created <see cref="SetLibraryMetadataProviderEnabledRequest"/>.</returns>
public SetLibraryMetadataProviderEnabledRequest Create(
Guid? libraryId = null,
Guid? pluginId = null,
bool? isEnabled = null)
{
return new SetLibraryMetadataProviderEnabledRequest(
libraryId ?? _faker.Random.Guid(),
pluginId ?? _faker.Random.Guid(),
isEnabled ?? _faker.Random.Bool()
);
}
/// <summary>
/// Creates a list of <see cref="SetLibraryMetadataProviderEnabledRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<SetLibraryMetadataProviderEnabledRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -31,7 +31,6 @@ public class LibraryDtoFixture
return new LibraryDto
{
Id = id ?? Guid.NewGuid(),
UserId = Guid.NewGuid(),
Title = title ?? _faker.Commerce.Department(),
LibraryType = libraryType ?? _faker.PickRandom("Book", "Video", "Photo"),
CoverImage = _faker.Image.PicsumUrl(),
@@ -0,0 +1,48 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Presentation.Web.Common.DTO.Libraries;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Libraries;
/// <summary>
/// Fixture class for the <see cref="LibraryProviderSelectionDto"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class LibraryProviderSelectionDtoFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="LibraryProviderSelectionDto"/>.
/// </summary>
/// <param name="pluginId">Optional. The Id of the plugin providing the provider or reader.</param>
/// <param name="isEnabled">Optional. Whether the provider or reader is enabled.</param>
/// <param name="includeIsEnabled">Whether the choice carries an enabled state. When <see langword="false"/>, the enabled state is <see langword="null"/>.</param>
/// <returns>The created <see cref="LibraryProviderSelectionDto"/>.</returns>
public LibraryProviderSelectionDto Create(
Guid? pluginId = null,
bool? isEnabled = null,
bool includeIsEnabled = true)
{
return new LibraryProviderSelectionDto
{
PluginId = pluginId ?? Guid.NewGuid(),
IsEnabled = includeIsEnabled ? isEnabled ?? _faker.Random.Bool() : null
};
}
/// <summary>
/// Creates a list of <see cref="LibraryProviderSelectionDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<LibraryProviderSelectionDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,36 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Requests.Library.Management;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.Management;
/// <summary>
/// Fixture class for the <see cref="GetLibraryTypeArtworkProvidersRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetLibraryTypeArtworkProvidersRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="GetLibraryTypeArtworkProvidersRequest"/>.
/// </summary>
/// <param name="libraryType">Optional. The media library type whose available artwork providers are retrieved.</param>
/// <returns>The created <see cref="GetLibraryTypeArtworkProvidersRequest"/>.</returns>
public GetLibraryTypeArtworkProvidersRequest Create(
string? libraryType = null)
{
return new GetLibraryTypeArtworkProvidersRequest(libraryType ?? "Book");
}
/// <summary>
/// Creates a list of <see cref="GetLibraryTypeArtworkProvidersRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetLibraryTypeArtworkProvidersRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,36 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Requests.Library.Management;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.Management;
/// <summary>
/// Fixture class for the <see cref="GetLibraryTypeBookReadersRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetLibraryTypeBookReadersRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="GetLibraryTypeBookReadersRequest"/>.
/// </summary>
/// <param name="libraryType">Optional. The media library type whose available book readers are retrieved.</param>
/// <returns>The created <see cref="GetLibraryTypeBookReadersRequest"/>.</returns>
public GetLibraryTypeBookReadersRequest Create(
string? libraryType = null)
{
return new GetLibraryTypeBookReadersRequest(libraryType ?? "Book");
}
/// <summary>
/// Creates a list of <see cref="GetLibraryTypeBookReadersRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetLibraryTypeBookReadersRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,36 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Requests.Library.Management;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.Management;
/// <summary>
/// Fixture class for the <see cref="GetLibraryTypeMetadataProvidersRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetLibraryTypeMetadataProvidersRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="GetLibraryTypeMetadataProvidersRequest"/>.
/// </summary>
/// <param name="libraryType">Optional. The media library type whose available metadata providers are retrieved.</param>
/// <returns>The created <see cref="GetLibraryTypeMetadataProvidersRequest"/>.</returns>
public GetLibraryTypeMetadataProvidersRequest Create(
string? libraryType = null)
{
return new GetLibraryTypeMetadataProvidersRequest(libraryType ?? "Book");
}
/// <summary>
/// Creates a list of <see cref="GetLibraryTypeMetadataProvidersRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetLibraryTypeMetadataProvidersRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,45 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Presentation.Web.Common.Requests.Plugins;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="ReorderLibraryArtworkProvidersRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class ReorderLibraryArtworkProvidersRequestFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a new <see cref="ReorderLibraryArtworkProvidersRequest"/> instance with randomized test data.
/// </summary>
/// <param name="libraryId">Optional identifier of the media library.</param>
/// <param name="pluginIds">Optional plugin Ids in the new order.</param>
/// <returns>A configured <see cref="ReorderLibraryArtworkProvidersRequest"/> instance.</returns>
public ReorderLibraryArtworkProvidersRequest Create(
Guid? libraryId = null,
List<Guid>? pluginIds = null)
{
return new ReorderLibraryArtworkProvidersRequest(
LibraryId: libraryId ?? Guid.NewGuid(),
PluginIds: pluginIds ?? [_faker.Random.Guid(), _faker.Random.Guid()]
);
}
/// <summary>
/// Creates multiple <see cref="ReorderLibraryArtworkProvidersRequest"/> instances with randomized test data.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="ReorderLibraryArtworkProvidersRequest"/> instances.</returns>
public List<ReorderLibraryArtworkProvidersRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,45 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Presentation.Web.Common.Requests.Plugins;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="ReorderLibraryMetadataProvidersRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class ReorderLibraryMetadataProvidersRequestFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a new <see cref="ReorderLibraryMetadataProvidersRequest"/> instance with randomized test data.
/// </summary>
/// <param name="libraryId">Optional identifier of the media library.</param>
/// <param name="pluginIds">Optional plugin Ids in the new order.</param>
/// <returns>A configured <see cref="ReorderLibraryMetadataProvidersRequest"/> instance.</returns>
public ReorderLibraryMetadataProvidersRequest Create(
Guid? libraryId = null,
List<Guid>? pluginIds = null)
{
return new ReorderLibraryMetadataProvidersRequest(
LibraryId: libraryId ?? Guid.NewGuid(),
PluginIds: pluginIds ?? [_faker.Random.Guid(), _faker.Random.Guid()]
);
}
/// <summary>
/// Creates multiple <see cref="ReorderLibraryMetadataProvidersRequest"/> instances with randomized test data.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="ReorderLibraryMetadataProvidersRequest"/> instances.</returns>
public List<ReorderLibraryMetadataProvidersRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,45 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Requests.Plugins;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="SetBookReaderEnabledRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class SetBookReaderEnabledRequestFixture
{
/// <summary>
/// Creates a random valid <see cref="SetBookReaderEnabledRequest"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose book reader is enabled or disabled.</param>
/// <param name="pluginId">Optional. The unique identifier of the plugin providing the book reader.</param>
/// <param name="isEnabled">Optional. Whether the book reader should be enabled for the media library.</param>
/// <returns>The created <see cref="SetBookReaderEnabledRequest"/>.</returns>
public SetBookReaderEnabledRequest Create(
Guid? libraryId = null,
Guid? pluginId = null,
bool? isEnabled = null)
{
return new SetBookReaderEnabledRequest(
LibraryId: libraryId ?? Guid.NewGuid(),
PluginId: pluginId ?? Guid.NewGuid(),
IsEnabled: isEnabled ?? true
);
}
/// <summary>
/// Creates a list of <see cref="SetBookReaderEnabledRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<SetBookReaderEnabledRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,48 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Presentation.Web.Common.Requests.Plugins;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="SetLibraryArtworkProviderEnabledRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class SetLibraryArtworkProviderEnabledRequestFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a new <see cref="SetLibraryArtworkProviderEnabledRequest"/> instance with randomized test data.
/// </summary>
/// <param name="libraryId">Optional identifier of the media library.</param>
/// <param name="pluginId">Optional identifier of the plugin.</param>
/// <param name="isEnabled">Optional value indicating whether the artwork provider is enabled.</param>
/// <returns>A configured <see cref="SetLibraryArtworkProviderEnabledRequest"/> instance.</returns>
public SetLibraryArtworkProviderEnabledRequest Create(
Guid? libraryId = null,
Guid? pluginId = null,
bool? isEnabled = null)
{
return new SetLibraryArtworkProviderEnabledRequest(
LibraryId: libraryId ?? Guid.NewGuid(),
PluginId: pluginId ?? Guid.NewGuid(),
IsEnabled: isEnabled ?? _faker.Random.Bool()
);
}
/// <summary>
/// Creates multiple <see cref="SetLibraryArtworkProviderEnabledRequest"/> instances with randomized test data.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="SetLibraryArtworkProviderEnabledRequest"/> instances.</returns>
public List<SetLibraryArtworkProviderEnabledRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,48 +0,0 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Presentation.Web.Common.Requests.Plugins;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
/// <summary>
/// Fixture class for the <see cref="SetLibraryMetadataProviderEnabledRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class SetLibraryMetadataProviderEnabledRequestFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a new <see cref="SetLibraryMetadataProviderEnabledRequest"/> instance with randomized test data.
/// </summary>
/// <param name="libraryId">Optional identifier of the media library.</param>
/// <param name="pluginId">Optional identifier of the plugin.</param>
/// <param name="isEnabled">Optional value indicating whether the metadata provider is enabled.</param>
/// <returns>A configured <see cref="SetLibraryMetadataProviderEnabledRequest"/> instance.</returns>
public SetLibraryMetadataProviderEnabledRequest Create(
Guid? libraryId = null,
Guid? pluginId = null,
bool? isEnabled = null)
{
return new SetLibraryMetadataProviderEnabledRequest(
LibraryId: libraryId ?? Guid.NewGuid(),
PluginId: pluginId ?? Guid.NewGuid(),
IsEnabled: isEnabled ?? _faker.Random.Bool()
);
}
/// <summary>
/// Creates multiple <see cref="SetLibraryMetadataProviderEnabledRequest"/> instances with randomized test data.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="SetLibraryMetadataProviderEnabledRequest"/> instances.</returns>
public List<SetLibraryMetadataProviderEnabledRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}