Inlines fixtures instantiation.

This commit is contained in:
BinaryAlley committed 2026-08-15 03:19:51 -07:00
1 parent b648e2f054
commit 59e16d645a
147 files changed
+190 -898

No files matched your search

@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authentication.Comma
[ExcludeFromCodeCoverage]
public class ChangePasswordCommandValidatorTests
{
private readonly ChangePasswordCommandValidator _validator;
private readonly ChangePasswordCommandFixture _changePasswordCommandFixture;
/// <summary>
/// Initializes a new instance of the <see cref="ChangePasswordCommandValidatorTests"/> class.
/// </summary>
public ChangePasswordCommandValidatorTests()
{
_validator = new ChangePasswordCommandValidator();
_changePasswordCommandFixture = new ChangePasswordCommandFixture();
}
private readonly ChangePasswordCommandValidator _validator = new();
private readonly ChangePasswordCommandFixture _changePasswordCommandFixture = new();
[Fact]
public void Validate_WhenUsernameIsNull_ShouldHaveValidationError()
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authentication.Comma
[ExcludeFromCodeCoverage]
public class RecoverPasswordCommandValidatorTests
{
private readonly RecoverPasswordCommandValidator _validator;
private readonly RecoverPasswordCommandFixture _recoverPasswordCommandFixture;
/// <summary>
/// Initializes a new instance of the <see cref="RecoverPasswordCommandValidatorTests"/> class.
/// </summary>
public RecoverPasswordCommandValidatorTests()
{
_validator = new RecoverPasswordCommandValidator();
_recoverPasswordCommandFixture = new RecoverPasswordCommandFixture();
}
private readonly RecoverPasswordCommandValidator _validator = new();
private readonly RecoverPasswordCommandFixture _recoverPasswordCommandFixture = new();
[Fact]
public void Validate_WhenUsernameIsNull_ShouldHaveValidationError()
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authentication.Comma
[ExcludeFromCodeCoverage]
public class RegisterUserCommandValidatorTests
{
private readonly RegisterUserCommandValidator _validator;
private readonly RegisterUserCommandFixture _registerUserCommandFixture;
/// <summary>
/// Initializes a new instance of the <see cref="RegisterUserCommandValidatorTests"/> class.
/// </summary>
public RegisterUserCommandValidatorTests()
{
_validator = new RegisterUserCommandValidator();
_registerUserCommandFixture = new RegisterUserCommandFixture();
}
private readonly RegisterUserCommandValidator _validator = new();
private readonly RegisterUserCommandFixture _registerUserCommandFixture = new();
[Fact]
public void Validate_WhenUsernameIsNull_ShouldHaveValidationError()
@@ -33,7 +33,7 @@ public class GetUsersQueryHandlerTests
private readonly IUserRepository _mockUserRepository;
private readonly GetUsersQueryHandler _sut;
private readonly UserEntityFixture _userEntityFixture = new();
private readonly GetUsersQueryFixture _getUsersQueryFixture;
private readonly GetUsersQueryFixture _getUsersQueryFixture = new();
private readonly Guid _userId;
/// <summary>
@@ -45,7 +45,6 @@ public class GetUsersQueryHandlerTests
_mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>();
_mockUserRepository = Substitute.For<IUserRepository>();
_getUsersQueryFixture = new GetUsersQueryFixture();
_userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId);
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authentication.Queri
[ExcludeFromCodeCoverage]
public class LoginUserQueryValidatorTests
{
private readonly LoginUserQueryValidator _validator;
private readonly LoginUserQueryFixture _loginUserQueryFixture;
/// <summary>
/// Initializes a new instance of the <see cref="LoginUserQueryValidatorTests"/> class.
/// </summary>
public LoginUserQueryValidatorTests()
{
_validator = new LoginUserQueryValidator();
_loginUserQueryFixture = new LoginUserQueryFixture();
}
private readonly LoginUserQueryValidator _validator = new();
private readonly LoginUserQueryFixture _loginUserQueryFixture = new();
[Fact]
public void Validate_WhenUsernameIsNull_ShouldHaveValidationError()
@@ -40,7 +40,7 @@ public class UpdateUserRoleAndPermissionsCommandHandlerTests
private readonly IPermissionRepository _mockPermissionRepository;
private readonly UpdateUserRoleAndPermissionsCommandHandler _sut;
private readonly UserEntityFixture _userEntityFixture = new();
private readonly UpdateUserRoleAndPermissionsCommandFixture _updateUserRoleAndPermissionsCommandFixture;
private readonly UpdateUserRoleAndPermissionsCommandFixture _updateUserRoleAndPermissionsCommandFixture = new();
private readonly Guid _userId;
/// <summary>
@@ -54,7 +54,6 @@ public class UpdateUserRoleAndPermissionsCommandHandlerTests
_mockUserRepository = Substitute.For<IUserRepository>();
_mockRoleRepository = Substitute.For<IRoleRepository>();
_mockPermissionRepository = Substitute.For<IPermissionRepository>();
_updateUserRoleAndPermissionsCommandFixture = new UpdateUserRoleAndPermissionsCommandFixture();
_userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId);
@@ -17,15 +17,7 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authorization.Comman
[ExcludeFromCodeCoverage]
public class UpdateUserRoleAndPermissionsCommandValidatorTests
{
private readonly UpdateUserRoleAndPermissionsCommandValidator _validator;
/// <summary>
/// Initializes a new instance of the <see cref="UpdateUserRoleAndPermissionsCommandValidatorTests"/> class.
/// </summary>
public UpdateUserRoleAndPermissionsCommandValidatorTests()
{
_validator = new UpdateUserRoleAndPermissionsCommandValidator();
}
private readonly UpdateUserRoleAndPermissionsCommandValidator _validator = new();
[Fact]
public void Validate_WhenUserIdIsEmpty_ShouldHaveValidationError()
@@ -27,8 +27,8 @@ public class GetAuthorizationQueryHandlerTests
private readonly IAuthorizationService _mockAuthorizationService;
private readonly ICurrentUserService _mockCurrentUserService;
private readonly GetAuthorizationQueryHandler _sut;
private readonly GetAuthorizationQueryFixture _getAuthorizationQueryFixture;
private readonly UserAuthorizationEntityFixture _userAuthorizationEntityFixture;
private readonly GetAuthorizationQueryFixture _getAuthorizationQueryFixture = new();
private readonly UserAuthorizationEntityFixture _userAuthorizationEntityFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetAuthorizationQueryHandlerTests"/> class.
@@ -37,8 +37,6 @@ public class GetAuthorizationQueryHandlerTests
{
_mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>();
_getAuthorizationQueryFixture = new GetAuthorizationQueryFixture();
_userAuthorizationEntityFixture = new UserAuthorizationEntityFixture();
IValidator<GetAuthorizationQuery> mockValidator = Substitute.For<IValidator<GetAuthorizationQuery>>();
mockValidator.Validate(Arg.Any<GetAuthorizationQuery>())
.Returns([]);
@@ -17,17 +17,8 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authorization.Querie
[ExcludeFromCodeCoverage]
public class GetAuthorizationQueryValidatorTests
{
private readonly GetAuthorizationQueryValidator _validator;
private readonly GetAuthorizationQueryFixture _getAuthorizationQueryFixture;
/// <summary>
/// Initializes a new instance of the <see cref="GetAuthorizationQueryValidatorTests"/> class.
/// </summary>
public GetAuthorizationQueryValidatorTests()
{
_validator = new GetAuthorizationQueryValidator();
_getAuthorizationQueryFixture = new GetAuthorizationQueryFixture();
}
private readonly GetAuthorizationQueryValidator _validator = new();
private readonly GetAuthorizationQueryFixture _getAuthorizationQueryFixture = new();
[Fact]
public void Validate_WhenUserIdIsNull_ShouldHaveValidationError()
@@ -33,7 +33,7 @@ public class GetUserPermissionsQueryHandlerTests
private readonly ICurrentUserService _mockCurrentUserService;
private readonly IUserRepository _mockUserRepository;
private readonly GetUserPermissionsQueryHandler _sut;
private readonly GetUserPermissionsQueryFixture _getUserPermissionsQueryFixture;
private readonly GetUserPermissionsQueryFixture _getUserPermissionsQueryFixture = new();
private readonly Guid _userId;
/// <summary>
@@ -45,7 +45,6 @@ public class GetUserPermissionsQueryHandlerTests
_mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>();
_mockUserRepository = Substitute.For<IUserRepository>();
_getUserPermissionsQueryFixture = new GetUserPermissionsQueryFixture();
_userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId);
@@ -16,15 +16,7 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authorization.Querie
[ExcludeFromCodeCoverage]
public class GetUserPermissionsQueryValidatorTests
{
private readonly GetUserPermissionsQueryValidator _validator;
/// <summary>
/// Initializes a new instance of the <see cref="GetUserPermissionsQueryValidatorTests"/> class.
/// </summary>
public GetUserPermissionsQueryValidatorTests()
{
_validator = new GetUserPermissionsQueryValidator();
}
private readonly GetUserPermissionsQueryValidator _validator = new();
[Fact]
public void Validate_WhenUserIdIsNull_ShouldHaveValidationError()
@@ -32,7 +32,7 @@ public class GetUserRoleQueryHandlerTests
private readonly IUserRepository _mockUserRepository;
private readonly GetUserRoleQueryHandler _sut;
private readonly UserEntityFixture _userEntityFixture = new();
private readonly GetUserRoleQueryFixture _getUserRoleQueryFixture;
private readonly GetUserRoleQueryFixture _getUserRoleQueryFixture = new();
private readonly Guid _userId;
/// <summary>
@@ -44,7 +44,6 @@ public class GetUserRoleQueryHandlerTests
_mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>();
_mockUserRepository = Substitute.For<IUserRepository>();
_getUserRoleQueryFixture = new GetUserRoleQueryFixture();
_userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId);
@@ -16,15 +16,7 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authorization.Querie
[ExcludeFromCodeCoverage]
public class GetUserRoleQueryValidatorTests
{
private readonly GetUserRoleQueryValidator _validator;
/// <summary>
/// Initializes a new instance of the <see cref="GetUserRoleQueryValidatorTests"/> class.
/// </summary>
public GetUserRoleQueryValidatorTests()
{
_validator = new GetUserRoleQueryValidator();
}
private readonly GetUserRoleQueryValidator _validator = new();
[Fact]
public void Validate_WhenUserIdIsNull_ShouldHaveValidationError()