mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19: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
-1
@@ -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(),
|
||||
|
||||
+48
@@ -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())];
|
||||
}
|
||||
}
|
||||
+36
@@ -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())];
|
||||
}
|
||||
}
|
||||
+36
@@ -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())];
|
||||
}
|
||||
}
|
||||
+36
@@ -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())];
|
||||
}
|
||||
}
|
||||
-45
@@ -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())];
|
||||
}
|
||||
}
|
||||
-45
@@ -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())];
|
||||
}
|
||||
}
|
||||
-45
@@ -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())];
|
||||
}
|
||||
}
|
||||
-48
@@ -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())];
|
||||
}
|
||||
}
|
||||
-48
@@ -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())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user