mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 11:11:10 +00:00
Adds metadata aggregation to the media library enrichment job
This commit is contained in:
1 parent
c82fadc7a2
commit
66871ccf62
168 files changed
+3503
-1062
No files matched your search
+24
-22
@@ -1,4 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
@@ -12,6 +13,7 @@ namespace Lumina.Contracts.UnitTests.Requests.MediaLibrary.Management;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddLibraryRequestTests
|
||||
{
|
||||
private readonly AddLibraryRequestFixture _addLibraryRequestFixture = new();
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
@@ -21,16 +23,16 @@ public class AddLibraryRequestTests
|
||||
public void RoundTrip_WhenSerializingAddLibraryRequest_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
AddLibraryRequest expected = new(
|
||||
"Books",
|
||||
"Book",
|
||||
[@"C:\Media\Books"],
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
true
|
||||
AddLibraryRequest expected = _addLibraryRequestFixture.Create(
|
||||
title: "Books",
|
||||
libraryType: "Book",
|
||||
contentLocations: [@"C:\Media\Books"],
|
||||
coverImage: null,
|
||||
isEnabled: true,
|
||||
isLocked: false,
|
||||
canDownloadMetadataFromWeb: true,
|
||||
shouldSaveMetadataInMediaDirectories: false,
|
||||
shouldSkipUnchangedDirectoriesDuringScan: true
|
||||
);
|
||||
|
||||
// Act
|
||||
@@ -45,20 +47,20 @@ public class AddLibraryRequestTests
|
||||
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
|
||||
{
|
||||
// Arrange
|
||||
AddLibraryRequest sut = new(
|
||||
"Books",
|
||||
"Book",
|
||||
[@"C:\Media\Books"],
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
true
|
||||
AddLibraryRequest sut = _addLibraryRequestFixture.Create(
|
||||
title: "Books",
|
||||
libraryType: "Book",
|
||||
contentLocations: [@"C:\Media\Books"],
|
||||
coverImage: null,
|
||||
isEnabled: true,
|
||||
isLocked: false,
|
||||
canDownloadMetadataFromWeb: true,
|
||||
shouldSaveMetadataInMediaDirectories: false,
|
||||
shouldSkipUnchangedDirectoriesDuringScan: true
|
||||
);
|
||||
|
||||
// Act
|
||||
(string? title, string? libraryType, string[]? contentLocations, string? coverImage, bool isEnabled, bool isLocked, bool downloadMetadataFromWeb, bool shouldSaveMetadataInMediaDirectories, bool shouldSkipUnchangedDirectoriesDuringScan) = sut;
|
||||
(string? title, string? libraryType, string[]? contentLocations, string? coverImage, bool isEnabled, bool isLocked, bool canDownloadMetadataFromWeb, bool shouldSaveMetadataInMediaDirectories, bool shouldSkipUnchangedDirectoriesDuringScan) = sut;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(sut.Title, title);
|
||||
@@ -67,7 +69,7 @@ public class AddLibraryRequestTests
|
||||
Assert.Equal(sut.CoverImage, coverImage);
|
||||
Assert.Equal(sut.IsEnabled, isEnabled);
|
||||
Assert.Equal(sut.IsLocked, isLocked);
|
||||
Assert.Equal(sut.DownloadMetadataFromWeb, downloadMetadataFromWeb);
|
||||
Assert.Equal(sut.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb);
|
||||
Assert.Equal(sut.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories);
|
||||
Assert.Equal(sut.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan);
|
||||
}
|
||||
|
||||
+28
-26
@@ -1,4 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -13,6 +14,7 @@ namespace Lumina.Contracts.UnitTests.Requests.MediaLibrary.Management;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateLibraryRequestTests
|
||||
{
|
||||
private readonly UpdateLibraryRequestFixture _updateLibraryRequestFixture = new();
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
@@ -24,18 +26,18 @@ public class UpdateLibraryRequestTests
|
||||
// Arrange
|
||||
Guid id = Guid.NewGuid();
|
||||
Guid userId = Guid.NewGuid();
|
||||
UpdateLibraryRequest expected = new(
|
||||
id,
|
||||
userId,
|
||||
"Books",
|
||||
"Book",
|
||||
[@"C:\Media\Books"],
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
true
|
||||
UpdateLibraryRequest expected = _updateLibraryRequestFixture.Create(
|
||||
id: id,
|
||||
userId: userId,
|
||||
title: "Books",
|
||||
libraryType: "Book",
|
||||
contentLocations: [@"C:\Media\Books"],
|
||||
coverImage: null,
|
||||
isEnabled: true,
|
||||
isLocked: false,
|
||||
canDownloadMetadataFromWeb: true,
|
||||
shouldSaveMetadataInMediaDirectories: false,
|
||||
shouldSkipUnchangedDirectoriesDuringScan: true
|
||||
);
|
||||
|
||||
// Act
|
||||
@@ -52,22 +54,22 @@ public class UpdateLibraryRequestTests
|
||||
// Arrange
|
||||
Guid id = Guid.NewGuid();
|
||||
Guid userId = Guid.NewGuid();
|
||||
UpdateLibraryRequest sut = new(
|
||||
id,
|
||||
userId,
|
||||
"Books",
|
||||
"Book",
|
||||
[@"C:\Media\Books"],
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
true
|
||||
UpdateLibraryRequest sut = _updateLibraryRequestFixture.Create(
|
||||
id: id,
|
||||
userId: userId,
|
||||
title: "Books",
|
||||
libraryType: "Book",
|
||||
contentLocations: [@"C:\Media\Books"],
|
||||
coverImage: null,
|
||||
isEnabled: true,
|
||||
isLocked: false,
|
||||
canDownloadMetadataFromWeb: true,
|
||||
shouldSaveMetadataInMediaDirectories: false,
|
||||
shouldSkipUnchangedDirectoriesDuringScan: true
|
||||
);
|
||||
|
||||
// Act
|
||||
(Guid sutId, Guid sutUserId, string? title, string? libraryType, string[]? contentLocations, string? coverImage, bool isEnabled, bool isLocked, bool downloadMetadataFromWeb, bool shouldSaveMetadataInMediaDirectories, bool shouldSkipUnchangedDirectoriesDuringScan) = sut;
|
||||
(Guid sutId, Guid sutUserId, string? title, string? libraryType, string[]? contentLocations, string? coverImage, bool isEnabled, bool isLocked, bool canDownloadMetadataFromWeb, bool shouldSaveMetadataInMediaDirectories, bool shouldSkipUnchangedDirectoriesDuringScan) = sut;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(sut.Id, sutId);
|
||||
@@ -78,7 +80,7 @@ public class UpdateLibraryRequestTests
|
||||
Assert.Equal(sut.CoverImage, coverImage);
|
||||
Assert.Equal(sut.IsEnabled, isEnabled);
|
||||
Assert.Equal(sut.IsLocked, isLocked);
|
||||
Assert.Equal(sut.DownloadMetadataFromWeb, downloadMetadataFromWeb);
|
||||
Assert.Equal(sut.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb);
|
||||
Assert.Equal(sut.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories);
|
||||
Assert.Equal(sut.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan);
|
||||
}
|
||||
|
||||
+19
-4
@@ -1,4 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.UsersManagement.Settings;
|
||||
using Lumina.Contracts.Requests.UsersManagement.Settings;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
@@ -12,6 +13,7 @@ namespace Lumina.Contracts.UnitTests.Requests.UsersManagement.Settings;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateUserSettingsRequestTests
|
||||
{
|
||||
private readonly UpdateUserSettingsRequestFixture _updateUserSettingsRequestFixture = new();
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
@@ -21,7 +23,13 @@ public class UpdateUserSettingsRequestTests
|
||||
public void RoundTrip_WhenSerializingUpdateUserSettingsRequest_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
UpdateUserSettingsRequest expected = new(true, 50, true, true);
|
||||
UpdateUserSettingsRequest expected = _updateUserSettingsRequestFixture.Create(
|
||||
isPaginationEnabled: true,
|
||||
itemsPerPage: 50,
|
||||
shouldIgnoreThePrefixForAlphaPicker: true,
|
||||
isThemeCachingEnabled: true,
|
||||
shouldAggregateMetadataWhenMissing: false
|
||||
);
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
@@ -36,15 +44,22 @@ public class UpdateUserSettingsRequestTests
|
||||
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
|
||||
{
|
||||
// Arrange
|
||||
UpdateUserSettingsRequest sut = new(false, 25, false, false);
|
||||
UpdateUserSettingsRequest sut = _updateUserSettingsRequestFixture.Create(
|
||||
isPaginationEnabled: false,
|
||||
itemsPerPage: 25,
|
||||
shouldIgnoreThePrefixForAlphaPicker: false,
|
||||
isThemeCachingEnabled: false,
|
||||
shouldAggregateMetadataWhenMissing: false
|
||||
);
|
||||
|
||||
// Act
|
||||
(bool isPaginationEnabled, int itemsPerPage, bool ignoreThePrefixForAlphaPicker, bool isThemeCachingEnabled) = sut;
|
||||
(bool isPaginationEnabled, int itemsPerPage, bool shouldIgnoreThePrefixForAlphaPicker, bool isThemeCachingEnabled, bool shouldAggregateMetadataWhenMissing) = sut;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(sut.IsPaginationEnabled, isPaginationEnabled);
|
||||
Assert.Equal(sut.ItemsPerPage, itemsPerPage);
|
||||
Assert.Equal(sut.IgnoreThePrefixForAlphaPicker, ignoreThePrefixForAlphaPicker);
|
||||
Assert.Equal(sut.ShouldIgnoreThePrefixForAlphaPicker, shouldIgnoreThePrefixForAlphaPicker);
|
||||
Assert.Equal(sut.IsThemeCachingEnabled, isThemeCachingEnabled);
|
||||
Assert.Equal(sut.ShouldAggregateMetadataWhenMissing, shouldAggregateMetadataWhenMissing);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -58,7 +58,7 @@ public class LibraryResponseTests
|
||||
LibraryResponse sut = _libraryResponseFixture.Create();
|
||||
|
||||
// Act
|
||||
(Guid id, Guid userId, string title, LibraryType libraryType, List<string> contentLocations, string? coverImage, bool isEnabled, bool isLocked, bool downloadMetadataFromWeb, bool shouldSaveMetadataInMediaDirectories, bool shouldSkipUnchangedDirectoriesDuringScan, DateTime createdOnUtc, DateTime? updatedOnUtc) = sut;
|
||||
(Guid id, Guid userId, string title, LibraryType libraryType, List<string> contentLocations, string? coverImage, bool isEnabled, bool isLocked, bool canDownloadMetadataFromWeb, bool shouldSaveMetadataInMediaDirectories, bool shouldSkipUnchangedDirectoriesDuringScan, DateTime createdOnUtc, DateTime? updatedOnUtc) = sut;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(sut.Id, id);
|
||||
@@ -69,7 +69,7 @@ public class LibraryResponseTests
|
||||
Assert.Equal(sut.CoverImage, coverImage);
|
||||
Assert.Equal(sut.IsEnabled, isEnabled);
|
||||
Assert.Equal(sut.IsLocked, isLocked);
|
||||
Assert.Equal(sut.DownloadMetadataFromWeb, downloadMetadataFromWeb);
|
||||
Assert.Equal(sut.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb);
|
||||
Assert.Equal(sut.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories);
|
||||
Assert.Equal(sut.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan);
|
||||
Assert.Equal(sut.CreatedOnUtc, createdOnUtc);
|
||||
|
||||
+21
-4
@@ -1,4 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Responses.UsersManagement.Settings;
|
||||
using Lumina.Contracts.Responses.UsersManagement.Settings;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -13,6 +14,7 @@ namespace Lumina.Contracts.UnitTests.Responses.UsersManagement.Settings;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UserSettingsResponseTests
|
||||
{
|
||||
private readonly UserSettingsResponseFixture _userSettingsResponseFixture = new();
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
@@ -23,7 +25,14 @@ public class UserSettingsResponseTests
|
||||
{
|
||||
// Arrange
|
||||
Guid userId = Guid.NewGuid();
|
||||
UserSettingsResponse expected = new(userId, true, 50, true, true);
|
||||
UserSettingsResponse expected = _userSettingsResponseFixture.Create(
|
||||
userId: userId,
|
||||
isPaginationEnabled: true,
|
||||
itemsPerPage: 50,
|
||||
shouldIgnoreThePrefixForAlphaPicker: true,
|
||||
isThemeCachingEnabled: true,
|
||||
shouldAggregateMetadataWhenMissing: false
|
||||
);
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
@@ -39,16 +48,24 @@ public class UserSettingsResponseTests
|
||||
{
|
||||
// Arrange
|
||||
Guid userId = Guid.NewGuid();
|
||||
UserSettingsResponse sut = new(userId, false, 25, false, false);
|
||||
UserSettingsResponse sut = _userSettingsResponseFixture.Create(
|
||||
userId: userId,
|
||||
isPaginationEnabled: false,
|
||||
itemsPerPage: 25,
|
||||
shouldIgnoreThePrefixForAlphaPicker: false,
|
||||
isThemeCachingEnabled: false,
|
||||
shouldAggregateMetadataWhenMissing: false
|
||||
);
|
||||
|
||||
// Act
|
||||
(Guid sutUserId, bool isPaginationEnabled, int itemsPerPage, bool ignoreThePrefixForAlphaPicker, bool isThemeCachingEnabled) = sut;
|
||||
(Guid sutUserId, bool isPaginationEnabled, int itemsPerPage, bool shouldIgnoreThePrefixForAlphaPicker, bool isThemeCachingEnabled, bool shouldAggregateMetadataWhenMissing) = sut;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(sut.UserId, sutUserId);
|
||||
Assert.Equal(sut.IsPaginationEnabled, isPaginationEnabled);
|
||||
Assert.Equal(sut.ItemsPerPage, itemsPerPage);
|
||||
Assert.Equal(sut.IgnoreThePrefixForAlphaPicker, ignoreThePrefixForAlphaPicker);
|
||||
Assert.Equal(sut.ShouldIgnoreThePrefixForAlphaPicker, shouldIgnoreThePrefixForAlphaPicker);
|
||||
Assert.Equal(sut.IsThemeCachingEnabled, isThemeCachingEnabled);
|
||||
Assert.Equal(sut.ShouldAggregateMetadataWhenMissing, shouldAggregateMetadataWhenMissing);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user