From cbe27ab22eeec61467eacbdfbbc3992f141e8474 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 18 Aug 2026 09:03:53 -0700 Subject: [PATCH] Fixes integration test fixtures disposing the shared web factory per test. --- .../Setup/AuthenticatedLuminaApiFactory.cs | 30 +++++++++++++++++++ .../GetPermissionsEndpointTests.cs | 2 +- .../Roles/AddRoleEndpointTests.cs | 2 +- .../Roles/DeleteRoleEndpointTests.cs | 2 +- .../Roles/GetRolePermissionsEndpointTests.cs | 2 +- .../Roles/GetRolesEndpointTests.cs | 2 +- .../Roles/UpdateRoleEndpointTests.cs | 2 +- .../GetDirectoriesEndpointTests.cs | 5 ++-- .../Drives/GetDrivesEndpointTests.cs | 5 ++-- .../FileSystem/GetTypeEndpointTests.cs | 5 ++-- .../Files/GetFilesEndpointTests.cs | 5 ++-- .../Files/GetTreeFilesEndpointTests.cs | 5 ++-- .../Path/CheckPathExistsEndpointTests.cs | 5 ++-- .../Path/CombinePathEndpointTests.cs | 5 ++-- .../Path/GetPathParentEndpointTests.cs | 5 ++-- .../Path/GetPathRootEndpointTests.cs | 5 ++-- .../Path/GetPathSeparatorEndpointTests.cs | 5 ++-- .../Path/SplitPathEndpointTests.cs | 5 ++-- .../Path/ValidatePathEndpointTests.cs | 5 ++-- .../Thumbnails/GetThumbnailEndpointTests.cs | 5 ++-- .../AddLibrary/AddLibraryEndpointTests.cs | 2 +- .../CancelLibrariesScanEndpointTests.cs | 5 ++-- .../CancelLibraryScanEndpointTests.cs | 5 ++-- .../DeleteLibraryEndpointTests.cs | 5 ++-- .../GetEnabledLibrariesEndpointTests.cs | 5 ++-- .../GetLibraries/GetLibrariesEndpointTests.cs | 5 ++-- .../GetLibrary/GetLibraryEndpointTests.cs | 5 ++-- .../GetLibraryScanProgressEndpointTests.cs | 5 ++-- .../GetRunningLibraryScansEndpointTests.cs | 5 ++-- .../ScanLibrariesEndpointTests.cs | 5 ++-- .../ScanLibrary/ScanLibraryEndpointTests.cs | 5 ++-- .../UpdateLibraryEndpointTests.cs | 5 ++-- .../Books/AddBook/AddBookEndpointTests.cs | 5 ++-- .../Books/GetBook/GetBookEndpointTests.cs | 5 ++-- .../Books/GetBooks/GetBooksEndpointTests.cs | 5 ++-- .../GetBooksLite/GetBooksLiteEndpointTests.cs | 5 ++-- .../CheckInitializationEndpointTests.cs | 5 ++-- .../Maintenance/CheckHealthEndpointTests.cs | 5 ++-- ...etLibraryMetadataProvidersEndpointTests.cs | 5 ++-- .../GetPluginSettingsEndpointTests.cs | 5 ++-- .../GetPlugins/GetPluginsEndpointTests.cs | 2 +- ...erLibraryMetadataProvidersEndpointTests.cs | 5 ++-- ...aryMetadataProviderEnabledEndpointTests.cs | 5 ++-- .../UpdatePluginSettingsEndpointTests.cs | 5 ++-- .../Authentication/GetUsersEndpointTests.cs | 2 +- .../GetUserPermissionsEndpointTests.cs | 2 +- .../Authorization/GetUserRoleEndpointTests.cs | 2 +- ...dateUserRoleAndPermissionsEndpointTests.cs | 2 +- 48 files changed, 112 insertions(+), 117 deletions(-) diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/AuthenticatedLuminaApiFactory.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/AuthenticatedLuminaApiFactory.cs index 6e238b37..533da3dc 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/AuthenticatedLuminaApiFactory.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/AuthenticatedLuminaApiFactory.cs @@ -164,9 +164,39 @@ public class AuthenticatedLuminaApiFactory : LuminaApiFactory, IDisposable return user; } + /// + /// Removes the currently created test user from the database. + /// + /// + /// Test classes must call this in their per-test DisposeAsync instead of . The + /// factory is a shared , created once per test class and disposed by + /// xUnit only after all tests in the class have run. Calling from a per-test + /// DisposeAsync would dispose the web host and its service provider after the first test, making + /// every subsequent test in the class fail with an when it resolves + /// services. is therefore reserved for xUnit's own class-teardown and must never be + /// invoked from a test. + /// + /// A task representing the asynchronous operation. + public async Task RemoveTestUserAsync() + { + using IServiceScope scope = Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + + UserEntity? user = dbContext.Users.FirstOrDefault(u => u.Username == TestUsername); + if (user is not null) + { + dbContext.Users.Remove(user); + await dbContext.SaveChangesAsync(); + } + } + /// /// Disposes API factory resources. /// + /// + /// Called by xUnit when the test class completes. Do not call from tests; per-test cleanup must use + /// . See that method for the details. + /// public new void Dispose() { using IServiceScope scope = Services.CreateScope(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Permissions/GetPermissionsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Permissions/GetPermissionsEndpointTests.cs index a9ee9faa..d3291076 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Permissions/GetPermissionsEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Permissions/GetPermissionsEndpointTests.cs @@ -117,7 +117,7 @@ public class GetPermissionsEndpointTests : IClassFixture public async Task DisposeAsync() { - _apiFactory.Dispose(); + await _apiFactory.RemoveTestUserAsync(); using IServiceScope scope = _apiFactory.Services.CreateScope(); LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/AddRoleEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/AddRoleEndpointTests.cs index 6de9291c..2febffe9 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/AddRoleEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/AddRoleEndpointTests.cs @@ -182,6 +182,6 @@ public class AddRoleEndpointTests : IClassFixture await dbContext.SaveChangesAsync(); - _apiFactory.Dispose(); + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRoleEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRoleEndpointTests.cs index b7d6080e..36436bda 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRoleEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRoleEndpointTests.cs @@ -192,6 +192,6 @@ public class DeleteRoleEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Drives/GetDrivesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Drives/GetDrivesEndpointTests.cs index 7d274242..874ce09f 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Drives/GetDrivesEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Drives/GetDrivesEndpointTests.cs @@ -42,10 +42,9 @@ public class GetDrivesEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } /// diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/FileSystem/GetTypeEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/FileSystem/GetTypeEndpointTests.cs index 327ecd88..34a5af6f 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/FileSystem/GetTypeEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/FileSystem/GetTypeEndpointTests.cs @@ -99,9 +99,8 @@ public class GetTypeEndpointTests : IClassFixture /// /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetFilesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetFilesEndpointTests.cs index 721f46cf..cca5008b 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetFilesEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetFilesEndpointTests.cs @@ -256,9 +256,8 @@ public class GetFilesEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetTreeFilesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetTreeFilesEndpointTests.cs index 2a670a3d..90f0f92a 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetTreeFilesEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Files/GetTreeFilesEndpointTests.cs @@ -256,9 +256,8 @@ public class GetTreeFilesEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/CheckPathExistsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/CheckPathExistsEndpointTests.cs index 42bcd500..6d20bd57 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/CheckPathExistsEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/CheckPathExistsEndpointTests.cs @@ -147,9 +147,8 @@ public class CheckPathExistsEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/CombinePathEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/CombinePathEndpointTests.cs index e89f23da..74066873 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/CombinePathEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/CombinePathEndpointTests.cs @@ -134,9 +134,8 @@ public class CombinePathEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathParentEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathParentEndpointTests.cs index 48ad0e02..6e5d328b 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathParentEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathParentEndpointTests.cs @@ -205,9 +205,8 @@ public class GetPathParentEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathRootEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathRootEndpointTests.cs index 1bec8c4c..e434a376 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathRootEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathRootEndpointTests.cs @@ -162,9 +162,8 @@ public class GetPathRootEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathSeparatorEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathSeparatorEndpointTests.cs index f6a58a3a..beb1af4e 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathSeparatorEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/GetPathSeparatorEndpointTests.cs @@ -113,9 +113,8 @@ public class GetPathSeparatorEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/SplitPathEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/SplitPathEndpointTests.cs index ad9444bb..a54292a0 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/SplitPathEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/SplitPathEndpointTests.cs @@ -149,9 +149,8 @@ public class SplitPathEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/ValidatePathEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/ValidatePathEndpointTests.cs index 2e5e5ea2..7485236c 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/ValidatePathEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/ValidatePathEndpointTests.cs @@ -132,9 +132,8 @@ public class ValidatePathEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnailEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnailEndpointTests.cs index 5ab48a06..dbe4b7d7 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnailEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnailEndpointTests.cs @@ -170,9 +170,8 @@ public class GetThumbnailEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/AddLibrary/AddLibraryEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/AddLibrary/AddLibraryEndpointTests.cs index dc249e4f..d19dd9a4 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/AddLibrary/AddLibraryEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/AddLibrary/AddLibraryEndpointTests.cs @@ -143,6 +143,6 @@ public class AddLibraryEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs index 1ee204e5..d73add44 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs @@ -81,9 +81,8 @@ public class CancelLibraryScanEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs index d1ad34f6..d920832f 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs @@ -188,9 +188,8 @@ public class DeleteLibraryEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetEnabledLibraries/GetEnabledLibrariesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetEnabledLibraries/GetEnabledLibrariesEndpointTests.cs index 4f5158be..c0249927 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetEnabledLibraries/GetEnabledLibrariesEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetEnabledLibraries/GetEnabledLibrariesEndpointTests.cs @@ -131,9 +131,8 @@ public class GetEnabledLibrariesEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpointTests.cs index cbc7822e..f5fdf41f 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpointTests.cs @@ -155,9 +155,8 @@ public class GetLibrariesEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetLibrary/GetLibraryEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetLibrary/GetLibraryEndpointTests.cs index d71a777b..6acc6187 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetLibrary/GetLibraryEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetLibrary/GetLibraryEndpointTests.cs @@ -138,9 +138,8 @@ public class GetLibraryEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetLibraryScanProgress/GetLibraryScanProgressEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetLibraryScanProgress/GetLibraryScanProgressEndpointTests.cs index f273b722..e30564f1 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetLibraryScanProgress/GetLibraryScanProgressEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetLibraryScanProgress/GetLibraryScanProgressEndpointTests.cs @@ -143,9 +143,8 @@ public class GetLibraryScanProgressEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetRunningLibraryScans/GetRunningLibraryScansEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetRunningLibraryScans/GetRunningLibraryScansEndpointTests.cs index aa111339..39b86386 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetRunningLibraryScans/GetRunningLibraryScansEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/GetRunningLibraryScans/GetRunningLibraryScansEndpointTests.cs @@ -63,9 +63,8 @@ public class GetRunningLibraryScansEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs index ba2b0a7e..39016988 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs @@ -127,9 +127,8 @@ public class ScanLibrariesEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs index 7f2a23b9..965459d7 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs @@ -167,9 +167,8 @@ public class ScanLibraryEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/UpdateLibrary/UpdateLibraryEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/UpdateLibrary/UpdateLibraryEndpointTests.cs index a5e59b80..8f7ab5ed 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/UpdateLibrary/UpdateLibraryEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Management/UpdateLibrary/UpdateLibraryEndpointTests.cs @@ -171,9 +171,8 @@ public class UpdateLibraryEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointTests.cs index 41dd66d5..05e297c6 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointTests.cs @@ -1616,9 +1616,8 @@ public class AddBookEndpointTests : IClassFixture /// /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs index 20b5df54..36a07376 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs @@ -53,9 +53,8 @@ public class GetBookEndpointTests : IClassFixture /// /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointTests.cs index ab76cfd6..9db061e1 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointTests.cs @@ -352,9 +352,8 @@ public class GetBooksEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksLite/GetBooksLiteEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksLite/GetBooksLiteEndpointTests.cs index 9071aed8..cc092581 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksLite/GetBooksLiteEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksLite/GetBooksLiteEndpointTests.cs @@ -402,9 +402,8 @@ public class GetBooksLiteEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Maintenance/ApplicationSetup/CheckInitializationEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Maintenance/ApplicationSetup/CheckInitializationEndpointTests.cs index 3129a4ed..9a34d748 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Maintenance/ApplicationSetup/CheckInitializationEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Maintenance/ApplicationSetup/CheckInitializationEndpointTests.cs @@ -137,9 +137,8 @@ public class CheckInitializationEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Maintenance/CheckHealthEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Maintenance/CheckHealthEndpointTests.cs index 6c550861..bd85306a 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Maintenance/CheckHealthEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Maintenance/CheckHealthEndpointTests.cs @@ -49,9 +49,8 @@ public class CheckHealthEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetLibraryMetadataProviders/GetLibraryMetadataProvidersEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetLibraryMetadataProviders/GetLibraryMetadataProvidersEndpointTests.cs index 7eb0e9ba..4f54bb96 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetLibraryMetadataProviders/GetLibraryMetadataProvidersEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetLibraryMetadataProviders/GetLibraryMetadataProvidersEndpointTests.cs @@ -146,9 +146,8 @@ public class GetLibraryMetadataProvidersEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetPluginSettings/GetPluginSettingsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetPluginSettings/GetPluginSettingsEndpointTests.cs index 90941bba..6823f24b 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetPluginSettings/GetPluginSettingsEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetPluginSettings/GetPluginSettingsEndpointTests.cs @@ -138,9 +138,8 @@ public class GetPluginSettingsEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetPlugins/GetPluginsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetPlugins/GetPluginsEndpointTests.cs index 43e1d98a..7975eba1 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetPlugins/GetPluginsEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/GetPlugins/GetPluginsEndpointTests.cs @@ -140,6 +140,6 @@ public class GetPluginsEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/SetLibraryMetadataProviderEnabled/SetLibraryMetadataProviderEnabledEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/SetLibraryMetadataProviderEnabled/SetLibraryMetadataProviderEnabledEndpointTests.cs index 5a8b21ef..d55d16e4 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/SetLibraryMetadataProviderEnabled/SetLibraryMetadataProviderEnabledEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/SetLibraryMetadataProviderEnabled/SetLibraryMetadataProviderEnabledEndpointTests.cs @@ -154,9 +154,8 @@ public class SetLibraryMetadataProviderEnabledEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/UpdatePluginSettings/UpdatePluginSettingsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/UpdatePluginSettings/UpdatePluginSettingsEndpointTests.cs index 9affa564..38398544 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/UpdatePluginSettings/UpdatePluginSettingsEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/UpdatePluginSettings/UpdatePluginSettingsEndpointTests.cs @@ -151,9 +151,8 @@ public class UpdatePluginSettingsEndpointTests : IClassFixture /// Disposes API factory resources. /// - public Task DisposeAsync() + public async Task DisposeAsync() { - _apiFactory.Dispose(); - return Task.CompletedTask; + await _apiFactory.RemoveTestUserAsync(); } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/GetUsersEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/GetUsersEndpointTests.cs index fec4d157..5fc40108 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/GetUsersEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/GetUsersEndpointTests.cs @@ -134,6 +134,6 @@ public class GetUsersEndpointTests : IClassFixture