mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 18:11:10 +00:00
Standardizes test projects against conventions
This commit is contained in:
1 parent
59e16d645a
commit
ced1f778c4
78 files changed
+283
-201
No files matched your search
+3
-3
@@ -54,7 +54,7 @@ public class GetPermissionsEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldReturnPermissions()
|
||||
public async Task GetPermissions_WhenCalledWithValidRequest_ShouldReturnPermissions()
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/auth/permissions");
|
||||
@@ -76,7 +76,7 @@ public class GetPermissionsEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
public async Task GetPermissions_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Act
|
||||
_client = await _apiFactory.CreateAuthenticatedClientAsync(); // authenticated user, but not admin
|
||||
@@ -99,7 +99,7 @@ public class GetPermissionsEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task GetPermissions_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
+4
-4
@@ -58,7 +58,7 @@ public class AddRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldCreateRole()
|
||||
public async Task AddRole_WhenCalledWithValidRequest_ShouldCreateRole()
|
||||
{
|
||||
// Arrange
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
@@ -91,7 +91,7 @@ public class AddRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
public async Task AddRole_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
_client = await _apiFactory.CreateAuthenticatedClientAsync();
|
||||
@@ -119,7 +119,7 @@ public class AddRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenRoleAlreadyExists_ShouldReturnConflict()
|
||||
public async Task AddRole_WhenRoleAlreadyExists_ShouldReturnConflict()
|
||||
{
|
||||
// Arrange
|
||||
AddRoleRequest request = new(
|
||||
@@ -146,7 +146,7 @@ public class AddRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task AddRole_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
+5
-5
@@ -53,7 +53,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldDeleteRole()
|
||||
public async Task DeleteRole_WhenCalledWithValidRequest_ShouldDeleteRole()
|
||||
{
|
||||
// Arrange
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
@@ -82,7 +82,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
public async Task DeleteRole_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
_client = await _apiFactory.CreateAuthenticatedClientAsync();
|
||||
@@ -107,7 +107,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenTryingToDeleteAdminRole_ShouldReturnForbiddenResult()
|
||||
public async Task DeleteRole_WhenTryingToDeleteAdminRole_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
@@ -134,7 +134,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenRoleDoesNotExist_ShouldReturnNotFound()
|
||||
public async Task DeleteRole_WhenRoleDoesNotExist_ShouldReturnNotFound()
|
||||
{
|
||||
// Arrange
|
||||
Guid nonExistentRoleId = Guid.NewGuid();
|
||||
@@ -158,7 +158,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task DeleteRole_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
+4
-4
@@ -56,7 +56,7 @@ public class GetRolePermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldReturnRolePermissions()
|
||||
public async Task GetRolePermissions_WhenCalledWithValidRequest_ShouldReturnRolePermissions()
|
||||
{
|
||||
// Arrange
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
@@ -86,7 +86,7 @@ public class GetRolePermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
public async Task GetRolePermissions_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
_client = await _apiFactory.CreateAuthenticatedClientAsync(); // authenticated user, but not admin
|
||||
@@ -114,7 +114,7 @@ public class GetRolePermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidRoleId_ShouldReturnNotFound()
|
||||
public async Task GetRolePermissions_WhenCalledWithInvalidRoleId_ShouldReturnNotFound()
|
||||
{
|
||||
// Act
|
||||
Guid invalidRoleId = Guid.NewGuid();
|
||||
@@ -136,7 +136,7 @@ public class GetRolePermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task GetRolePermissions_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
+3
-3
@@ -53,7 +53,7 @@ public class GetRolesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldReturnRoles()
|
||||
public async Task GetRoles_WhenCalledWithValidRequest_ShouldReturnRoles()
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/auth/roles");
|
||||
@@ -74,7 +74,7 @@ public class GetRolesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
public async Task GetRoles_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
_client = await _apiFactory.CreateAuthenticatedClientAsync();
|
||||
@@ -98,7 +98,7 @@ public class GetRolesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task GetRoles_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
+4
-4
@@ -58,7 +58,7 @@ public class UpdateRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldUpdateRole()
|
||||
public async Task UpdateRole_WhenCalledWithValidRequest_ShouldUpdateRole()
|
||||
{
|
||||
// Arrange
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
@@ -103,7 +103,7 @@ public class UpdateRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
public async Task UpdateRole_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
_client = await _apiFactory.CreateAuthenticatedClientAsync();
|
||||
@@ -132,7 +132,7 @@ public class UpdateRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenRoleDoesNotExist_ShouldReturnNotFound()
|
||||
public async Task UpdateRole_WhenRoleDoesNotExist_ShouldReturnNotFound()
|
||||
{
|
||||
// Arrange
|
||||
Guid nonExistentRoleId = Guid.NewGuid();
|
||||
@@ -161,7 +161,7 @@ public class UpdateRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task UpdateRole_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
+4
-4
@@ -123,7 +123,7 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidPath_ShouldReturnForbiddenResult()
|
||||
public async Task GetDirectories_WhenCalledWithInvalidPath_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
string invalidPath = "invalid:path";
|
||||
@@ -149,7 +149,7 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
public async Task GetDirectories_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
string emptyPath = "";
|
||||
@@ -180,7 +180,7 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
public async Task GetDirectories_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
@@ -196,7 +196,7 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
public async Task GetDirectories_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public class GetDrivesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactor
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalled_ShouldReturnDrives()
|
||||
public async Task GetDrives_WhenCalled_ShouldReturnDrives()
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/drives/get-drives");
|
||||
|
||||
+3
-3
@@ -48,7 +48,7 @@ public class GetTypeEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalled_ShouldReturnOkResultWithFileSystemTypeResponse()
|
||||
public async Task GetType_WhenCalled_ShouldReturnOkResultWithFileSystemTypeResponse()
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/file-system/get-type");
|
||||
@@ -62,7 +62,7 @@ public class GetTypeEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledMultipleTimes_ShouldReturnConsistentResults()
|
||||
public async Task GetType_WhenCalledMultipleTimes_ShouldReturnConsistentResults()
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response1 = await _client.GetAsync("/api/v1/file-system/get-type");
|
||||
@@ -84,7 +84,7 @@ public class GetTypeEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
public async Task GetType_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new(TimeSpan.FromSeconds(5));
|
||||
|
||||
+7
-7
@@ -53,7 +53,7 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[SkipWhenHiddenAttributeNotSupportedFact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidPathAndNotIncludeHiddenElements_ShouldReturnFilesWithoutHiddenElements()
|
||||
public async Task GetFiles_WhenCalledWithValidPathAndNotIncludeHiddenElements_ShouldReturnFilesWithoutHiddenElements()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemStructureFixture fileSystemFixture = new();
|
||||
@@ -90,7 +90,7 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[SkipWhenHiddenAttributeNotSupportedFact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidPathAndHiddenChildrenAndNotIncludeHiddenElements_ShouldReturnNoFiles()
|
||||
public async Task GetFiles_WhenCalledWithValidPathAndHiddenChildrenAndNotIncludeHiddenElements_ShouldReturnNoFiles()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemStructureFixture fileSystemFixture = new();
|
||||
@@ -122,7 +122,7 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidPathAndWithIncludeHiddenElements_ShouldReturnFilesWithHiddenElements()
|
||||
public async Task GetFiles_WhenCalledWithValidPathAndWithIncludeHiddenElements_ShouldReturnFilesWithHiddenElements()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemStructureFixture fileSystemFixture = new();
|
||||
@@ -163,7 +163,7 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidPath_ShouldReturnForbiddenResult()
|
||||
public async Task GetFiles_WhenCalledWithInvalidPath_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
string invalidPath = "invalid:path";
|
||||
@@ -189,7 +189,7 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
public async Task GetFiles_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
string emptyPath = "";
|
||||
@@ -220,7 +220,7 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
public async Task GetFiles_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
@@ -236,7 +236,7 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
public async Task GetFiles_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
|
||||
+7
-7
@@ -53,7 +53,7 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[SkipWhenHiddenAttributeNotSupportedFact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidPathAndNotIncludeHiddenElements_ShouldReturnTreeFilesWithoutHiddenElements()
|
||||
public async Task GetTreeFiles_WhenCalledWithValidPathAndNotIncludeHiddenElements_ShouldReturnTreeFilesWithoutHiddenElements()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemStructureFixture fileSystemFixture = new();
|
||||
@@ -90,7 +90,7 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[SkipWhenHiddenAttributeNotSupportedFact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidPathAndHiddenChildrenAndNotIncludeHiddenElements_ShouldReturnNoTreeFiles()
|
||||
public async Task GetTreeFiles_WhenCalledWithValidPathAndHiddenChildrenAndNotIncludeHiddenElements_ShouldReturnNoTreeFiles()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemStructureFixture fileSystemFixture = new();
|
||||
@@ -123,7 +123,7 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidPathAndWithIncludeHiddenElements_ShouldReturnTreeFilesWithHiddenElements()
|
||||
public async Task GetTreeFiles_WhenCalledWithValidPathAndWithIncludeHiddenElements_ShouldReturnTreeFilesWithHiddenElements()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemStructureFixture fileSystemFixture = new();
|
||||
@@ -163,7 +163,7 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
}
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidPath_ShouldReturnForbiddenResult()
|
||||
public async Task GetTreeFiles_WhenCalledWithInvalidPath_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
string invalidPath = "invalid:path";
|
||||
@@ -189,7 +189,7 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
public async Task GetTreeFiles_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
string emptyPath = "";
|
||||
@@ -220,7 +220,7 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
public async Task GetTreeFiles_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
@@ -236,7 +236,7 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
public async Task GetTreeFiles_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
|
||||
+5
-5
@@ -49,7 +49,7 @@ public class CheckPathExistsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithExistingPath_ShouldReturnOkResultWithExistsTrue()
|
||||
public async Task CheckPathExists_WhenCalledWithExistingPath_ShouldReturnOkResultWithExistsTrue()
|
||||
{
|
||||
// Arrange
|
||||
string tempPath = System.IO.Path.GetTempPath();
|
||||
@@ -66,7 +66,7 @@ public class CheckPathExistsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithNonExistingPath_ShouldReturnOkResultWithExistsFalse()
|
||||
public async Task CheckPathExists_WhenCalledWithNonExistingPath_ShouldReturnOkResultWithExistsFalse()
|
||||
{
|
||||
// Arrange
|
||||
string nonExistingPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||
@@ -83,7 +83,7 @@ public class CheckPathExistsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
public async Task CheckPathExists_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
string path = "";
|
||||
@@ -111,7 +111,7 @@ public class CheckPathExistsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidPath_ShouldReturnOkResultWithExistsFalse()
|
||||
public async Task CheckPathExists_WhenCalledWithInvalidPath_ShouldReturnOkResultWithExistsFalse()
|
||||
{
|
||||
// Arrange
|
||||
string invalidPath = "invalid:path";
|
||||
@@ -128,7 +128,7 @@ public class CheckPathExistsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
public async Task CheckPathExists_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.GetTempPath();
|
||||
|
||||
+4
-4
@@ -49,7 +49,7 @@ public class CombinePathEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidPaths_ShouldReturnOkResultWithCombinedPath()
|
||||
public async Task CombinePath_WhenCalledWithValidPaths_ShouldReturnOkResultWithCombinedPath()
|
||||
{
|
||||
// Arrange
|
||||
string originalPath = System.IO.Path.GetTempPath();
|
||||
@@ -70,7 +70,7 @@ public class CombinePathEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithEmptyPaths_ShouldReturnValidationProblemResult()
|
||||
public async Task CombinePath_WhenCalledWithEmptyPaths_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
string originalPath = "";
|
||||
@@ -100,7 +100,7 @@ public class CombinePathEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
public async Task CombinePath_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
string originalPath = "/home/user";
|
||||
@@ -115,7 +115,7 @@ public class CombinePathEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
public async Task CombinePath_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
string originalPath = System.IO.Path.GetTempPath();
|
||||
|
||||
+6
-6
@@ -52,7 +52,7 @@ public class GetPathParentEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidPath_ShouldReturnOkResultWithPathSegmentResponses()
|
||||
public async Task GetPathParent_WhenCalledWithValidPath_ShouldReturnOkResultWithPathSegmentResponses()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory", "testFile.txt");
|
||||
@@ -87,7 +87,7 @@ public class GetPathParentEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithRootPath_ShouldReturnForbiddenResult()
|
||||
public async Task GetPathParent_WhenCalledWithRootPath_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
string rootPath = System.IO.Path.GetPathRoot(System.IO.Path.GetTempPath())!;
|
||||
@@ -112,7 +112,7 @@ public class GetPathParentEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidPath_ShouldReturnValidationProblemResult()
|
||||
public async Task GetPathParent_WhenCalledWithInvalidPath_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
string invalidPath = "invalid:path";
|
||||
@@ -141,7 +141,7 @@ public class GetPathParentEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
public async Task GetPathParent_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
string emptyPath = "";
|
||||
@@ -171,7 +171,7 @@ public class GetPathParentEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
public async Task GetPathParent_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
@@ -186,7 +186,7 @@ public class GetPathParentEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
public async Task GetPathParent_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
|
||||
+5
-5
@@ -49,7 +49,7 @@ public class GetPathRootEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidPath_ShouldReturnOkResultWithPathSegmentResponse()
|
||||
public async Task GetPathRoot_WhenCalledWithValidPath_ShouldReturnOkResultWithPathSegmentResponse()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.GetTempPath();
|
||||
@@ -68,7 +68,7 @@ public class GetPathRootEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidPath_ShouldReturnValidationProblemResult()
|
||||
public async Task GetPathRoot_WhenCalledWithInvalidPath_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
string invalidPath = "invalid:path";
|
||||
@@ -98,7 +98,7 @@ public class GetPathRootEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
public async Task GetPathRoot_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
string emptyPath = "";
|
||||
@@ -128,7 +128,7 @@ public class GetPathRootEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
public async Task GetPathRoot_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.GetTempPath();
|
||||
@@ -143,7 +143,7 @@ public class GetPathRootEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
public async Task GetPathRoot_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.GetTempPath();
|
||||
|
||||
+4
-4
@@ -47,7 +47,7 @@ public class GetPathSeparatorEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalled_ShouldReturnOkResultWithPathSeparatorResponse()
|
||||
public async Task GetPathSeparator_WhenCalled_ShouldReturnOkResultWithPathSeparatorResponse()
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/path/get-path-separator");
|
||||
@@ -61,7 +61,7 @@ public class GetPathSeparatorEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledMultipleTimes_ShouldReturnConsistentResults()
|
||||
public async Task GetPathSeparator_WhenCalledMultipleTimes_ShouldReturnConsistentResults()
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response1 = await _client.GetAsync("/api/v1/path/get-path-separator");
|
||||
@@ -83,7 +83,7 @@ public class GetPathSeparatorEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
public async Task GetPathSeparator_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new(TimeSpan.FromSeconds(5));
|
||||
@@ -96,7 +96,7 @@ public class GetPathSeparatorEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
public async Task GetPathSeparator_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
+4
-4
@@ -50,7 +50,7 @@ public class SplitPathEndpointTests : IClassFixture<AuthenticatedLuminaApiFactor
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidPath_ShouldReturnOkResultWithSplitSegments()
|
||||
public async Task SplitPath_WhenCalledWithValidPath_ShouldReturnOkResultWithSplitSegments()
|
||||
{
|
||||
// Arrange
|
||||
string tempPath = System.IO.Path.GetTempPath();
|
||||
@@ -72,7 +72,7 @@ public class SplitPathEndpointTests : IClassFixture<AuthenticatedLuminaApiFactor
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
public async Task SplitPath_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
string path = "";
|
||||
@@ -101,7 +101,7 @@ public class SplitPathEndpointTests : IClassFixture<AuthenticatedLuminaApiFactor
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidPath_ShouldReturnProblemDetails()
|
||||
public async Task SplitPath_WhenCalledWithInvalidPath_ShouldReturnProblemDetails()
|
||||
{
|
||||
// Arrange
|
||||
string path = "invalid:path";
|
||||
@@ -130,7 +130,7 @@ public class SplitPathEndpointTests : IClassFixture<AuthenticatedLuminaApiFactor
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
public async Task SplitPath_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
|
||||
+4
-4
@@ -49,7 +49,7 @@ public class ValidatePathEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidPath_ShouldReturnOkResultWithIsValidTrue()
|
||||
public async Task ValidatePath_WhenCalledWithValidPath_ShouldReturnOkResultWithIsValidTrue()
|
||||
{
|
||||
// Arrange
|
||||
string tempPath = System.IO.Path.GetTempPath();
|
||||
@@ -67,7 +67,7 @@ public class ValidatePathEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidPath_ShouldReturnOkResultWithIsValidFalse()
|
||||
public async Task ValidatePath_WhenCalledWithInvalidPath_ShouldReturnOkResultWithIsValidFalse()
|
||||
{
|
||||
// Arrange
|
||||
string invalidPath = "invalid:path";
|
||||
@@ -84,7 +84,7 @@ public class ValidatePathEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
public async Task ValidatePath_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
string path = "";
|
||||
@@ -113,7 +113,7 @@ public class ValidatePathEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
public async Task ValidatePath_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
string testPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "testDirectory");
|
||||
|
||||
+5
-5
@@ -52,7 +52,7 @@ public class GetThumbnailEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidPathAndQuality_ShouldReturnOkResultWithThumbnail()
|
||||
public async Task GetThumbnail_WhenCalledWithValidPathAndQuality_ShouldReturnOkResultWithThumbnail()
|
||||
{
|
||||
// Arrange
|
||||
int quality = 80;
|
||||
@@ -68,7 +68,7 @@ public class GetThumbnailEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidPath_ShouldReturnForbiddenResult()
|
||||
public async Task GetThumbnail_WhenCalledWithInvalidPath_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
string invalidImagePath = "/path/to/nonexistent/image.jpg";
|
||||
@@ -93,7 +93,7 @@ public class GetThumbnailEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
public async Task GetThumbnail_WhenCalledWithEmptyPath_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
string invalidImagePath = "";
|
||||
@@ -123,7 +123,7 @@ public class GetThumbnailEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidQuality_ShouldReturnValidationProblemResult()
|
||||
public async Task GetThumbnail_WhenCalledWithInvalidQuality_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
int invalidQuality = -1;
|
||||
@@ -152,7 +152,7 @@ public class GetThumbnailEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
public async Task GetThumbnail_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
int quality = 80;
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.WrittenContentLibrary.BookLibrary.Books;
|
||||
namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.AddBook;
|
||||
|
||||
/// <summary>
|
||||
/// Contains integration tests for the <see cref="AddBookEndpoint"/> class.
|
||||
+3
-3
@@ -13,7 +13,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.WrittenContentLibrary.BookLibrary.Books;
|
||||
namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.GetBooks;
|
||||
|
||||
/// <summary>
|
||||
/// Contains integration tests for the <see cref="GetBooksEndpoint"/> class.
|
||||
@@ -65,7 +65,7 @@ public class GetBooksEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
public async Task GetBooks_WhenCalledWithCancellationToken_ShouldCompleteSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new(TimeSpan.FromSeconds(5));
|
||||
@@ -78,7 +78,7 @@ public class GetBooksEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
public async Task GetBooks_WhenCancellationTokenIsCanceled_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
+12
-3
@@ -53,8 +53,16 @@ public class CheckInitializationEndpointTests : IClassFixture<AuthenticatedLumin
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenNoUsersExist_ShouldReturnNotInitialized()
|
||||
public async Task CheckInitialization_WhenNoUsersExist_ShouldReturnNotInitialized()
|
||||
{
|
||||
// Arrange
|
||||
using (IServiceScope scope = _apiFactory.Services.CreateScope())
|
||||
{
|
||||
LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
|
||||
dbContext.Users.RemoveRange(dbContext.Users);
|
||||
await dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/initialization");
|
||||
|
||||
@@ -70,7 +78,7 @@ public class CheckInitializationEndpointTests : IClassFixture<AuthenticatedLumin
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenUsersExist_ShouldReturnInitialized()
|
||||
public async Task CheckInitialization_WhenUsersExist_ShouldReturnInitialized()
|
||||
{
|
||||
// Arrange
|
||||
await CreateTestUser();
|
||||
@@ -90,7 +98,7 @@ public class CheckInitializationEndpointTests : IClassFixture<AuthenticatedLumin
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task CheckInitialization_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
@@ -111,6 +119,7 @@ public class CheckInitializationEndpointTests : IClassFixture<AuthenticatedLumin
|
||||
|
||||
UserEntity user = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Username = _testUsername,
|
||||
Password = new PasswordHashService().HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
|
||||
+5
-4
@@ -60,7 +60,7 @@ public class SetupApplicationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequestAnd2FA_ShouldSetupApplicationSuccessfully()
|
||||
public async Task SetupApplication_WhenCalledWithValidRequestAnd2FA_ShouldSetupApplicationSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
RegistrationRequest request = new(
|
||||
@@ -94,7 +94,7 @@ public class SetupApplicationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequestWithout2FA_ShouldSetupApplicationSuccessfully()
|
||||
public async Task SetupApplication_WhenCalledWithValidRequestWithout2FA_ShouldSetupApplicationSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
RegistrationRequest request = new(
|
||||
@@ -126,7 +126,7 @@ public class SetupApplicationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenAdminAccountAlreadyExists_ShouldReturnConflict()
|
||||
public async Task SetupApplication_WhenAdminAccountAlreadyExists_ShouldReturnConflict()
|
||||
{
|
||||
// Arrange
|
||||
await CreateTestUser();
|
||||
@@ -156,7 +156,7 @@ public class SetupApplicationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenRequestIsNull_ShouldReturnValidationError()
|
||||
public async Task SetupApplication_WhenRequestIsNull_ShouldReturnValidationError()
|
||||
{
|
||||
// Arrange
|
||||
RegistrationRequest? request = null;
|
||||
@@ -214,6 +214,7 @@ public class SetupApplicationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
|
||||
UserEntity user = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Username = _testUsername,
|
||||
Password = new PasswordHashService().HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
|
||||
+6
-6
@@ -54,7 +54,7 @@ public class ChangePasswordEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldChangePasswordSuccessfully()
|
||||
public async Task ChangePassword_WhenCalledWithValidRequest_ShouldChangePasswordSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
ChangePasswordRequest request = new(
|
||||
@@ -79,7 +79,7 @@ public class ChangePasswordEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenPasswordsDoNotMatch_ShouldReturnValidationError()
|
||||
public async Task ChangePassword_WhenPasswordsDoNotMatch_ShouldReturnValidationError()
|
||||
{
|
||||
// Arrange
|
||||
ChangePasswordRequest request = new(
|
||||
@@ -113,7 +113,7 @@ public class ChangePasswordEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenUserDoesNotExist_ShouldReturnNotFound()
|
||||
public async Task ChangePassword_WhenUserDoesNotExist_ShouldReturnNotFound()
|
||||
{
|
||||
// Arrange
|
||||
ChangePasswordRequest request = new(
|
||||
@@ -142,7 +142,7 @@ public class ChangePasswordEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCurrentPasswordIsIncorrect_ShouldReturnForbiddenResult()
|
||||
public async Task ChangePassword_WhenCurrentPasswordIsIncorrect_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
ChangePasswordRequest request = new(
|
||||
@@ -171,7 +171,7 @@ public class ChangePasswordEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenRequestIsNull_ShouldReturnValidationError()
|
||||
public async Task ChangePassword_WhenRequestIsNull_ShouldReturnValidationError()
|
||||
{
|
||||
// Arrange
|
||||
ChangePasswordRequest? request = null;
|
||||
@@ -203,7 +203,7 @@ public class ChangePasswordEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task ChangePassword_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
ChangePasswordRequest request = new(
|
||||
|
||||
+3
-3
@@ -53,7 +53,7 @@ public class GetUsersEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldReturnUsers()
|
||||
public async Task GetUsers_WhenCalledWithValidRequest_ShouldReturnUsers()
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/auth/users");
|
||||
@@ -77,7 +77,7 @@ public class GetUsersEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
public async Task GetUsers_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
_client = await _apiFactory.CreateAuthenticatedClientAsync();
|
||||
@@ -101,7 +101,7 @@ public class GetUsersEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task GetUsers_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
+10
-6
@@ -66,7 +66,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidCredentials_ShouldLoginSuccessfully()
|
||||
public async Task Login_WhenCalledWithValidCredentials_ShouldLoginSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity user = await CreateTestUser();
|
||||
@@ -93,7 +93,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidCredentialsAndTotp_ShouldLoginSuccessfully()
|
||||
public async Task Login_WhenCalledWithValidCredentialsAndTotp_ShouldLoginSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity user = await CreateTestUserWithTotp();
|
||||
@@ -125,7 +125,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithTempPassword_ShouldLoginSuccessfully()
|
||||
public async Task Login_WhenCalledWithTempPassword_ShouldLoginSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity user = await CreateTestUserWithTempPassword();
|
||||
@@ -151,7 +151,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithExpiredTempPassword_ShouldReturnUnauthorized()
|
||||
public async Task Login_WhenCalledWithExpiredTempPassword_ShouldReturnUnauthorized()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity user = await CreateTestUserWithExpiredTempPassword();
|
||||
@@ -179,7 +179,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidCredentials_ShouldReturnUnauthorized()
|
||||
public async Task Login_WhenCalledWithInvalidCredentials_ShouldReturnUnauthorized()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity user = await CreateTestUser();
|
||||
@@ -207,7 +207,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithInvalidTotpCode_ShouldReturnUnauthorized()
|
||||
public async Task Login_WhenCalledWithInvalidTotpCode_ShouldReturnUnauthorized()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity user = await CreateTestUserWithTotp();
|
||||
@@ -247,6 +247,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
|
||||
UserEntity user = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Username = _testUsername,
|
||||
Password = _hashService.HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
@@ -269,6 +270,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
byte[] totpSecret = _totpTokenGenerator.GenerateSecret();
|
||||
UserEntity user = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Username = _testUsername,
|
||||
Password = _hashService.HashString("TestPass123!"),
|
||||
TotpSecret = _cryptographyService.Encrypt(Convert.ToBase64String(totpSecret)),
|
||||
@@ -291,6 +293,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
|
||||
UserEntity user = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Username = _testUsername,
|
||||
Password = _hashService.HashString("TestPass123!"),
|
||||
TempPassword = Uri.EscapeDataString(_hashService.HashString("TempPass123!")),
|
||||
@@ -314,6 +317,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
|
||||
UserEntity user = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Username = _testUsername,
|
||||
Password = _hashService.HashString("TestPass123!"),
|
||||
TempPassword = Uri.EscapeDataString(_hashService.HashString("TempPass123!")),
|
||||
|
||||
+9
-7
@@ -69,7 +69,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldResetPassword()
|
||||
public async Task RecoverPassword_WhenCalledWithValidRequest_ShouldResetPassword()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity user = await CreateUserWithTotp();
|
||||
@@ -113,7 +113,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenUserDoesNotExist_ShouldReturnNotFound()
|
||||
public async Task RecoverPassword_WhenUserDoesNotExist_ShouldReturnNotFound()
|
||||
{
|
||||
// Arrange
|
||||
RecoverPasswordRequest request = new(
|
||||
@@ -140,7 +140,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenInvalidTotpCode_ShouldReturnForbiddenResult()
|
||||
public async Task RecoverPassword_WhenInvalidTotpCode_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity user = await CreateUserWithTotp();
|
||||
@@ -173,7 +173,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenRequestIsNull_ShouldReturnValidationError()
|
||||
public async Task RecoverPassword_WhenRequestIsNull_ShouldReturnValidationError()
|
||||
{
|
||||
// Arrange
|
||||
RecoverPasswordRequest? request = null;
|
||||
@@ -203,7 +203,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenUserDoesNotUseTotpAndTriesToRecover_ShouldReturnForbiddenResult()
|
||||
public async Task RecoverPassword_WhenUserDoesNotUseTotpAndTriesToRecover_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity user = await CreateUserWithoutTotp();
|
||||
@@ -237,7 +237,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenUserDoesNotUseTotpAndTriesToRecoverWithoutCode_ShouldReturnForbiddenResult()
|
||||
public async Task RecoverPassword_WhenUserDoesNotUseTotpAndTriesToRecoverWithoutCode_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
// Setup user without TOTP
|
||||
@@ -246,6 +246,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
|
||||
UserEntity userWithoutTotp = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Username = "userwithoutotp2",
|
||||
Password = _hashService.HashString("OldPass123!"),
|
||||
TotpSecret = null, // No TOTP configured
|
||||
@@ -288,7 +289,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task RecoverPassword_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
RecoverPasswordRequest request = new(
|
||||
@@ -314,6 +315,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
byte[] totpSecret = _totpTokenGenerator.GenerateSecret();
|
||||
UserEntity user = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Username = _testUsername,
|
||||
Password = _hashService.HashString("OldPass123!"),
|
||||
TotpSecret = _cryptographyService.Encrypt(Convert.ToBase64String(totpSecret)),
|
||||
|
||||
+6
-5
@@ -57,7 +57,7 @@ public class RegisterEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldRegisterUserSuccessfully()
|
||||
public async Task Register_WhenCalledWithValidRequest_ShouldRegisterUserSuccessfully()
|
||||
{
|
||||
// Arrange
|
||||
RegistrationRequest request = new(
|
||||
@@ -85,7 +85,7 @@ public class RegisterEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequestAnd2FA_ShouldRegisterUserWithTotp()
|
||||
public async Task Register_WhenCalledWithValidRequestAnd2FA_ShouldRegisterUserWithTotp()
|
||||
{
|
||||
// Arrange
|
||||
RegistrationRequest request = new(
|
||||
@@ -112,7 +112,7 @@ public class RegisterEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenUsernameAlreadyExists_ShouldReturnConflict()
|
||||
public async Task Register_WhenUsernameAlreadyExists_ShouldReturnConflict()
|
||||
{
|
||||
// Arrange
|
||||
await CreateTestUser();
|
||||
@@ -138,7 +138,7 @@ public class RegisterEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenPasswordsDoNotMatch_ShouldReturnValidationError()
|
||||
public async Task Register_WhenPasswordsDoNotMatch_ShouldReturnValidationError()
|
||||
{
|
||||
// Arrange
|
||||
RegistrationRequest request = new(
|
||||
@@ -164,7 +164,7 @@ public class RegisterEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenRequestIsNull_ShouldReturnValidationError()
|
||||
public async Task Register_WhenRequestIsNull_ShouldReturnValidationError()
|
||||
{
|
||||
// Arrange
|
||||
RegistrationRequest? request = null;
|
||||
@@ -193,6 +193,7 @@ public class RegisterEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
|
||||
UserEntity user = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Username = _testUsername,
|
||||
Password = new PasswordHashService().HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
|
||||
+4
-4
@@ -65,7 +65,7 @@ public class GetAuthorizationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldReturnAuthorizationDetails()
|
||||
public async Task GetAuthorization_WhenCalledWithValidRequest_ShouldReturnAuthorizationDetails()
|
||||
{
|
||||
// Arrange
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
@@ -97,7 +97,7 @@ public class GetAuthorizationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenUserDoesNotExist_ShouldReturnForbiddenResult()
|
||||
public async Task GetAuthorization_WhenUserDoesNotExist_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
GetAuthorizationRequest request = new(Guid.NewGuid());
|
||||
@@ -121,7 +121,7 @@ public class GetAuthorizationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenUserIdIsEmpty_ShouldReturnValidationError()
|
||||
public async Task GetAuthorization_WhenUserIdIsEmpty_ShouldReturnValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetAuthorizationRequest request = new(Guid.Empty);
|
||||
@@ -150,7 +150,7 @@ public class GetAuthorizationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task GetAuthorization_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
GetAuthorizationRequest request = new(Guid.NewGuid());
|
||||
|
||||
+4
-4
@@ -55,7 +55,7 @@ public class GetUserPermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldReturnUserPermissions()
|
||||
public async Task GetUserPermissions_WhenCalledWithValidRequest_ShouldReturnUserPermissions()
|
||||
{
|
||||
// Arrange
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
@@ -97,7 +97,7 @@ public class GetUserPermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
public async Task GetUserPermissions_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
_client = await _apiFactory.CreateAuthenticatedClientAsync();
|
||||
@@ -125,7 +125,7 @@ public class GetUserPermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenUserDoesNotExist_ShouldReturnNotFound()
|
||||
public async Task GetUserPermissions_WhenUserDoesNotExist_ShouldReturnNotFound()
|
||||
{
|
||||
// Arrange
|
||||
Guid nonExistentUserId = Guid.NewGuid();
|
||||
@@ -149,7 +149,7 @@ public class GetUserPermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task GetUserPermissions_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
+4
-4
@@ -54,7 +54,7 @@ public class GetUserRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldReturnUserRole()
|
||||
public async Task GetUserRole_WhenCalledWithValidRequest_ShouldReturnUserRole()
|
||||
{
|
||||
// Arrange
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
@@ -78,7 +78,7 @@ public class GetUserRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
public async Task GetUserRole_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
_client = await _apiFactory.CreateAuthenticatedClientAsync();
|
||||
@@ -106,7 +106,7 @@ public class GetUserRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenUserDoesNotExist_ShouldReturnNotFound()
|
||||
public async Task GetUserRole_WhenUserDoesNotExist_ShouldReturnNotFound()
|
||||
{
|
||||
// Arrange
|
||||
Guid nonExistentUserId = Guid.NewGuid();
|
||||
@@ -130,7 +130,7 @@ public class GetUserRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task GetUserRole_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
+5
-5
@@ -56,7 +56,7 @@ public class UpdateUserRoleAndPermissionsEndpointTests : IClassFixture<Authentic
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldUpdateUserRoleAndPermissions()
|
||||
public async Task UpdateUserRoleAndPermissions_WhenCalledWithValidRequest_ShouldUpdateUserRoleAndPermissions()
|
||||
{
|
||||
// Arrange
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
@@ -114,7 +114,7 @@ public class UpdateUserRoleAndPermissionsEndpointTests : IClassFixture<Authentic
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
public async Task UpdateUserRoleAndPermissions_WhenCalledWithNonAdminAccount_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
_client = await _apiFactory.CreateAuthenticatedClientAsync();
|
||||
@@ -143,7 +143,7 @@ public class UpdateUserRoleAndPermissionsEndpointTests : IClassFixture<Authentic
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenTryingToRemoveLastAdmin_ShouldReturnForbiddenResult()
|
||||
public async Task UpdateUserRoleAndPermissions_WhenTryingToRemoveLastAdmin_ShouldReturnForbiddenResult()
|
||||
{
|
||||
// Arrange
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
@@ -188,7 +188,7 @@ public class UpdateUserRoleAndPermissionsEndpointTests : IClassFixture<Authentic
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenUserDoesNotExist_ShouldReturnNotFound()
|
||||
public async Task UpdateUserRoleAndPermissions_WhenUserDoesNotExist_ShouldReturnNotFound()
|
||||
{
|
||||
// Arrange
|
||||
Guid nonExistentUserId = Guid.NewGuid();
|
||||
@@ -217,7 +217,7 @@ public class UpdateUserRoleAndPermissionsEndpointTests : IClassFixture<Authentic
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
public async Task UpdateUserRoleAndPermissions_WhenCancellationRequested_ShouldThrowTaskCanceledException()
|
||||
{
|
||||
// Arrange
|
||||
using CancellationTokenSource cts = new();
|
||||
|
||||
Reference in new issue
Block a user