mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 21:01:10 +00:00
67 lines
2.2 KiB
C#
67 lines
2.2 KiB
C#
#region ========================================================================= USING =====================================================================================
|
|
using Lumina.Application.Common.Mapping.Authorization;
|
|
using Lumina.Application.Core.Admin.Authorization.Roles.Queries.GetRolePermissions;
|
|
using Lumina.Contracts.Fixtures.Core.Requests.Authorization;
|
|
using Lumina.Contracts.Requests.Authorization;
|
|
using System;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
#endregion
|
|
|
|
namespace Lumina.Application.UnitTests.Common.Mapping.Authorization;
|
|
|
|
/// <summary>
|
|
/// Contains unit tests for the <see cref="GetRolePermissionsRequestMapping"/> class.
|
|
/// </summary>
|
|
[ExcludeFromCodeCoverage]
|
|
public class GetRolePermissionsRequestMappingTests
|
|
{
|
|
private readonly GetRolePermissionsRequestFixture _getRolePermissionsRequestFixture = new();
|
|
|
|
[Fact]
|
|
public void ToQuery_WhenMappingValidRequest_ShouldMapCorrectly()
|
|
{
|
|
// Arrange
|
|
Guid roleId = Guid.NewGuid();
|
|
GetRolePermissionsRequest request = _getRolePermissionsRequestFixture.Create(roleId);
|
|
|
|
// Act
|
|
GetRolePermissionsQuery result = request.ToQuery();
|
|
|
|
// Assert
|
|
Assert.NotNull(result);
|
|
Assert.Equal(request.RoleId, result.RoleId);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("00000000-0000-0000-0000-000000000000")]
|
|
[InlineData("12345678-1234-1234-1234-123456789012")]
|
|
[InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")]
|
|
public void ToQuery_WhenMappingDifferentRoleIds_ShouldMapCorrectly(string roleIdString)
|
|
{
|
|
// Arrange
|
|
Guid roleId = Guid.Parse(roleIdString);
|
|
GetRolePermissionsRequest request = _getRolePermissionsRequestFixture.Create(roleId);
|
|
|
|
// Act
|
|
GetRolePermissionsQuery result = request.ToQuery();
|
|
|
|
// Assert
|
|
Assert.NotNull(result);
|
|
Assert.Equal(roleId, result.RoleId);
|
|
}
|
|
|
|
[Fact]
|
|
public void ToQuery_WhenMappingEmptyGuid_ShouldMapCorrectly()
|
|
{
|
|
// Arrange
|
|
GetRolePermissionsRequest request = _getRolePermissionsRequestFixture.Create(Guid.Empty);
|
|
|
|
// Act
|
|
GetRolePermissionsQuery result = request.ToQuery();
|
|
|
|
// Assert
|
|
Assert.NotNull(result);
|
|
Assert.Equal(Guid.Empty, result.RoleId);
|
|
}
|
|
}
|