diff --git a/src/Lumina.sln b/src/Lumina.sln
index 9c38d44d..2859a645 100644
--- a/src/Lumina.sln
+++ b/src/Lumina.sln
@@ -1,4 +1,3 @@
-
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandFixture.cs
new file mode 100644
index 00000000..beb7bf52
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandFixture.cs
@@ -0,0 +1,76 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Application.Fixtures.Core.MediaLibrary.Management.Commands.AddLibrary;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class AddLibraryCommandFixture
+{
+ ///
+ /// Creates a random valid command to add a media library.
+ ///
+ /// Optional. The title of the media library.
+ /// Optional. The type of the media library.
+ /// Optional. The content locations of the media library.
+ /// Optional. The cover image path of the media library.
+ /// Whether the media library is enabled or not.
+ /// Whether the media library is locked or not.
+ /// Whether the media library should download metadata from the web or not.
+ /// Whether the metadata should be saved in the media directories or not.
+ /// Whether unchanged directories should be skipped during a scan or not.
+ /// The created command.
+ public AddLibraryCommand Create(
+ string? title = null,
+ string? libraryType = null,
+ string[]? contentLocations = null,
+ string? coverImage = null,
+ bool isEnabled = true,
+ bool isLocked = false,
+ bool downloadMetadataFromWeb = true,
+ bool shouldSaveMetadataInMediaDirectories = true,
+ bool shouldSkipUnchangedDirectoriesDuringScan = false)
+ {
+ return new Faker()
+ .CustomInstantiator(f => new AddLibraryCommand(
+ default!,
+ default!,
+ default!,
+ default!,
+ true,
+ false,
+ true,
+ true,
+ false
+ ))
+ .RuleFor(x => x.Title, f => title ?? f.Lorem.Word())
+ .RuleFor(x => x.LibraryType, f => libraryType ?? f.Random.Enum().ToString())
+ .RuleFor(x => x.ContentLocations, f => contentLocations ?? [f.System.DirectoryPath(), f.System.DirectoryPath(), f.System.DirectoryPath()])
+ .RuleFor(x => x.CoverImage, f => coverImage ?? f.System.FilePath())
+ .RuleFor(x => x.IsEnabled, isEnabled)
+ .RuleFor(x => x.IsLocked, isLocked)
+ .RuleFor(x => x.DownloadMetadataFromWeb, downloadMetadataFromWeb)
+ .RuleFor(x => x.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories)
+ .RuleFor(x => x.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan)
+ .Generate();
+ }
+
+ ///
+ /// Creates a list of .
+ ///
+ /// The number of elements to create.
+ /// The created list.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/CancelLibraryScan/CancelLibraryScanCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/CancelLibraryScan/CancelLibraryScanCommandFixture.cs
new file mode 100644
index 00000000..05c4453f
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/CancelLibraryScan/CancelLibraryScanCommandFixture.cs
@@ -0,0 +1,42 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Application.Core.MediaLibrary.Management.Commands.CancelLibraryScan;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Application.Fixtures.Core.MediaLibrary.Management.Commands.CancelLibraryScan;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class CancelLibraryScanCommandFixture
+{
+ ///
+ /// Creates a random valid command to cancel a media library scan.
+ ///
+ /// Optional. The Id of the media library whose scan is cancelled.
+ /// Optional. The Id of the scan to cancel.
+ /// The created command.
+ public CancelLibraryScanCommand Create(Guid? libraryId = null, Guid? scanId = null)
+ {
+ return new Faker()
+ .CustomInstantiator(f => new CancelLibraryScanCommand(
+ libraryId ?? Guid.NewGuid(),
+ scanId ?? Guid.NewGuid()))
+ .Generate();
+ }
+
+ ///
+ /// Creates a list of .
+ ///
+ /// The number of elements to create.
+ /// The created list.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/DeleteLibrary/DeleteLibraryCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/DeleteLibrary/DeleteLibraryCommandFixture.cs
new file mode 100644
index 00000000..4ca18c12
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/DeleteLibrary/DeleteLibraryCommandFixture.cs
@@ -0,0 +1,40 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Application.Core.MediaLibrary.Management.Commands.DeleteLibrary;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Application.Fixtures.Core.MediaLibrary.Management.Commands.DeleteLibrary;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class DeleteLibraryCommandFixture
+{
+ ///
+ /// Creates a random valid command to delete a media library.
+ ///
+ /// Optional. The Id of the media library to delete.
+ /// The created command.
+ public DeleteLibraryCommand Create(Guid? id = null)
+ {
+ return new Faker()
+ .CustomInstantiator(f => new DeleteLibraryCommand(
+ id ?? Guid.NewGuid()))
+ .Generate();
+ }
+
+ ///
+ /// Creates a list of .
+ ///
+ /// The number of elements to create.
+ /// The created list.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/ScanLibrary/ScanLibraryCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/ScanLibrary/ScanLibraryCommandFixture.cs
new file mode 100644
index 00000000..81af8a4b
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/ScanLibrary/ScanLibraryCommandFixture.cs
@@ -0,0 +1,40 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Application.Core.MediaLibrary.Management.Commands.ScanLibrary;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Application.Fixtures.Core.MediaLibrary.Management.Commands.ScanLibrary;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class ScanLibraryCommandFixture
+{
+ ///
+ /// Creates a random valid command to scan a media library.
+ ///
+ /// Optional. The Id of the media library to scan.
+ /// The created command.
+ public ScanLibraryCommand Create(Guid? id = null)
+ {
+ return new Faker()
+ .CustomInstantiator(f => new ScanLibraryCommand(
+ id ?? Guid.NewGuid()))
+ .Generate();
+ }
+
+ ///
+ /// Creates a list of .
+ ///
+ /// The number of elements to create.
+ /// The created list.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandFixture.cs
new file mode 100644
index 00000000..2bdddac8
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandFixture.cs
@@ -0,0 +1,84 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Application.Core.MediaLibrary.Management.Commands.UpdateLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Application.Fixtures.Core.MediaLibrary.Management.Commands.UpdateLibrary;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class UpdateLibraryCommandFixture
+{
+ ///
+ /// Creates a random valid command to update a media library.
+ ///
+ /// Optional. The Id of the media library.
+ /// Optional. The Id of the user owning the media library.
+ /// Optional. The title of the media library.
+ /// Optional. The type of the media library.
+ /// Optional. The content locations of the media library.
+ /// Optional. The cover image path of the media library.
+ /// Whether the media library is enabled or not.
+ /// Whether the media library is locked or not.
+ /// Whether the media library should download metadata from the web or not.
+ /// Whether the metadata should be saved in the media directories or not.
+ /// Whether unchanged directories should be skipped during a scan or not.
+ /// The created command.
+ public UpdateLibraryCommand Create(
+ Guid? id = null,
+ Guid? ownerId = null,
+ string? title = null,
+ string? libraryType = null,
+ string[]? contentLocations = null,
+ string? coverImage = null,
+ bool isEnabled = true,
+ bool isLocked = false,
+ bool downloadMetadataFromWeb = true,
+ bool shouldSaveMetadataInMediaDirectories = true,
+ bool shouldSkipUnchangedDirectoriesDuringScan = false)
+ {
+ return new Faker()
+ .CustomInstantiator(f => new UpdateLibraryCommand(
+ default,
+ default,
+ default!,
+ default!,
+ default!,
+ default!,
+ true,
+ false,
+ true,
+ true,
+ false
+ ))
+ .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().ToString())
+ .RuleFor(x => x.ContentLocations, f => contentLocations ?? [f.System.DirectoryPath(), f.System.DirectoryPath(), f.System.DirectoryPath()])
+ .RuleFor(x => x.CoverImage, f => coverImage ?? f.System.FilePath())
+ .RuleFor(x => x.IsEnabled, isEnabled)
+ .RuleFor(x => x.IsLocked, isLocked)
+ .RuleFor(x => x.DownloadMetadataFromWeb, downloadMetadataFromWeb)
+ .RuleFor(x => x.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories)
+ .RuleFor(x => x.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan)
+ .Generate();
+ }
+
+ ///
+ /// Creates a list of .
+ ///
+ /// The number of elements to create.
+ /// The created list.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryFixture.cs
new file mode 100644
index 00000000..764b79b5
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryFixture.cs
@@ -0,0 +1,40 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibrary;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Application.Fixtures.Core.MediaLibrary.Management.Queries.GetLibrary;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class GetLibraryQueryFixture
+{
+ ///
+ /// Creates a random valid query to get a media library.
+ ///
+ /// Optional. The Id of the media library to get.
+ /// The created query.
+ public GetLibraryQuery Create(Guid? id = null)
+ {
+ return new Faker()
+ .CustomInstantiator(f => new GetLibraryQuery(
+ id ?? Guid.NewGuid()))
+ .Generate();
+ }
+
+ ///
+ /// Creates a list of .
+ ///
+ /// The number of elements to create.
+ /// The created list.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Queries/GetLibraryScanProgress/GetLibraryScanProgressQueryFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Queries/GetLibraryScanProgress/GetLibraryScanProgressQueryFixture.cs
new file mode 100644
index 00000000..4467e2be
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/Management/Queries/GetLibraryScanProgress/GetLibraryScanProgressQueryFixture.cs
@@ -0,0 +1,42 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibraryScanProgress;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Application.Fixtures.Core.MediaLibrary.Management.Queries.GetLibraryScanProgress;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class GetLibraryScanProgressQueryFixture
+{
+ ///
+ /// Creates a random valid query to get the progress of a media library scan.
+ ///
+ /// Optional. The Id of the media library whose scan progress is requested.
+ /// Optional. The Id of the media library scan whose progress is requested.
+ /// The created query.
+ public GetLibraryScanProgressQuery Create(Guid? libraryId = null, Guid? scanId = null)
+ {
+ return new Faker()
+ .CustomInstantiator(f => new GetLibraryScanProgressQuery(
+ libraryId ?? Guid.NewGuid(),
+ scanId ?? Guid.NewGuid()))
+ .Generate();
+ }
+
+ ///
+ /// Creates a list of .
+ ///
+ /// The number of elements to create.
+ /// The created list.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/Plugins/Commands/ReorderLibraryMetadataProviders/ReorderLibraryMetadataProvidersCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/Plugins/Commands/ReorderLibraryMetadataProviders/ReorderLibraryMetadataProvidersCommandFixture.cs
new file mode 100644
index 00000000..6855acd8
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/Plugins/Commands/ReorderLibraryMetadataProviders/ReorderLibraryMetadataProvidersCommandFixture.cs
@@ -0,0 +1,44 @@
+#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;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class ReorderLibraryMetadataProvidersCommandFixture
+{
+ ///
+ /// Creates a random valid command to reorder the metadata providers of a media library.
+ ///
+ /// Optional. The Id of the media library whose metadata providers are reordered.
+ /// Optional. The plugin Ids in the new order.
+ /// The created command.
+ public ReorderLibraryMetadataProvidersCommand Create(Guid? libraryId = null, IReadOnlyList? pluginIds = null)
+ {
+ return new Faker()
+ .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();
+ }
+
+ ///
+ /// Creates a list of .
+ ///
+ /// The number of elements to create.
+ /// The created list.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/Plugins/Commands/SetLibraryMetadataProviderEnabled/SetLibraryMetadataProviderEnabledCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/Plugins/Commands/SetLibraryMetadataProviderEnabled/SetLibraryMetadataProviderEnabledCommandFixture.cs
new file mode 100644
index 00000000..c640fb2c
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/Plugins/Commands/SetLibraryMetadataProviderEnabled/SetLibraryMetadataProviderEnabledCommandFixture.cs
@@ -0,0 +1,47 @@
+#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;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class SetLibraryMetadataProviderEnabledCommandFixture
+{
+ ///
+ /// Creates a random valid command to enable or disable a metadata provider for a media library.
+ ///
+ /// Optional. The Id of the media library whose metadata provider is enabled or disabled.
+ /// Optional. The Id of the plugin providing the metadata.
+ /// Whether the metadata provider should be enabled for the media library.
+ /// The created command.
+ public SetLibraryMetadataProviderEnabledCommand Create(Guid? libraryId = null, Guid? pluginId = null, bool isEnabled = true)
+ {
+ return new Faker()
+ .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();
+ }
+
+ ///
+ /// Creates a list of .
+ ///
+ /// The number of elements to create.
+ /// The created list.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Application.Fixtures/Core/Plugins/Commands/UpdatePluginSettings/UpdatePluginSettingsCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/Plugins/Commands/UpdatePluginSettings/UpdatePluginSettingsCommandFixture.cs
new file mode 100644
index 00000000..04f17b32
--- /dev/null
+++ b/tests/Common/Lumina.Application.Fixtures/Core/Plugins/Commands/UpdatePluginSettings/UpdatePluginSettingsCommandFixture.cs
@@ -0,0 +1,44 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Application.Core.Plugins.Commands.UpdatePluginSettings;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Application.Fixtures.Core.Plugins.Commands.UpdatePluginSettings;
+
+///
+/// Fixture class for the class.
+///
+[ExcludeFromCodeCoverage]
+public class UpdatePluginSettingsCommandFixture
+{
+ ///
+ /// Creates a random valid command to update the settings of a plugin.
+ ///
+ /// Optional. The Id of the plugin.
+ /// Optional. The settings of the plugin.
+ /// The created command.
+ public UpdatePluginSettingsCommand Create(Guid? pluginId = null, IReadOnlyDictionary? settings = null)
+ {
+ return new Faker()
+ .CustomInstantiator(f => new UpdatePluginSettingsCommand(
+ default,
+ default!))
+ .RuleFor(x => x.PluginId, pluginId ?? Guid.NewGuid())
+ .RuleFor(x => x.Settings, f => settings ?? new Dictionary { [f.Lorem.Word()] = f.Lorem.Word() })
+ .Generate();
+ }
+
+ ///
+ /// Creates a list of .
+ ///
+ /// The number of elements to create.
+ /// The created list.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandValidatorTests.cs
new file mode 100644
index 00000000..cde654eb
--- /dev/null
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandValidatorTests.cs
@@ -0,0 +1,216 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
+using Lumina.Application.Fixtures.Core.MediaLibrary.Management.Commands.AddLibrary;
+using Lumina.Application.UnitTests.Common.Setup;
+using Lumina.Domain.Common.Errors;
+using Lumina.Domain.Common.Primitives;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Application.UnitTests.Core.MediaLibrary.Management.Commands.AddLibrary;
+
+///
+/// Contains unit tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class AddLibraryCommandValidatorTests
+{
+ private readonly AddLibraryCommandValidator _validator = new();
+ private readonly AddLibraryCommandFixture _addLibraryCommandFixture = new();
+
+ [Fact]
+ public void Validate_WhenLibraryTypeIsNull_ShouldHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+ command = command with { LibraryType = null! };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.LibraryTypeCannotBeNull);
+ }
+
+ [Fact]
+ public void Validate_WhenLibraryTypeIsUnknown_ShouldHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+ command = command with { LibraryType = "UnknownLibraryType" };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.UnknownLibraryType);
+ }
+
+ [Fact]
+ public void Validate_WhenLibraryTypeIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+ command = command with { LibraryType = "Book" };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Library.UnknownLibraryType);
+ }
+
+ [Fact]
+ public void Validate_WhenContentLocationsIsNull_ShouldHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+ command = command with { ContentLocations = null! };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.PathsListCannotBeNull);
+ }
+
+ [Fact]
+ public void Validate_WhenContentLocationsIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+ command = command with { ContentLocations = [] };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.PathsListCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenContentLocationIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+ command = command with { ContentLocations = [string.Empty] };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.FileSystemManagement.PathCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenContentLocationExceeds260Characters_ShouldHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+ command = command with { ContentLocations = [new string('a', 261)] };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.FileSystemManagement.PathMustBeMaximum260CharactersLong);
+ }
+
+ [Fact]
+ public void Validate_WhenContentLocationsAreValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Library.PathsListCannotBeNull);
+ result.ShouldNotHaveValidationError(Errors.FileSystemManagement.PathCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenTitleIsNull_ShouldHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+ command = command with { Title = null! };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.TitleCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenTitleIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+ command = command with { Title = string.Empty };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.TitleCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenTitleIsWhitespace_ShouldHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+ command = command with { Title = " " };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.TitleCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenTitleExceeds255Characters_ShouldHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+ command = command with { Title = new string('a', 256) };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.TitleMustBeMaximum255CharactersLong);
+ }
+
+ [Fact]
+ public void Validate_WhenTitleIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Library.TitleCannotBeEmpty);
+ result.ShouldNotHaveValidationError(Errors.Library.TitleMustBeMaximum255CharactersLong);
+ }
+
+ [Fact]
+ public void Validate_WhenCommandIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ AddLibraryCommand command = _addLibraryCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveAnyValidationErrors();
+ }
+}
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/CancelLibraryScan/CancelLibraryScanCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/CancelLibraryScan/CancelLibraryScanCommandValidatorTests.cs
new file mode 100644
index 00000000..4e688dcd
--- /dev/null
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/CancelLibraryScan/CancelLibraryScanCommandValidatorTests.cs
@@ -0,0 +1,89 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Core.MediaLibrary.Management.Commands.CancelLibraryScan;
+using Lumina.Application.Fixtures.Core.MediaLibrary.Management.Commands.CancelLibraryScan;
+using Lumina.Application.UnitTests.Common.Setup;
+using Lumina.Domain.Common.Errors;
+using Lumina.Domain.Common.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Application.UnitTests.Core.MediaLibrary.Management.Commands.CancelLibraryScan;
+
+///
+/// Contains unit tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class CancelLibraryScanCommandValidatorTests
+{
+ private readonly CancelLibraryScanCommandValidator _validator = new();
+ private readonly CancelLibraryScanCommandFixture _cancelLibraryScanCommandFixture = new();
+
+ [Fact]
+ public void Validate_WhenLibraryIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ CancelLibraryScanCommand command = _cancelLibraryScanCommandFixture.Create();
+ command = command with { LibraryId = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenLibraryIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ CancelLibraryScanCommand command = _cancelLibraryScanCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenScanIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ CancelLibraryScanCommand command = _cancelLibraryScanCommandFixture.Create();
+ command = command with { ScanId = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.LibraryScanning.ScanIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenScanIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ CancelLibraryScanCommand command = _cancelLibraryScanCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.LibraryScanning.ScanIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenCommandIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ CancelLibraryScanCommand command = _cancelLibraryScanCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveAnyValidationErrors();
+ }
+}
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/DeleteLibrary/DeleteLibraryCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/DeleteLibrary/DeleteLibraryCommandValidatorTests.cs
new file mode 100644
index 00000000..1b4a8f04
--- /dev/null
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/DeleteLibrary/DeleteLibraryCommandValidatorTests.cs
@@ -0,0 +1,49 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Core.MediaLibrary.Management.Commands.DeleteLibrary;
+using Lumina.Application.Fixtures.Core.MediaLibrary.Management.Commands.DeleteLibrary;
+using Lumina.Application.UnitTests.Common.Setup;
+using Lumina.Domain.Common.Errors;
+using Lumina.Domain.Common.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Application.UnitTests.Core.MediaLibrary.Management.Commands.DeleteLibrary;
+
+///
+/// Contains unit tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class DeleteLibraryCommandValidatorTests
+{
+ private readonly DeleteLibraryCommandValidator _validator = new();
+ private readonly DeleteLibraryCommandFixture _deleteLibraryCommandFixture = new();
+
+ [Fact]
+ public void Validate_WhenIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ DeleteLibraryCommand command = _deleteLibraryCommandFixture.Create();
+ command = command with { Id = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ DeleteLibraryCommand command = _deleteLibraryCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveAnyValidationErrors();
+ }
+}
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/ScanLibrary/ScanLibraryCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/ScanLibrary/ScanLibraryCommandValidatorTests.cs
new file mode 100644
index 00000000..c31570d2
--- /dev/null
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/ScanLibrary/ScanLibraryCommandValidatorTests.cs
@@ -0,0 +1,49 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Core.MediaLibrary.Management.Commands.ScanLibrary;
+using Lumina.Application.Fixtures.Core.MediaLibrary.Management.Commands.ScanLibrary;
+using Lumina.Application.UnitTests.Common.Setup;
+using Lumina.Domain.Common.Errors;
+using Lumina.Domain.Common.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Application.UnitTests.Core.MediaLibrary.Management.Commands.ScanLibrary;
+
+///
+/// Contains unit tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class ScanLibraryCommandValidatorTests
+{
+ private readonly ScanLibraryCommandValidator _validator = new();
+ private readonly ScanLibraryCommandFixture _scanLibraryCommandFixture = new();
+
+ [Fact]
+ public void Validate_WhenIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ ScanLibraryCommand command = _scanLibraryCommandFixture.Create();
+ command = command with { Id = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ ScanLibraryCommand command = _scanLibraryCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveAnyValidationErrors();
+ }
+}
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandValidatorTests.cs
new file mode 100644
index 00000000..f5c025a2
--- /dev/null
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandValidatorTests.cs
@@ -0,0 +1,271 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Core.MediaLibrary.Management.Commands.UpdateLibrary;
+using Lumina.Application.Fixtures.Core.MediaLibrary.Management.Commands.UpdateLibrary;
+using Lumina.Application.UnitTests.Common.Setup;
+using Lumina.Domain.Common.Errors;
+using Lumina.Domain.Common.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Application.UnitTests.Core.MediaLibrary.Management.Commands.UpdateLibrary;
+
+///
+/// Contains unit tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class UpdateLibraryCommandValidatorTests
+{
+ private readonly UpdateLibraryCommandValidator _validator = new();
+ private readonly UpdateLibraryCommandFixture _updateLibraryCommandFixture = new();
+
+ [Fact]
+ public void Validate_WhenIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { Id = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenOwnerIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { OwnerId = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Users.UserIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenOwnerIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Users.UserIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenLibraryTypeIsNull_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { LibraryType = null! };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.LibraryTypeCannotBeNull);
+ }
+
+ [Fact]
+ public void Validate_WhenLibraryTypeIsUnknown_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { LibraryType = "UnknownLibraryType" };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.UnknownLibraryType);
+ }
+
+ [Fact]
+ public void Validate_WhenLibraryTypeIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { LibraryType = "Book" };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Library.UnknownLibraryType);
+ }
+
+ [Fact]
+ public void Validate_WhenContentLocationsIsNull_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { ContentLocations = null! };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.PathsListCannotBeNull);
+ }
+
+ [Fact]
+ public void Validate_WhenContentLocationsIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { ContentLocations = [] };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.PathsListCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenContentLocationIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { ContentLocations = [string.Empty] };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.FileSystemManagement.PathCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenContentLocationExceeds260Characters_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { ContentLocations = [new string('a', 261)] };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.FileSystemManagement.PathMustBeMaximum260CharactersLong);
+ }
+
+ [Fact]
+ public void Validate_WhenContentLocationsAreValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Library.PathsListCannotBeNull);
+ result.ShouldNotHaveValidationError(Errors.FileSystemManagement.PathCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenTitleIsNull_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { Title = null! };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.TitleCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenTitleIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { Title = string.Empty };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.TitleCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenTitleIsWhitespace_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { Title = " " };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.TitleCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenTitleExceeds255Characters_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+ command = command with { Title = new string('a', 256) };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.TitleMustBeMaximum255CharactersLong);
+ }
+
+ [Fact]
+ public void Validate_WhenTitleIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Library.TitleCannotBeEmpty);
+ result.ShouldNotHaveValidationError(Errors.Library.TitleMustBeMaximum255CharactersLong);
+ }
+
+ [Fact]
+ public void Validate_WhenCommandIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveAnyValidationErrors();
+ }
+}
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryValidatorTests.cs
new file mode 100644
index 00000000..a9e28769
--- /dev/null
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryValidatorTests.cs
@@ -0,0 +1,49 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibrary;
+using Lumina.Application.Fixtures.Core.MediaLibrary.Management.Queries.GetLibrary;
+using Lumina.Application.UnitTests.Common.Setup;
+using Lumina.Domain.Common.Errors;
+using Lumina.Domain.Common.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Application.UnitTests.Core.MediaLibrary.Management.Queries.GetLibrary;
+
+///
+/// Contains unit tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class GetLibraryQueryValidatorTests
+{
+ private readonly GetLibraryQueryValidator _validator = new();
+ private readonly GetLibraryQueryFixture _getLibraryQueryFixture = new();
+
+ [Fact]
+ public void Validate_WhenIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ GetLibraryQuery query = _getLibraryQueryFixture.Create();
+ query = query with { Id = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(query);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ GetLibraryQuery query = _getLibraryQueryFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(query);
+
+ // Assert
+ result.ShouldNotHaveAnyValidationErrors();
+ }
+}
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibraryScanProgress/GetLibraryScanProgressQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibraryScanProgress/GetLibraryScanProgressQueryValidatorTests.cs
new file mode 100644
index 00000000..d2f5da72
--- /dev/null
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibraryScanProgress/GetLibraryScanProgressQueryValidatorTests.cs
@@ -0,0 +1,89 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibraryScanProgress;
+using Lumina.Application.Fixtures.Core.MediaLibrary.Management.Queries.GetLibraryScanProgress;
+using Lumina.Application.UnitTests.Common.Setup;
+using Lumina.Domain.Common.Errors;
+using Lumina.Domain.Common.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Application.UnitTests.Core.MediaLibrary.Management.Queries.GetLibraryScanProgress;
+
+///
+/// Contains unit tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class GetLibraryScanProgressQueryValidatorTests
+{
+ private readonly GetLibraryScanProgressQueryValidator _validator = new();
+ private readonly GetLibraryScanProgressQueryFixture _getLibraryScanProgressQueryFixture = new();
+
+ [Fact]
+ public void Validate_WhenLibraryIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ GetLibraryScanProgressQuery query = _getLibraryScanProgressQueryFixture.Create();
+ query = query with { LibraryId = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(query);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenLibraryIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ GetLibraryScanProgressQuery query = _getLibraryScanProgressQueryFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(query);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenScanIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ GetLibraryScanProgressQuery query = _getLibraryScanProgressQueryFixture.Create();
+ query = query with { ScanId = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(query);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.LibraryScanning.LibraryScanIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenScanIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ GetLibraryScanProgressQuery query = _getLibraryScanProgressQueryFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(query);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.LibraryScanning.LibraryScanIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenQueryIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ GetLibraryScanProgressQuery query = _getLibraryScanProgressQueryFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(query);
+
+ // Assert
+ result.ShouldNotHaveAnyValidationErrors();
+ }
+}
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Commands/ReorderLibraryMetadataProviders/ReorderLibraryMetadataProvidersCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Commands/ReorderLibraryMetadataProviders/ReorderLibraryMetadataProvidersCommandValidatorTests.cs
new file mode 100644
index 00000000..8f40ca9a
--- /dev/null
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Commands/ReorderLibraryMetadataProviders/ReorderLibraryMetadataProvidersCommandValidatorTests.cs
@@ -0,0 +1,104 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Core.Plugins.Commands.ReorderLibraryMetadataProviders;
+using Lumina.Application.Fixtures.Core.Plugins.Commands.ReorderLibraryMetadataProviders;
+using Lumina.Application.UnitTests.Common.Setup;
+using Lumina.Domain.Common.Errors;
+using Lumina.Domain.Common.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Application.UnitTests.Core.Plugins.Commands.ReorderLibraryMetadataProviders;
+
+///
+/// Contains unit tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class ReorderLibraryMetadataProvidersCommandValidatorTests
+{
+ private readonly ReorderLibraryMetadataProvidersCommandValidator _validator = new();
+ private readonly ReorderLibraryMetadataProvidersCommandFixture _reorderLibraryMetadataProvidersCommandFixture = new();
+
+ [Fact]
+ public void Validate_WhenLibraryIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ ReorderLibraryMetadataProvidersCommand command = _reorderLibraryMetadataProvidersCommandFixture.Create();
+ command = command with { LibraryId = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Plugins.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenLibraryIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ ReorderLibraryMetadataProvidersCommand command = _reorderLibraryMetadataProvidersCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Plugins.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenPluginIdsIsNull_ShouldHaveValidationError()
+ {
+ // Arrange
+ ReorderLibraryMetadataProvidersCommand command = _reorderLibraryMetadataProvidersCommandFixture.Create();
+ command = command with { PluginIds = null! };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Plugins.PluginIdsListCannotBeNull);
+ }
+
+ [Fact]
+ public void Validate_WhenPluginIdsIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ ReorderLibraryMetadataProvidersCommand command = _reorderLibraryMetadataProvidersCommandFixture.Create();
+ command = command with { PluginIds = [] };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Plugins.PluginIdsListCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenPluginIdsAreValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ ReorderLibraryMetadataProvidersCommand command = _reorderLibraryMetadataProvidersCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Plugins.PluginIdsListCannotBeNull);
+ result.ShouldNotHaveValidationError(Errors.Plugins.PluginIdsListCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenCommandIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ ReorderLibraryMetadataProvidersCommand command = _reorderLibraryMetadataProvidersCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveAnyValidationErrors();
+ }
+}
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Commands/SetLibraryMetadataProviderEnabled/SetLibraryMetadataProviderEnabledCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Commands/SetLibraryMetadataProviderEnabled/SetLibraryMetadataProviderEnabledCommandValidatorTests.cs
new file mode 100644
index 00000000..15c0aa5c
--- /dev/null
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Commands/SetLibraryMetadataProviderEnabled/SetLibraryMetadataProviderEnabledCommandValidatorTests.cs
@@ -0,0 +1,89 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Core.Plugins.Commands.SetLibraryMetadataProviderEnabled;
+using Lumina.Application.Fixtures.Core.Plugins.Commands.SetLibraryMetadataProviderEnabled;
+using Lumina.Application.UnitTests.Common.Setup;
+using Lumina.Domain.Common.Errors;
+using Lumina.Domain.Common.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Application.UnitTests.Core.Plugins.Commands.SetLibraryMetadataProviderEnabled;
+
+///
+/// Contains unit tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class SetLibraryMetadataProviderEnabledCommandValidatorTests
+{
+ private readonly SetLibraryMetadataProviderEnabledCommandValidator _validator = new();
+ private readonly SetLibraryMetadataProviderEnabledCommandFixture _setLibraryMetadataProviderEnabledCommandFixture = new();
+
+ [Fact]
+ public void Validate_WhenLibraryIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ SetLibraryMetadataProviderEnabledCommand command = _setLibraryMetadataProviderEnabledCommandFixture.Create();
+ command = command with { LibraryId = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Plugins.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenLibraryIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ SetLibraryMetadataProviderEnabledCommand command = _setLibraryMetadataProviderEnabledCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Plugins.LibraryIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenPluginIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ SetLibraryMetadataProviderEnabledCommand command = _setLibraryMetadataProviderEnabledCommandFixture.Create();
+ command = command with { PluginId = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Plugins.PluginIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenPluginIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ SetLibraryMetadataProviderEnabledCommand command = _setLibraryMetadataProviderEnabledCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveValidationError(Errors.Plugins.PluginIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenCommandIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ SetLibraryMetadataProviderEnabledCommand command = _setLibraryMetadataProviderEnabledCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveAnyValidationErrors();
+ }
+}
diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Commands/UpdatePluginSettings/UpdatePluginSettingsCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Commands/UpdatePluginSettings/UpdatePluginSettingsCommandValidatorTests.cs
new file mode 100644
index 00000000..6fe99bd4
--- /dev/null
+++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Commands/UpdatePluginSettings/UpdatePluginSettingsCommandValidatorTests.cs
@@ -0,0 +1,49 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Core.Plugins.Commands.UpdatePluginSettings;
+using Lumina.Application.Fixtures.Core.Plugins.Commands.UpdatePluginSettings;
+using Lumina.Application.UnitTests.Common.Setup;
+using Lumina.Domain.Common.Errors;
+using Lumina.Domain.Common.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Application.UnitTests.Core.Plugins.Commands.UpdatePluginSettings;
+
+///
+/// Contains unit tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class UpdatePluginSettingsCommandValidatorTests
+{
+ private readonly UpdatePluginSettingsCommandValidator _validator = new();
+ private readonly UpdatePluginSettingsCommandFixture _updatePluginSettingsCommandFixture = new();
+
+ [Fact]
+ public void Validate_WhenPluginIdIsEmpty_ShouldHaveValidationError()
+ {
+ // Arrange
+ UpdatePluginSettingsCommand command = _updatePluginSettingsCommandFixture.Create();
+ command = command with { PluginId = Guid.Empty };
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldHaveValidationError(Errors.Plugins.PluginIdCannotBeEmpty);
+ }
+
+ [Fact]
+ public void Validate_WhenPluginIdIsValid_ShouldNotHaveValidationError()
+ {
+ // Arrange
+ UpdatePluginSettingsCommand command = _updatePluginSettingsCommandFixture.Create();
+
+ // Act
+ List result = _validator.TestValidate(command);
+
+ // Assert
+ result.ShouldNotHaveAnyValidationErrors();
+ }
+}
diff --git a/tests/UnitTests/Lumina.Plugins.Contracts.UnitTests/Common/Fakes/FakeBookMetadataProvider.cs b/tests/UnitTests/Lumina.Plugins.Contracts.UnitTests/Common/Fakes/FakeBookMetadataProvider.cs
deleted file mode 100644
index 598ff362..00000000
--- a/tests/UnitTests/Lumina.Plugins.Contracts.UnitTests/Common/Fakes/FakeBookMetadataProvider.cs
+++ /dev/null
@@ -1,157 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Contracts.DTO.Common;
-using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
-using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
-using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
-using Lumina.Plugins.Contracts.Core.Metadata;
-using Lumina.Plugins.Contracts.Core.Plugins;
-using Lumina.Plugins.Contracts.Core.Plugins.Settings;
-using Microsoft.Extensions.DependencyInjection;
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-#endregion
-
-namespace Lumina.Plugins.Contracts.UnitTests.Common.Fakes;
-
-///
-/// A fake book metadata provider used to exercise the plugin contracts from outside.
-///
-public sealed class FakeBookMetadataProvider : IPlugin, IPluginServiceRegistrator, IRemoteMetadataProvider
-{
- ///
- /// Gets the stable unique identifier of the plugin, used to persist its state.
- ///
- public Guid Id { get; } = Guid.Parse("11111111-1111-1111-1111-111111111111");
-
- ///
- /// Gets the display name of the plugin.
- ///
- public string Name { get; } = "Fake Book Metadata Provider";
-
- ///
- /// Gets the author of the plugin.
- ///
- public string Author { get; } = "Lumina";
-
- ///
- /// Gets the version of the plugin.
- ///
- public Version Version { get; } = new(1, 0, 0);
-
- ///
- /// Gets the description of the plugin.
- ///
- public string Description { get; } = "A fake metadata provider used to exercise the plugin contracts.";
-
- ///
- /// Gets the media library type this metadata provider supports.
- ///
- public LibraryType SupportedLibraryType { get; } = LibraryType.Book;
-
- ///
- /// Gets a value indicating whether this metadata provider requires access to the web to retrieve metadata.
- ///
- public bool RequiresWebAccess { get; } = true;
-
- ///
- /// Gets the settings schema of the plugin, used by the host to render the plugin settings page.
- ///
- /// The collection of setting descriptors declared by the plugin.
- public IReadOnlyList GetSettingsSchema()
- {
- return
- [
- new PluginSettingDescriptor(
- Key: "preferredLanguage",
- Label: "Preferred Language",
- Type: PluginSettingType.Text,
- DefaultValue: "en"
- ),
- new PluginSettingDescriptor(
- Key: "selectionStrategy",
- Label: "Selection Strategy",
- Type: PluginSettingType.Select,
- DefaultValue: "first",
- AllowedValues: ["first", "best"]
- )
- ];
- }
-
- ///
- /// Registers the services of the plugin into the host dependency injection container.
- ///
- /// The service collection to which the plugin services are added.
- public void RegisterServices(IServiceCollection services)
- {
- }
-
- ///
- /// Searches for the metadata of the media item described by .
- ///
- /// The lookup describing the media item to search for.
- /// Cancellation token that can be used to stop the execution.
- /// The collection of metadata candidates found for the media item.
- public Task> GetSearchResultsAsync(BookMetadataLookupDto lookup, CancellationToken cancellationToken)
- {
- return Task.FromResult>(
- [
- CreateMetadata("The Fellowship of the Ring", "3")
- ]
- );
- }
-
- ///
- /// Gets the metadata of the media item described by .
- ///
- /// The lookup describing the media item to get the metadata for.
- /// Cancellation token that can be used to stop the execution.
- /// The metadata of the media item, or when no metadata was found.
- public Task GetMetadataAsync(BookMetadataLookupDto lookup, CancellationToken cancellationToken)
- {
- if (lookup.Title is null)
- return Task.FromResult(null);
- return Task.FromResult(CreateMetadata(lookup.Title, "3"));
- }
-
- private static BookMetadataDto CreateMetadata(string title, string goodreadsId)
- {
- return new BookMetadataDto(
- Title: title,
- OriginalTitle: title,
- Description: "A test description.",
- ReleaseInfo: new ReleaseInfoDto(
- OriginalReleaseDate: new DateOnly(1954, 7, 29),
- OriginalReleaseYear: 1954,
- ReReleaseDate: null,
- ReReleaseYear: null,
- ReleaseCountry: "uk",
- ReleaseVersion: null
- ),
- Genres: [new GenreDto("fantasy")],
- Tags: [new TagDto("epic fantasy")],
- Language: new LanguageInfoDto("en", "English", "English"),
- OriginalLanguage: null,
- Publisher: "Houghton Mifflin",
- PageCount: 398,
- Format: BookFormat.Paperback,
- Edition: null,
- VolumeNumber: 1,
- Series: null,
- ASIN: null,
- GoodreadsId: goodreadsId,
- LCCN: null,
- OCLCNumber: null,
- OpenLibraryId: null,
- LibraryThingId: null,
- GoogleBooksId: null,
- BarnesAndNobleId: null,
- AppleBooksId: null,
- Isbns: null,
- Contributors: null,
- Ratings: null,
- CoverImageUrl: null
- );
- }
-}
diff --git a/tests/UnitTests/Lumina.Plugins.Contracts.UnitTests/Core/Metadata/RemoteMetadataProviderTests.cs b/tests/UnitTests/Lumina.Plugins.Contracts.UnitTests/Core/Metadata/RemoteMetadataProviderTests.cs
deleted file mode 100644
index a08c8ba3..00000000
--- a/tests/UnitTests/Lumina.Plugins.Contracts.UnitTests/Core/Metadata/RemoteMetadataProviderTests.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Contracts.DTO.Common;
-using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
-using Lumina.Plugins.Contracts.Core.Metadata;
-using Lumina.Plugins.Contracts.UnitTests.Common.Fakes;
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Diagnostics.CodeAnalysis;
-#endregion
-
-namespace Lumina.Plugins.Contracts.UnitTests.Core.Metadata;
-
-///
-/// Contains unit tests for the contracts.
-///
-[ExcludeFromCodeCoverage]
-public class RemoteMetadataProviderTests
-{
- private readonly IRemoteMetadataProvider _sut = new FakeBookMetadataProvider();
-
- [Fact]
- public async Task GetMetadataAsync_WhenCalledThroughNonGenericInterface_ShouldReturnTypedMetadata()
- {
- // Arrange
- MetadataLookupDto lookup = new BookMetadataLookupDto(
- LibraryId: Guid.NewGuid(),
- Path: "/books/the-fellowship-of-the-ring.epub",
- Title: "The Fellowship of the Ring");
-
- // Act
- MetadataDto? result = await _sut.GetMetadataAsync(lookup, CancellationToken.None);
-
- // Assert
- Assert.NotNull(result);
- BookMetadataDto bookMetadata = Assert.IsType(result);
- Assert.Equal("The Fellowship of the Ring", bookMetadata.Title);
- Assert.Equal("3", bookMetadata.GoodreadsId);
- }
-
- [Fact]
- public async Task GetMetadataAsync_WhenNoMetadataFound_ShouldReturnNull()
- {
- // Arrange
- MetadataLookupDto lookup = new BookMetadataLookupDto(
- LibraryId: Guid.NewGuid(),
- Path: "/books/unknown.epub");
-
- // Act
- MetadataDto? result = await _sut.GetMetadataAsync(lookup, CancellationToken.None);
-
- // Assert
- Assert.Null(result);
- }
-
- [Fact]
- public async Task GetSearchResultsAsync_WhenCalledThroughNonGenericInterface_ShouldReturnTypedResults()
- {
- // Arrange
- MetadataLookupDto lookup = new BookMetadataLookupDto(
- LibraryId: Guid.NewGuid(),
- Path: "/books/the-fellowship-of-the-ring.epub",
- Title: "The Fellowship of the Ring");
-
- // Act
- IReadOnlyList result = await _sut.GetSearchResultsAsync(lookup, CancellationToken.None);
-
- // Assert
- Assert.Single(result);
- BookMetadataDto bookMetadata = Assert.IsType(result[0]);
- Assert.Equal("The Fellowship of the Ring", bookMetadata.Title);
- }
-}
diff --git a/tests/UnitTests/Lumina.Plugins.Contracts.UnitTests/Core/Plugins/PluginTests.cs b/tests/UnitTests/Lumina.Plugins.Contracts.UnitTests/Core/Plugins/PluginTests.cs
deleted file mode 100644
index 048b6ab4..00000000
--- a/tests/UnitTests/Lumina.Plugins.Contracts.UnitTests/Core/Plugins/PluginTests.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Lumina.Plugins.Contracts.Core.Plugins;
-using Lumina.Plugins.Contracts.Core.Plugins.Settings;
-using Lumina.Plugins.Contracts.UnitTests.Common.Fakes;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-#endregion
-
-namespace Lumina.Plugins.Contracts.UnitTests.Core.Plugins;
-
-///
-/// Contains unit tests for the contract.
-///
-[ExcludeFromCodeCoverage]
-public class PluginTests
-{
- private readonly IPlugin _sut = new FakeBookMetadataProvider();
-
- [Fact]
- public void GetSettingsSchema_WhenCalled_ShouldReturnDeclaredSettings()
- {
- // Arrange
-
- // Act
- IReadOnlyList schema = _sut.GetSettingsSchema();
-
- // Assert
- Assert.Equal(2, schema.Count);
- Assert.Equal("preferredLanguage", schema[0].Key);
- Assert.Equal(PluginSettingType.Text, schema[0].Type);
- Assert.Equal("en", schema[0].DefaultValue);
- Assert.Equal("selectionStrategy", schema[1].Key);
- Assert.Equal(PluginSettingType.Select, schema[1].Type);
- Assert.Contains("first", schema[1].AllowedValues!);
- }
-}
diff --git a/tests/UnitTests/Lumina.Plugins.Contracts.UnitTests/Lumina.Plugins.Contracts.UnitTests.csproj b/tests/UnitTests/Lumina.Plugins.Contracts.UnitTests/Lumina.Plugins.Contracts.UnitTests.csproj
deleted file mode 100644
index 711d201a..00000000
--- a/tests/UnitTests/Lumina.Plugins.Contracts.UnitTests/Lumina.Plugins.Contracts.UnitTests.csproj
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
- net10.0
- disable
- enable
-
- false
- true
-
-
-
-
- <_Parameter1>DisableTestParallelization = true
- <_Parameter1_IsLiteral>true
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
-
-
-
-
-