mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:21:10 +00:00
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:
1 parent
48ad8692af
commit
64e5163229
127 files changed
+5541
-5296
No files matched your search
+11
-2
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+43
@@ -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())];
|
||||
}
|
||||
}
|
||||
+11
-5
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user