Hardens test assertions and adds missing test coverage.

This commit is contained in:
BinaryAlley committed 2026-08-18 08:28:16 -07:00
1 parent 6b86fd5805
commit 1189bbaf36
489 files changed
+39982 -512

No files matched your search

@@ -0,0 +1,46 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Authentication;
using Lumina.Domain.SharedKernel.Common.Enums.Authorization;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.Authentication;
/// <summary>
/// Fixture class for the <see cref="PermissionDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class PermissionDtoFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="PermissionDto"/>.
/// </summary>
/// <param name="id">Optional. The Id of the permission.</param>
/// <param name="permissionName">Optional. The name of the permission.</param>
/// <returns>The created <see cref="PermissionDto"/>.</returns>
public PermissionDto Create(
Guid? id = null,
AuthorizationPermission? permissionName = null)
{
return new PermissionDto(
id ?? Guid.NewGuid(),
permissionName ?? _faker.PickRandom<AuthorizationPermission>()
);
}
/// <summary>
/// Creates a list of <see cref="PermissionDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<PermissionDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,44 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Authentication;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.Authentication;
/// <summary>
/// Fixture class for the <see cref="RoleDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class RoleDtoFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="RoleDto"/>.
/// </summary>
/// <param name="id">Optional. The unique identifier of the role.</param>
/// <param name="roleName">Optional. The name of the role.</param>
/// <returns>The created <see cref="RoleDto"/>.</returns>
public RoleDto Create(
Guid? id = null,
string? roleName = null)
{
return new RoleDto(
id ?? Guid.NewGuid(),
roleName ?? _faker.Lorem.Word());
}
/// <summary>
/// Creates a list of <see cref="RoleDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<RoleDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}