mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 11:11:10 +00:00
Adds authorization module tests
This commit is contained in:
1 parent
718e1c49cf
commit
0114ff13e8
125 files changed
+10411
-203
No files matched your search
+97
@@ -0,0 +1,97 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Commands.AddRole;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.UnitTests.Common.Mapping.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="AddRoleRequestMapping"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddRoleRequestMappingTests
|
||||
{
|
||||
[Fact]
|
||||
public void ToCommand_WhenMappingValidRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
AddRoleRequest request = new(
|
||||
"Admin",
|
||||
[Guid.NewGuid(), Guid.NewGuid()]
|
||||
);
|
||||
|
||||
// Act
|
||||
AddRoleCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleName.Should().Be(request.RoleName);
|
||||
result.Permissions.Should().BeEquivalentTo(request.Permissions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToCommand_WhenMappingRequestWithEmptyPermissions_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
AddRoleRequest request = new(
|
||||
"Guest",
|
||||
[]
|
||||
);
|
||||
|
||||
// Act
|
||||
AddRoleCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleName.Should().Be(request.RoleName);
|
||||
result.Permissions.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Admin")]
|
||||
[InlineData("User")]
|
||||
[InlineData("Guest")]
|
||||
public void ToCommand_WhenMappingDifferentRoleNames_ShouldMapCorrectly(string roleName)
|
||||
{
|
||||
// Arrange
|
||||
AddRoleRequest request = new(
|
||||
roleName,
|
||||
[Guid.NewGuid()]
|
||||
);
|
||||
|
||||
// Act
|
||||
AddRoleCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleName.Should().Be(roleName);
|
||||
result.Permissions.Should().BeEquivalentTo(request.Permissions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToCommand_WhenMappingRequestWithMultiplePermissions_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<Guid> permissions =
|
||||
[
|
||||
Guid.Parse("00000000-0000-0000-0000-000000000001"),
|
||||
Guid.Parse("00000000-0000-0000-0000-000000000002"),
|
||||
Guid.Parse("00000000-0000-0000-0000-000000000003")
|
||||
];
|
||||
AddRoleRequest request = new("SuperAdmin", permissions);
|
||||
|
||||
// Act
|
||||
AddRoleCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleName.Should().Be(request.RoleName);
|
||||
result.Permissions.Should().BeEquivalentTo(permissions);
|
||||
result.Permissions.Should().HaveCount(3);
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Commands.DeleteRole;
|
||||
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="DeleteRoleRequestMapping"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class DeleteRoleRequestMappingTests
|
||||
{
|
||||
[Fact]
|
||||
public void ToCommand_WhenMappingValidRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
Guid roleId = Guid.NewGuid();
|
||||
DeleteRoleRequest request = new(roleId);
|
||||
|
||||
// Act
|
||||
DeleteRoleCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleId.Should().Be(request.RoleId!.Value);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("00000000-0000-0000-0000-000000000000")]
|
||||
[InlineData("12345678-1234-1234-1234-123456789012")]
|
||||
[InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")]
|
||||
public void ToCommand_WhenMappingDifferentRoleIds_ShouldMapCorrectly(string roleIdString)
|
||||
{
|
||||
// Arrange
|
||||
Guid roleId = Guid.Parse(roleIdString);
|
||||
DeleteRoleRequest request = new(roleId);
|
||||
|
||||
// Act
|
||||
DeleteRoleCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleId.Should().Be(roleId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToCommand_WhenRoleIdIsNull_ShouldThrowInvalidOperationException()
|
||||
{
|
||||
// Arrange
|
||||
DeleteRoleRequest request = new(null);
|
||||
|
||||
// Act
|
||||
Action act = () => request.ToCommand();
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<InvalidOperationException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToCommand_WhenMappingEmptyGuid_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
DeleteRoleRequest request = new(Guid.Empty);
|
||||
|
||||
// Act
|
||||
DeleteRoleCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleId.Should().Be(Guid.Empty);
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Queries.GetRolePermissions;
|
||||
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
|
||||
{
|
||||
[Fact]
|
||||
public void ToQuery_WhenMappingValidRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
Guid roleId = Guid.NewGuid();
|
||||
GetRolePermissionsRequest request = new(roleId);
|
||||
|
||||
// Act
|
||||
GetRolePermissionsQuery result = request.ToQuery();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleId.Should().Be(request.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 = new(roleId);
|
||||
|
||||
// Act
|
||||
GetRolePermissionsQuery result = request.ToQuery();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleId.Should().Be(roleId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToQuery_WhenMappingEmptyGuid_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
GetRolePermissionsRequest request = new(Guid.Empty);
|
||||
|
||||
// Act
|
||||
GetRolePermissionsQuery result = request.ToQuery();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleId.Should().Be(Guid.Empty);
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserPermissions;
|
||||
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="GetUserPermissionsRequestMapping"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetUserPermissionsRequestMappingTests
|
||||
{
|
||||
[Fact]
|
||||
public void ToQuery_WhenMappingValidRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
Guid userId = Guid.NewGuid();
|
||||
GetUserPermissionsRequest request = new(userId);
|
||||
|
||||
// Act
|
||||
GetUserPermissionsQuery result = request.ToQuery();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(request.UserId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToQuery_WhenUserIdIsNull_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
GetUserPermissionsRequest request = new(null);
|
||||
|
||||
// Act
|
||||
GetUserPermissionsQuery result = request.ToQuery();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().BeNull();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("00000000-0000-0000-0000-000000000000")]
|
||||
[InlineData("12345678-1234-1234-1234-123456789012")]
|
||||
[InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")]
|
||||
public void ToQuery_WhenMappingDifferentUserIds_ShouldMapCorrectly(string userIdString)
|
||||
{
|
||||
// Arrange
|
||||
Guid userId = Guid.Parse(userIdString);
|
||||
GetUserPermissionsRequest request = new(userId);
|
||||
|
||||
// Act
|
||||
GetUserPermissionsQuery result = request.ToQuery();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(request.UserId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToQuery_WhenMappingEmptyGuid_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
GetUserPermissionsRequest request = new(Guid.Empty);
|
||||
|
||||
// Act
|
||||
GetUserPermissionsQuery result = request.ToQuery();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(Guid.Empty);
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserRole;
|
||||
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="GetUserRoleRequestMapping"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetUserRoleRequestMappingTests
|
||||
{
|
||||
[Fact]
|
||||
public void ToQuery_WhenMappingValidRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
Guid userId = Guid.NewGuid();
|
||||
GetUserRoleRequest request = new(userId);
|
||||
|
||||
// Act
|
||||
GetUserRoleQuery result = request.ToQuery();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(request.UserId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToQuery_WhenUserIdIsNull_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
GetUserRoleRequest request = new(null);
|
||||
|
||||
// Act
|
||||
GetUserRoleQuery result = request.ToQuery();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().BeNull();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("00000000-0000-0000-0000-000000000000")]
|
||||
[InlineData("12345678-1234-1234-1234-123456789012")]
|
||||
[InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")]
|
||||
public void ToQuery_WhenMappingDifferentUserIds_ShouldMapCorrectly(string userIdString)
|
||||
{
|
||||
// Arrange
|
||||
Guid userId = Guid.Parse(userIdString);
|
||||
GetUserRoleRequest request = new(userId);
|
||||
|
||||
// Act
|
||||
GetUserRoleQuery result = request.ToQuery();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(request.UserId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToQuery_WhenMappingEmptyGuid_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
GetUserRoleRequest request = new(Guid.Empty);
|
||||
|
||||
// Act
|
||||
GetUserRoleQuery result = request.ToQuery();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(Guid.Empty);
|
||||
}
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Common.DataAccess.Entities.Authorization;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Domain.Common.Enums.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.UnitTests.Common.Mapping.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="PermissionEntityMapping"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PermissionEntityMappingTests
|
||||
{
|
||||
[Fact]
|
||||
public void ToResponse_WhenMappingValidEntity_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
PermissionEntity entity = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
PermissionName = AuthorizationPermission.CanViewUsers
|
||||
};
|
||||
|
||||
// Act
|
||||
PermissionResponse result = entity.ToResponse();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.Id.Should().Be(entity.Id);
|
||||
result.PermissionName.Should().Be(entity.PermissionName);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(AuthorizationPermission.None)]
|
||||
[InlineData(AuthorizationPermission.CanViewUsers)]
|
||||
[InlineData(AuthorizationPermission.CanDeleteUsers)]
|
||||
[InlineData(AuthorizationPermission.CanRegisterUsers)]
|
||||
public void ToResponse_WhenMappingDifferentPermissions_ShouldMapCorrectly(AuthorizationPermission permission)
|
||||
{
|
||||
// Arrange
|
||||
PermissionEntity entity = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
PermissionName = permission
|
||||
};
|
||||
|
||||
// Act
|
||||
PermissionResponse result = entity.ToResponse();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.Id.Should().Be(entity.Id);
|
||||
result.PermissionName.Should().Be(permission);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToResponses_WhenMappingMultipleEntities_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<PermissionEntity> entities =
|
||||
[
|
||||
new() { Id = Guid.NewGuid(), PermissionName = AuthorizationPermission.CanViewUsers },
|
||||
new() { Id = Guid.NewGuid(), PermissionName = AuthorizationPermission.CanDeleteUsers },
|
||||
new() { Id = Guid.NewGuid(), PermissionName = AuthorizationPermission.CanRegisterUsers }
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<PermissionResponse> results = entities.ToResponses();
|
||||
|
||||
// Assert
|
||||
results.Should().NotBeNull();
|
||||
results.Should().HaveCount(3);
|
||||
results.Should().BeEquivalentTo(entities, options => options
|
||||
.Including(x => x.Id)
|
||||
.Including(x => x.PermissionName));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToResponses_WhenMappingEmptyCollection_ShouldReturnEmptyCollection()
|
||||
{
|
||||
// Arrange
|
||||
List<PermissionEntity> entities = [];
|
||||
|
||||
// Act
|
||||
IEnumerable<PermissionResponse> results = entities.ToResponses();
|
||||
|
||||
// Assert
|
||||
results.Should().NotBeNull();
|
||||
results.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("00000000-0000-0000-0000-000000000000")]
|
||||
[InlineData("12345678-1234-1234-1234-123456789012")]
|
||||
[InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")]
|
||||
public void ToResponse_WhenMappingDifferentIds_ShouldMapCorrectly(string idString)
|
||||
{
|
||||
// Arrange
|
||||
PermissionEntity entity = new()
|
||||
{
|
||||
Id = Guid.Parse(idString),
|
||||
PermissionName = AuthorizationPermission.CanViewUsers
|
||||
};
|
||||
|
||||
// Act
|
||||
PermissionResponse result = entity.ToResponse();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.Id.Should().Be(entity.Id);
|
||||
result.PermissionName.Should().Be(entity.PermissionName);
|
||||
}
|
||||
}
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Common.DataAccess.Entities.Authorization;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Domain.Common.Enums.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.UnitTests.Common.Mapping.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="RoleEntityMapping"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RoleEntityMappingTests
|
||||
{
|
||||
[Fact]
|
||||
public void ToResponse_WhenMappingValidEntity_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
RoleEntity entity = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
RoleName = "Admin"
|
||||
};
|
||||
|
||||
// Act
|
||||
RoleResponse result = entity.ToResponse();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.Id.Should().Be(entity.Id);
|
||||
result.RoleName.Should().Be(entity.RoleName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToRolePermissionsResponse_WhenMappingValidEntity_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
Guid roleId = Guid.NewGuid();
|
||||
RoleEntity role = new()
|
||||
{
|
||||
Id = roleId,
|
||||
RoleName = "Admin"
|
||||
};
|
||||
|
||||
role.RolePermissions =
|
||||
[
|
||||
new()
|
||||
{
|
||||
PermissionId = Guid.NewGuid(),
|
||||
RoleId = roleId,
|
||||
Role = role,
|
||||
Permission = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
PermissionName = AuthorizationPermission.CanViewUsers
|
||||
}
|
||||
},
|
||||
new()
|
||||
{
|
||||
PermissionId = Guid.NewGuid(),
|
||||
RoleId = roleId,
|
||||
Role = role,
|
||||
Permission = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
PermissionName = AuthorizationPermission.CanDeleteUsers
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
// Act
|
||||
RolePermissionsResponse result = role.ToRolePermissionsResponse();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.Role.Id.Should().Be(role.Id);
|
||||
result.Role.RoleName.Should().Be(role.RoleName);
|
||||
result.Permissions.Should().HaveCount(2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToResponses_WhenMappingMultipleEntities_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<RoleEntity> entities =
|
||||
[
|
||||
new() { Id = Guid.NewGuid(), RoleName = "Admin" },
|
||||
new() { Id = Guid.NewGuid(), RoleName = "User" },
|
||||
new() { Id = Guid.NewGuid(), RoleName = "Guest" }
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<RoleResponse> results = entities.ToResponses();
|
||||
|
||||
// Assert
|
||||
results.Should().NotBeNull();
|
||||
results.Should().HaveCount(3);
|
||||
results.Should().BeEquivalentTo(entities, options => options
|
||||
.Including(x => x.Id)
|
||||
.Including(x => x.RoleName));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToResponses_WhenMappingEmptyCollection_ShouldReturnEmptyCollection()
|
||||
{
|
||||
// Arrange
|
||||
List<RoleEntity> entities = [];
|
||||
|
||||
// Act
|
||||
IEnumerable<RoleResponse> results = entities.ToResponses();
|
||||
|
||||
// Assert
|
||||
results.Should().NotBeNull();
|
||||
results.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Admin")]
|
||||
[InlineData("User")]
|
||||
[InlineData("Guest")]
|
||||
public void ToResponse_WhenMappingDifferentRoleNames_ShouldMapCorrectly(string roleName)
|
||||
{
|
||||
// Arrange
|
||||
RoleEntity entity = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
RoleName = roleName
|
||||
};
|
||||
|
||||
// Act
|
||||
RoleResponse result = entity.ToResponse();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.Id.Should().Be(entity.Id);
|
||||
result.RoleName.Should().Be(roleName);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("00000000-0000-0000-0000-000000000000")]
|
||||
[InlineData("12345678-1234-1234-1234-123456789012")]
|
||||
[InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")]
|
||||
public void ToResponse_WhenMappingDifferentIds_ShouldMapCorrectly(string idString)
|
||||
{
|
||||
// Arrange
|
||||
RoleEntity entity = new()
|
||||
{
|
||||
Id = Guid.Parse(idString),
|
||||
RoleName = "Admin"
|
||||
};
|
||||
|
||||
// Act
|
||||
RoleResponse result = entity.ToResponse();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.Id.Should().Be(entity.Id);
|
||||
result.RoleName.Should().Be(entity.RoleName);
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.Admin.Authorization.Roles.Commands.UpdateRole;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.UnitTests.Common.Mapping.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="UpdateRoleRequestMapping"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateRoleRequestMappingTests
|
||||
{
|
||||
[Fact]
|
||||
public void ToCommand_WhenMappingValidRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<Guid> permissions = [Guid.NewGuid(), Guid.NewGuid()];
|
||||
UpdateRoleRequest request = new(
|
||||
Guid.NewGuid(),
|
||||
"Admin",
|
||||
permissions
|
||||
);
|
||||
|
||||
// Act
|
||||
UpdateRoleCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleId.Should().Be(request.RoleId!.Value);
|
||||
result.RoleName.Should().Be(request.RoleName);
|
||||
result.Permissions.Should().BeEquivalentTo(request.Permissions);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Admin")]
|
||||
[InlineData("User")]
|
||||
[InlineData("Guest")]
|
||||
public void ToCommand_WhenMappingDifferentRoleNames_ShouldMapCorrectly(string roleName)
|
||||
{
|
||||
// Arrange
|
||||
UpdateRoleRequest request = new(
|
||||
Guid.NewGuid(),
|
||||
roleName,
|
||||
[Guid.NewGuid()]
|
||||
);
|
||||
|
||||
// Act
|
||||
UpdateRoleCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleName.Should().Be(roleName);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("00000000-0000-0000-0000-000000000000")]
|
||||
[InlineData("12345678-1234-1234-1234-123456789012")]
|
||||
[InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")]
|
||||
public void ToCommand_WhenMappingDifferentRoleIds_ShouldMapCorrectly(string roleIdString)
|
||||
{
|
||||
// Arrange
|
||||
UpdateRoleRequest request = new(
|
||||
Guid.Parse(roleIdString),
|
||||
"Admin",
|
||||
[Guid.NewGuid()]
|
||||
);
|
||||
|
||||
// Act
|
||||
UpdateRoleCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.RoleId.Should().Be(request.RoleId!.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToCommand_WhenMappingMultiplePermissions_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<Guid> permissions =
|
||||
[
|
||||
Guid.Parse("00000000-0000-0000-0000-000000000001"),
|
||||
Guid.Parse("00000000-0000-0000-0000-000000000002"),
|
||||
Guid.Parse("00000000-0000-0000-0000-000000000003")
|
||||
];
|
||||
UpdateRoleRequest request = new(Guid.NewGuid(), "Admin", permissions);
|
||||
|
||||
// Act
|
||||
UpdateRoleCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.Permissions.Should().BeEquivalentTo(permissions);
|
||||
result.Permissions.Should().HaveCount(3);
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Commands.UpdateUserRoleAndPermissions;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.UnitTests.Common.Mapping.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="UpdateUserRoleAndPermissionsRequestMapping"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateUserRoleAndPermissionsRequestMappingTests
|
||||
{
|
||||
[Fact]
|
||||
public void ToCommand_WhenMappingValidRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<Guid> permissions = [Guid.NewGuid()];
|
||||
UpdateUserRoleAndPermissionsRequest request = new(
|
||||
Guid.NewGuid(),
|
||||
Guid.NewGuid(),
|
||||
permissions
|
||||
);
|
||||
|
||||
// Act
|
||||
UpdateUserRoleAndPermissionsCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(request.UserId!.Value);
|
||||
result.RoleId.Should().Be(request.RoleId);
|
||||
result.Permissions.Should().BeEquivalentTo(request.Permissions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToCommand_WhenRoleIdIsNull_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<Guid> permissions = [Guid.NewGuid()];
|
||||
UpdateUserRoleAndPermissionsRequest request = new(
|
||||
Guid.NewGuid(),
|
||||
null,
|
||||
permissions
|
||||
);
|
||||
|
||||
// Act
|
||||
UpdateUserRoleAndPermissionsCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(request.UserId!.Value);
|
||||
result.RoleId.Should().BeNull();
|
||||
result.Permissions.Should().BeEquivalentTo(request.Permissions);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("00000000-0000-0000-0000-000000000000")]
|
||||
[InlineData("12345678-1234-1234-1234-123456789012")]
|
||||
[InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")]
|
||||
public void ToCommand_WhenMappingDifferentUserIds_ShouldMapCorrectly(string userIdString)
|
||||
{
|
||||
// Arrange
|
||||
UpdateUserRoleAndPermissionsRequest request = new(
|
||||
Guid.Parse(userIdString),
|
||||
Guid.NewGuid(),
|
||||
[Guid.NewGuid()]
|
||||
);
|
||||
|
||||
// Act
|
||||
UpdateUserRoleAndPermissionsCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(request.UserId!.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToCommand_WhenMappingMultiplePermissions_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<Guid> permissions =
|
||||
[
|
||||
Guid.Parse("00000000-0000-0000-0000-000000000001"),
|
||||
Guid.Parse("00000000-0000-0000-0000-000000000002"),
|
||||
Guid.Parse("00000000-0000-0000-0000-000000000003")
|
||||
];
|
||||
UpdateUserRoleAndPermissionsRequest request = new(
|
||||
Guid.NewGuid(),
|
||||
Guid.NewGuid(),
|
||||
permissions
|
||||
);
|
||||
|
||||
// Act
|
||||
UpdateUserRoleAndPermissionsCommand result = request.ToCommand();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.Permissions.Should().BeEquivalentTo(permissions);
|
||||
result.Permissions.Should().HaveCount(3);
|
||||
}
|
||||
}
|
||||
+19
-11
@@ -32,8 +32,10 @@ public class LibraryEntityMappingTests
|
||||
new() { Path = "C:/Books" },
|
||||
new() { Path = "D:/Media/Books" }
|
||||
],
|
||||
Created = DateTime.UtcNow,
|
||||
Updated = null
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
UpdatedOnUtc = null,
|
||||
UpdatedBy = null
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -46,8 +48,8 @@ public class LibraryEntityMappingTests
|
||||
result.Title.Should().Be(entity.Title);
|
||||
result.LibraryType.Should().Be(entity.LibraryType);
|
||||
result.ContentLocations.Should().BeEquivalentTo(entity.ContentLocations.Select(l => l.Path));
|
||||
result.Created.Should().Be(entity.Created);
|
||||
result.Updated.Should().Be(entity.Updated);
|
||||
result.CreatedOnUtc.Should().Be(entity.CreatedOnUtc);
|
||||
result.UpdatedOnUtc.Should().Be(entity.UpdatedOnUtc);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -65,8 +67,10 @@ public class LibraryEntityMappingTests
|
||||
Title = "My Library",
|
||||
LibraryType = libraryType,
|
||||
ContentLocations = [new() { Path = "C:/Media" }],
|
||||
Created = DateTime.UtcNow,
|
||||
Updated = null
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
UpdatedOnUtc = null,
|
||||
UpdatedBy = null
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -94,8 +98,10 @@ public class LibraryEntityMappingTests
|
||||
new() { Path = "E:/Digital Library/Books" },
|
||||
new() { Path = "F:/Reading Material" }
|
||||
],
|
||||
Created = DateTime.UtcNow,
|
||||
Updated = null
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
UpdatedOnUtc = null,
|
||||
UpdatedBy = null
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -118,8 +124,10 @@ public class LibraryEntityMappingTests
|
||||
Title = "My Library",
|
||||
LibraryType = LibraryType.Book,
|
||||
ContentLocations = [new() { Path = "C:/Books" }],
|
||||
Created = DateTime.UtcNow,
|
||||
Updated = updated
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
UpdatedOnUtc = updated,
|
||||
UpdatedBy = Guid.NewGuid()
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -127,6 +135,6 @@ public class LibraryEntityMappingTests
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.Updated.Should().Be(updated);
|
||||
result.UpdatedOnUtc.Should().Be(updated);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -44,8 +44,8 @@ public class LibraryMappingTests
|
||||
result.LibraryType.Should().Be(library.LibraryType);
|
||||
result.ContentLocations.Select(l => l.Path)
|
||||
.Should().BeEquivalentTo(library.ContentLocations.Select(l => l.Path));
|
||||
result.Created.Should().Be(library.Created);
|
||||
result.Updated.Should().Be(library.Updated.HasValue ? library.Updated : null);
|
||||
result.CreatedOnUtc.Should().Be(library.CreatedOnUtc);
|
||||
result.UpdatedOnUtc.Should().Be(library.UpdatedOnUtc.HasValue ? library.UpdatedOnUtc : null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@ public class BookMappingTests
|
||||
result.AppleBooksId.Should().Be(book.AppleBooksId.HasValue ? book.AppleBooksId.Value : null);
|
||||
result.ISBNs.Should().BeEquivalentTo(book.ISBNs.ToRepositoryEntities());
|
||||
result.Ratings.Should().BeEquivalentTo(book.Ratings.ToRepositoryEntities());
|
||||
result.Created.Should().Be(book.Created);
|
||||
result.Updated.Should().Be(book.Updated.HasValue ? book.Updated.Value : null);
|
||||
result.CreatedOnUtc.Should().Be(book.CreatedOnUtc);
|
||||
result.UpdatedOnUtc.Should().Be(book.UpdatedOnUtc.HasValue ? book.UpdatedOnUtc.Value : null);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -248,15 +248,15 @@ public class BookEntityMappingTests
|
||||
else
|
||||
result.Value.AppleBooksId.HasValue.Should().BeFalse();
|
||||
|
||||
result.Value.Created.Should().Be(bookEntity.Created);
|
||||
result.Value.CreatedOnUtc.Should().Be(bookEntity.CreatedOnUtc);
|
||||
|
||||
if (bookEntity.Updated.HasValue)
|
||||
if (bookEntity.UpdatedOnUtc.HasValue)
|
||||
{
|
||||
result.Value.Updated.HasValue.Should().BeTrue();
|
||||
result.Value.Updated!.Value.Should().Be(bookEntity.Updated.Value);
|
||||
result.Value.UpdatedOnUtc.HasValue.Should().BeTrue();
|
||||
result.Value.UpdatedOnUtc!.Value.Should().Be(bookEntity.UpdatedOnUtc.Value);
|
||||
}
|
||||
else
|
||||
result.Value.Updated.HasValue.Should().BeFalse();
|
||||
result.Value.UpdatedOnUtc.HasValue.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -304,8 +304,8 @@ public class BookEntityMappingTests
|
||||
result.AppleBooksId.Should().Be(bookEntity.AppleBooksId);
|
||||
result.ISBNs.Should().BeEquivalentTo(bookEntity.ISBNs);
|
||||
result.Ratings.Should().BeEquivalentTo(bookEntity.Ratings);
|
||||
result.Created.Should().Be(bookEntity.Created);
|
||||
result.Updated.Should().Be(bookEntity.Updated);
|
||||
result.CreatedOnUtc.Should().Be(bookEntity.CreatedOnUtc);
|
||||
result.UpdatedOnUtc.Should().Be(bookEntity.UpdatedOnUtc);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+4
-2
@@ -33,8 +33,10 @@ public class UserEntityFixture
|
||||
Title = f.Commerce.ProductName(),
|
||||
LibraryType = f.PickRandom<LibraryType>(),
|
||||
ContentLocations = [],
|
||||
Created = f.Date.Past(),
|
||||
Updated = null
|
||||
CreatedOnUtc = f.Date.Past(),
|
||||
CreatedBy = userId,
|
||||
UpdatedOnUtc = null,
|
||||
UpdatedBy = null
|
||||
})
|
||||
.Generate(libraryCount)];
|
||||
|
||||
|
||||
+52
-16
@@ -6,8 +6,8 @@ using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookL
|
||||
using Lumina.Application.Common.Mapping.UsersManagement.Users;
|
||||
using Lumina.Application.UnitTests.Common.Mapping.UserManagement.Users.Fixtures;
|
||||
using Lumina.Contracts.Responses.UsersManagement.Users;
|
||||
using Lumina.Domain.Common.Enums.MediaLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
@@ -19,16 +19,6 @@ namespace Lumina.Application.UnitTests.Common.Mapping.UserManagement.Users;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UserEntityMappingTests
|
||||
{
|
||||
private readonly UserEntityFixture _fixture;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserEntityMappingTests"/> class.
|
||||
/// </summary>
|
||||
public UserEntityMappingTests()
|
||||
{
|
||||
_fixture = new UserEntityFixture();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToResponse_WhenMappingValidUserEntity_ShouldMapCorrectly()
|
||||
{
|
||||
@@ -42,8 +32,8 @@ public class UserEntityMappingTests
|
||||
result.Should().NotBeNull();
|
||||
result.Id.Should().Be(entity.Id);
|
||||
result.Username.Should().Be(entity.Username);
|
||||
result.Created.Should().Be(entity.CreatedOnUtc);
|
||||
result.Updated.Should().Be(entity.UpdatedOnUtc);
|
||||
result.CreatedOnUtc.Should().Be(entity.CreatedOnUtc);
|
||||
result.UpdatedOnUtc.Should().Be(entity.UpdatedOnUtc);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -77,7 +67,7 @@ public class UserEntityMappingTests
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.Updated.Should().Be(entity.UpdatedOnUtc);
|
||||
result.UpdatedOnUtc.Should().Be(entity.UpdatedOnUtc);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -93,7 +83,53 @@ public class UserEntityMappingTests
|
||||
result.Should().NotBeNull();
|
||||
result.Id.Should().Be(entity.Id);
|
||||
result.Username.Should().Be(entity.Username);
|
||||
result.Created.Should().Be(entity.CreatedOnUtc);
|
||||
result.Updated.Should().Be(entity.UpdatedOnUtc);
|
||||
result.CreatedOnUtc.Should().Be(entity.CreatedOnUtc);
|
||||
result.UpdatedOnUtc.Should().Be(entity.UpdatedOnUtc);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToResponses_WhenMappingMultipleEntities_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<UserEntity> entities = UserEntityFixture.CreateMany(3);
|
||||
|
||||
// Act
|
||||
IEnumerable<UserResponse> results = entities.ToResponses();
|
||||
|
||||
// Assert
|
||||
results.Should().NotBeNull();
|
||||
results.Should().HaveCount(3);
|
||||
results.Should().BeEquivalentTo(entities, options => options
|
||||
.Including(x => x.Id)
|
||||
.Including(x => x.Username));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToResponses_WhenMappingEmptyCollection_ShouldReturnEmptyCollection()
|
||||
{
|
||||
// Arrange
|
||||
List<UserEntity> entities = [];
|
||||
|
||||
// Act
|
||||
IEnumerable<UserResponse> results = entities.ToResponses();
|
||||
|
||||
// Assert
|
||||
results.Should().NotBeNull();
|
||||
results.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToResponse_WhenMappingWithoutUpdatedDateTime_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
UserEntity entity = UserEntityFixture.CreateUserEntity();
|
||||
entity.UpdatedOnUtc = null;
|
||||
|
||||
// Act
|
||||
UserResponse result = entity.ToResponse();
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UpdatedOnUtc.Should().BeNull();
|
||||
}
|
||||
}
|
||||
+8
-4
@@ -117,8 +117,10 @@ public class UserMappingTests
|
||||
Title = "Library 1",
|
||||
LibraryType = LibraryType.Book,
|
||||
ContentLocations = [],
|
||||
Created = DateTime.UtcNow,
|
||||
Updated = null
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
UpdatedOnUtc = null,
|
||||
UpdatedBy = null
|
||||
},
|
||||
new()
|
||||
{
|
||||
@@ -127,8 +129,10 @@ public class UserMappingTests
|
||||
Title = "Library 2",
|
||||
LibraryType = LibraryType.Movie,
|
||||
ContentLocations = [],
|
||||
Created = DateTime.UtcNow,
|
||||
Updated = null
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
UpdatedOnUtc = null,
|
||||
UpdatedBy = null
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
Reference in new issue
Block a user