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

@@ -15,15 +15,7 @@ namespace Lumina.Application.Fixtures.Common.DataAccess.Entities.Authorization;
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class RolePermissionEntityFixture public class RolePermissionEntityFixture
{ {
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="RolePermissionEntityFixture"/> class.
/// </summary>
public RolePermissionEntityFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="RolePermissionEntity"/>. /// Creates a random valid <see cref="RolePermissionEntity"/>.
@@ -18,15 +18,7 @@ namespace Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Wr
public class BookEntityFixture public class BookEntityFixture
{ {
private readonly Random _random = new(); private readonly Random _random = new();
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="BookEntityFixture"/> class.
/// </summary>
public BookEntityFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="BookEntity"/>. /// Creates a random valid <see cref="BookEntity"/>.
@@ -17,15 +17,7 @@ namespace Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Wr
public class BookRatingEntityFixture public class BookRatingEntityFixture
{ {
private readonly Random _random = new(); private readonly Random _random = new();
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="BookRatingEntityFixture"/> class.
/// </summary>
public BookRatingEntityFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a <see cref="BookRatingEntity"/>. /// Creates a <see cref="BookRatingEntity"/>.
@@ -21,19 +21,17 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.WrittenContentLibrary.Bo
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class AddBookCommandFixture public class AddBookCommandFixture
{ {
private readonly Fixture _fixture; private readonly Fixture _fixture = new();
private readonly Random _random = new(); private readonly Random _random = new();
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="AddBookCommandFixture"/> class. /// Initializes a new instance of the <see cref="AddBookCommandFixture"/> class.
/// </summary> /// </summary>
public AddBookCommandFixture() public AddBookCommandFixture()
{ {
_fixture = new Fixture();
_fixture.Customizations.Add(new DateOnlySpecimenBuilder()); _fixture.Customizations.Add(new DateOnlySpecimenBuilder());
_fixture.Customizations.Add(new NullableDateOnlySpecimenBuilder()); _fixture.Customizations.Add(new NullableDateOnlySpecimenBuilder());
_faker = new Faker();
} }
/// <summary> /// <summary>
@@ -16,17 +16,9 @@ namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class BookRatingDtoFixture public class BookRatingDtoFixture
{ {
private readonly Fixture _fixture; private readonly Fixture _fixture = new();
private readonly Random _random = new(); private readonly Random _random = new();
/// <summary>
/// Initializes a new instance of the <see cref="BookRatingDtoFixture"/> class.
/// </summary>
public BookRatingDtoFixture()
{
_fixture = new Fixture();
}
/// <summary> /// <summary>
/// Creates a <see cref="BookRatingDto"/>. /// Creates a <see cref="BookRatingDto"/>.
/// </summary> /// </summary>
@@ -14,15 +14,7 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.Authentication;
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class ChangePasswordRequestFixture public class ChangePasswordRequestFixture
{ {
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="ChangePasswordRequestFixture"/> class.
/// </summary>
public ChangePasswordRequestFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="ChangePasswordRequest"/>. /// Creates a random valid <see cref="ChangePasswordRequest"/>.
@@ -14,15 +14,7 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.Authentication;
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class LoginRequestFixture public class LoginRequestFixture
{ {
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="LoginRequestFixture"/> class.
/// </summary>
public LoginRequestFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="LoginRequest"/>. /// Creates a random valid <see cref="LoginRequest"/>.
@@ -14,15 +14,7 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.Authentication;
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class RecoverPasswordRequestFixture public class RecoverPasswordRequestFixture
{ {
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="RecoverPasswordRequestFixture"/> class.
/// </summary>
public RecoverPasswordRequestFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="RecoverPasswordRequest"/>. /// Creates a random valid <see cref="RecoverPasswordRequest"/>.
@@ -14,15 +14,7 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.Authentication;
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class RegistrationRequestFixture public class RegistrationRequestFixture
{ {
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="RegistrationRequestFixture"/> class.
/// </summary>
public RegistrationRequestFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="RegistrationRequest"/>. /// Creates a random valid <see cref="RegistrationRequest"/>.
@@ -21,19 +21,17 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLib
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class AddBookRequestFixture public class AddBookRequestFixture
{ {
private readonly Fixture _fixture; private readonly Fixture _fixture = new();
private readonly Random _random = new(); private readonly Random _random = new();
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="AddBookRequestFixture"/> class. /// Initializes a new instance of the <see cref="AddBookRequestFixture"/> class.
/// </summary> /// </summary>
public AddBookRequestFixture() public AddBookRequestFixture()
{ {
_fixture = new Fixture();
_fixture.Customizations.Add(new DateOnlySpecimenBuilder()); _fixture.Customizations.Add(new DateOnlySpecimenBuilder());
_fixture.Customizations.Add(new NullableDateOnlySpecimenBuilder()); _fixture.Customizations.Add(new NullableDateOnlySpecimenBuilder());
_faker = new Faker();
} }
/// <summary> /// <summary>
@@ -18,15 +18,7 @@ namespace Lumina.Domain.Fixtures.Core.BoundedContexts.FileSystemManagementBounde
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class DirectoryFixture public class DirectoryFixture
{ {
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="DirectoryFixture"/> class.
/// </summary>
public DirectoryFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="Directory"/>. /// Creates a random valid <see cref="Directory"/>.
@@ -17,15 +17,7 @@ namespace Lumina.Domain.Fixtures.Core.BoundedContexts.FileSystemManagementBounde
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class FileFixture public class FileFixture
{ {
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="FileFixture"/> class.
/// </summary>
public FileFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="File"/>. /// Creates a random valid <see cref="File"/>.
@@ -16,15 +16,7 @@ namespace Lumina.Domain.Fixtures.Core.BoundedContexts.FileSystemManagementBounde
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class FileSystemPathIdFixture public class FileSystemPathIdFixture
{ {
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemPathIdFixture"/> class.
/// </summary>
public FileSystemPathIdFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="FileSystemPathId"/>. /// Creates a random valid <see cref="FileSystemPathId"/>.
@@ -16,15 +16,7 @@ namespace Lumina.Domain.Fixtures.Core.BoundedContexts.FileSystemManagementBounde
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class PathSegmentFixture public class PathSegmentFixture
{ {
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="PathSegmentFixture"/> class.
/// </summary>
public PathSegmentFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="PathSegment"/>. /// Creates a random valid <see cref="PathSegment"/>.
@@ -16,15 +16,7 @@ namespace Lumina.Domain.Fixtures.Core.BoundedContexts.FileSystemManagementBounde
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class StreamInfoFixture public class StreamInfoFixture
{ {
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="StreamInfoFixture"/> class.
/// </summary>
public StreamInfoFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="StreamInfo"/>. /// Creates a random valid <see cref="StreamInfo"/>.
@@ -15,15 +15,7 @@ namespace Lumina.Domain.Fixtures.Core.BoundedContexts.FileSystemManagementBounde
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class ThumbnailFixture public class ThumbnailFixture
{ {
private readonly Faker _faker; private readonly Faker _faker = new();
/// <summary>
/// Initializes a new instance of the <see cref="ThumbnailFixture"/> class.
/// </summary>
public ThumbnailFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="Thumbnail"/>. /// Creates a random valid <see cref="Thumbnail"/>.
@@ -20,17 +20,9 @@ namespace Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedCo
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class LibraryFixture public class LibraryFixture
{ {
private readonly Faker _faker; private readonly Faker _faker = new();
private readonly Random _random = new(); private readonly Random _random = new();
/// <summary>
/// Initializes a new instance of the <see cref="LibraryFixture"/> class.
/// </summary>
public LibraryFixture()
{
_faker = new Faker();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="Library"/> domain aggregate. /// Creates a random valid <see cref="Library"/> domain aggregate.
/// </summary> /// </summary>
@@ -24,20 +24,17 @@ namespace Lumina.Domain.Fixtures.Core.BoundedContexts.WrittenContentLibraryBound
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class BookFixture public class BookFixture
{ {
private readonly Fixture _fixture; private readonly Fixture _fixture = new();
private readonly IsbnFixture _isbnFixture; private readonly IsbnFixture _isbnFixture = new();
private readonly BookRatingFixture _bookRatingFixture; private readonly BookRatingFixture _bookRatingFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="BookFixture"/> class. /// Initializes a new instance of the <see cref="BookFixture"/> class.
/// </summary> /// </summary>
public BookFixture() public BookFixture()
{ {
_fixture = new Fixture();
_fixture.Customizations.Add(new DateOnlySpecimenBuilder()); _fixture.Customizations.Add(new DateOnlySpecimenBuilder());
_fixture.Customizations.Add(new NullableDateOnlySpecimenBuilder()); _fixture.Customizations.Add(new NullableDateOnlySpecimenBuilder());
_isbnFixture = new IsbnFixture();
_bookRatingFixture = new BookRatingFixture();
ConfigureCustomDomainTypes(); ConfigureCustomDomainTypes();
} }
@@ -16,17 +16,9 @@ namespace Lumina.Domain.Fixtures.Core.BoundedContexts.WrittenContentLibraryBound
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class BookRatingFixture public class BookRatingFixture
{ {
private readonly Fixture _fixture; private readonly Fixture _fixture = new();
private readonly Random _random = new(); private readonly Random _random = new();
/// <summary>
/// Initializes a new instance of the <see cref="BookRatingFixture"/> class.
/// </summary>
public BookRatingFixture()
{
_fixture = new Fixture();
}
/// <summary> /// <summary>
/// Creates a random valid <see cref="BookRating"/>. /// Creates a random valid <see cref="BookRating"/>.
/// </summary> /// </summary>
@@ -25,7 +25,7 @@ namespace Lumina.Presentation.Api.IntegrationTests.Common.Setup;
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class AuthenticatedLuminaApiFactory : LuminaApiFactory, IDisposable public class AuthenticatedLuminaApiFactory : LuminaApiFactory, IDisposable
{ {
private readonly PasswordHashService _hashService; private readonly PasswordHashService _hashService = new();
private readonly JsonSerializerOptions _jsonOptions = new() private readonly JsonSerializerOptions _jsonOptions = new()
{ {
PropertyNameCaseInsensitive = true PropertyNameCaseInsensitive = true
@@ -36,14 +36,6 @@ public class AuthenticatedLuminaApiFactory : LuminaApiFactory, IDisposable
/// </summary> /// </summary>
public string? TestUsername { get; private set; } public string? TestUsername { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="AuthenticatedLuminaApiFactory"/> class.
/// </summary>
public AuthenticatedLuminaApiFactory()
{
_hashService = new PasswordHashService();
}
/// <summary> /// <summary>
/// Creates an HTTP client with authentication headers and a test user /// Creates an HTTP client with authentication headers and a test user
/// </summary> /// </summary>
@@ -32,9 +32,9 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
{ {
private HttpClient _client; private HttpClient _client;
private readonly AuthenticatedLuminaApiFactory _apiFactory; private readonly AuthenticatedLuminaApiFactory _apiFactory;
private readonly PasswordHashService _hashService; private readonly PasswordHashService _hashService = new();
private readonly ICryptographyService _cryptographyService; private readonly ICryptographyService _cryptographyService;
private readonly TotpTokenGenerator _totpTokenGenerator; private readonly TotpTokenGenerator _totpTokenGenerator = new();
private readonly JsonSerializerOptions _jsonOptions = new() private readonly JsonSerializerOptions _jsonOptions = new()
{ {
PropertyNameCaseInsensitive = true, PropertyNameCaseInsensitive = true,
@@ -50,8 +50,6 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
{ {
_client = apiFactory.CreateClient(); _client = apiFactory.CreateClient();
_apiFactory = apiFactory; _apiFactory = apiFactory;
_hashService = new PasswordHashService();
_totpTokenGenerator = new TotpTokenGenerator();
_testUsername = $"testuser_{Guid.NewGuid()}"; _testUsername = $"testuser_{Guid.NewGuid()}";
using IServiceScope scope = apiFactory.Services.CreateScope(); using IServiceScope scope = apiFactory.Services.CreateScope();
@@ -34,9 +34,9 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
{ {
private HttpClient _client; private HttpClient _client;
private readonly AuthenticatedLuminaApiFactory _apiFactory; private readonly AuthenticatedLuminaApiFactory _apiFactory;
private readonly PasswordHashService _hashService; private readonly PasswordHashService _hashService = new();
private readonly ICryptographyService _cryptographyService; private readonly ICryptographyService _cryptographyService;
private readonly TotpTokenGenerator _totpTokenGenerator; private readonly TotpTokenGenerator _totpTokenGenerator = new();
private readonly JsonSerializerOptions _jsonOptions = new() private readonly JsonSerializerOptions _jsonOptions = new()
{ {
PropertyNameCaseInsensitive = true, PropertyNameCaseInsensitive = true,
@@ -52,8 +52,6 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
{ {
_client = apiFactory.CreateClient(); _client = apiFactory.CreateClient();
_apiFactory = apiFactory; _apiFactory = apiFactory;
_hashService = new PasswordHashService();
_totpTokenGenerator = new TotpTokenGenerator();
_testUsername = $"testuser_{Guid.NewGuid()}"; _testUsername = $"testuser_{Guid.NewGuid()}";
// get the encryption service with the test key from factory // get the encryption service with the test key from factory
@@ -39,7 +39,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
new BookJsonConverter() new BookJsonConverter()
} }
}; };
private readonly AddBookRequestFixture _requestBookFixture; private readonly AddBookRequestFixture _requestBookFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="AddBookEndpointTests"/> class. /// Initializes a new instance of the <see cref="AddBookEndpointTests"/> class.
@@ -49,7 +49,6 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
{ {
_client = apiFactory.CreateClient(); _client = apiFactory.CreateClient();
_apiFactory = apiFactory; _apiFactory = apiFactory;
_requestBookFixture = new AddBookRequestFixture();
} }
/// <summary> /// <summary>
@@ -25,7 +25,7 @@ public class ChangePasswordEndpointTests : IClassFixture<LuminaApiFactory>, IDis
{ {
private readonly LuminaApiFactory _apiFactory; private readonly LuminaApiFactory _apiFactory;
private readonly HttpClient _client; private readonly HttpClient _client;
private readonly PasswordHashService _hashService; private readonly PasswordHashService _hashService = new();
private readonly string _testUsername; private readonly string _testUsername;
private readonly JsonSerializerOptions _jsonOptions = new() private readonly JsonSerializerOptions _jsonOptions = new()
{ {
@@ -42,7 +42,6 @@ public class ChangePasswordEndpointTests : IClassFixture<LuminaApiFactory>, IDis
_client = apiFactory.CreateClient(); _client = apiFactory.CreateClient();
_client.DefaultRequestHeaders.Clear(); _client.DefaultRequestHeaders.Clear();
_client.DefaultRequestHeaders.Add("X-Forwarded-For", $"192.168.1.12"); _client.DefaultRequestHeaders.Add("X-Forwarded-For", $"192.168.1.12");
_hashService = new PasswordHashService();
_testUsername = $"testuser_{Guid.NewGuid()}"; _testUsername = $"testuser_{Guid.NewGuid()}";
} }
@@ -26,9 +26,9 @@ namespace Lumina.Presentation.Api.SecurityTests.Core.Endpoints.UsersManagement.A
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class LoginEndpointTests : IClassFixture<LuminaApiFactory>, IDisposable public class LoginEndpointTests : IClassFixture<LuminaApiFactory>, IDisposable
{ {
private readonly PasswordHashService _hashService; private readonly PasswordHashService _hashService = new();
private readonly ICryptographyService _cryptographyService; private readonly ICryptographyService _cryptographyService;
private readonly TotpTokenGenerator _totpTokenGenerator; private readonly TotpTokenGenerator _totpTokenGenerator = new();
private readonly LuminaApiFactory _apiFactory; private readonly LuminaApiFactory _apiFactory;
private readonly HttpClient _client; private readonly HttpClient _client;
private readonly JsonSerializerOptions _jsonOptions = new() private readonly JsonSerializerOptions _jsonOptions = new()
@@ -49,8 +49,6 @@ public class LoginEndpointTests : IClassFixture<LuminaApiFactory>, IDisposable
// set a fake IP for this test instance // set a fake IP for this test instance
_client.DefaultRequestHeaders.Clear(); _client.DefaultRequestHeaders.Clear();
_client.DefaultRequestHeaders.Add("X-Forwarded-For", $"192.168.1.1"); _client.DefaultRequestHeaders.Add("X-Forwarded-For", $"192.168.1.1");
_hashService = new PasswordHashService();
_totpTokenGenerator = new TotpTokenGenerator();
_testUsername = $"testuser_{Guid.NewGuid()}"; _testUsername = $"testuser_{Guid.NewGuid()}";
using IServiceScope scope = apiFactory.Services.CreateScope(); using IServiceScope scope = apiFactory.Services.CreateScope();
@@ -22,7 +22,7 @@ namespace Lumina.Presentation.Api.SecurityTests.Core.Endpoints.UsersManagement.A
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class RegisterEndpointTests : IClassFixture<LuminaApiFactory>, IDisposable public class RegisterEndpointTests : IClassFixture<LuminaApiFactory>, IDisposable
{ {
private readonly PasswordHashService _hashService; private readonly PasswordHashService _hashService = new();
private readonly LuminaApiFactory _apiFactory; private readonly LuminaApiFactory _apiFactory;
private readonly HttpClient _client; private readonly HttpClient _client;
private readonly JsonSerializerOptions _jsonOptions = new() private readonly JsonSerializerOptions _jsonOptions = new()
@@ -38,7 +38,6 @@ public class RegisterEndpointTests : IClassFixture<LuminaApiFactory>, IDisposabl
_client = apiFactory.CreateClient(); _client = apiFactory.CreateClient();
_client.DefaultRequestHeaders.Clear(); _client.DefaultRequestHeaders.Clear();
_client.DefaultRequestHeaders.Add("X-Forwarded-For", $"192.168.1.5"); _client.DefaultRequestHeaders.Add("X-Forwarded-For", $"192.168.1.5");
_hashService = new PasswordHashService();
_testUsername = $"testuser_{Guid.NewGuid()}"; _testUsername = $"testuser_{Guid.NewGuid()}";
} }
@@ -14,15 +14,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.Authentication;
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class ChangePasswordRequestMappingTests public class ChangePasswordRequestMappingTests
{ {
private readonly ChangePasswordRequestFixture _fixture; private readonly ChangePasswordRequestFixture _fixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="ChangePasswordRequestMappingTests"/> class.
/// </summary>
public ChangePasswordRequestMappingTests()
{
_fixture = new();
}
[Fact] [Fact]
public void ToCommand_WhenMappingRequest_ShouldMapCorrectly() public void ToCommand_WhenMappingRequest_ShouldMapCorrectly()
@@ -14,15 +14,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.Authentication;
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class LoginRequestMappingTests public class LoginRequestMappingTests
{ {
private readonly LoginRequestFixture _fixture; private readonly LoginRequestFixture _fixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="LoginRequestMappingTests"/> class.
/// </summary>
public LoginRequestMappingTests()
{
_fixture = new();
}
[Fact] [Fact]
public void ToQuery_WhenMappingRequest_ShouldMapCorrectly() public void ToQuery_WhenMappingRequest_ShouldMapCorrectly()
@@ -14,15 +14,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.Authentication;
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class RecoverPasswordRequestMappingTests public class RecoverPasswordRequestMappingTests
{ {
private readonly RecoverPasswordRequestFixture _fixture; private readonly RecoverPasswordRequestFixture _fixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="RecoverPasswordRequestMappingTests"/> class.
/// </summary>
public RecoverPasswordRequestMappingTests()
{
_fixture = new();
}
[Fact] [Fact]
public void ToCommand_WhenMappingRequest_ShouldMapCorrectly() public void ToCommand_WhenMappingRequest_ShouldMapCorrectly()
@@ -15,15 +15,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.Authentication;
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class RegistrationRequestMappingTests public class RegistrationRequestMappingTests
{ {
private readonly RegistrationRequestFixture _fixture; private readonly RegistrationRequestFixture _fixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="RegistrationRequestMappingTests"/> class.
/// </summary>
public RegistrationRequestMappingTests()
{
_fixture = new();
}
[Fact] [Fact]
public void ToSetupCommand_WhenMappingRequest_ShouldMapCorrectly() public void ToSetupCommand_WhenMappingRequest_ShouldMapCorrectly()
@@ -16,15 +16,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.FileSystemManagement.Commo
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class FileSystemTreeNodeResponseMappingTests public class FileSystemTreeNodeResponseMappingTests
{ {
private readonly FileSystemTreeNodeResponseFixture _fileSystemTreeNodeResponseFixture; private readonly FileSystemTreeNodeResponseFixture _fileSystemTreeNodeResponseFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemTreeNodeResponseMappingTests"/> class.
/// </summary>
public FileSystemTreeNodeResponseMappingTests()
{
_fileSystemTreeNodeResponseFixture = new();
}
[Fact] [Fact]
public void ToWindowsRootItem_WhenMappingFileSystemTreeNodeResponse_ShouldMapCorrectly() public void ToWindowsRootItem_WhenMappingFileSystemTreeNodeResponse_ShouldMapCorrectly()
@@ -18,15 +18,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.FileSystemManagement.Direc
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class DirectoryMappingTests public class DirectoryMappingTests
{ {
private readonly DirectoryFixture _directoryFixture; private readonly DirectoryFixture _directoryFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="DirectoryMappingTests"/> class.
/// </summary>
public DirectoryMappingTests()
{
_directoryFixture = new DirectoryFixture();
}
[Fact] [Fact]
public void ToFileSystemTreeNodeResponse_WhenMappingDirectory_ShouldMapCorrectly() public void ToFileSystemTreeNodeResponse_WhenMappingDirectory_ShouldMapCorrectly()
@@ -23,23 +23,11 @@ namespace Lumina.Application.UnitTests.Common.Mapping.FileSystemManagement.FileS
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class FileSystemItemMappingTests public class FileSystemItemMappingTests
{ {
private readonly FileSystemPathIdFixture _fileSystemPathIdFixture; private readonly FileSystemPathIdFixture _fileSystemPathIdFixture = new();
private readonly DirectoryFixture _directoryFixture; private readonly DirectoryFixture _directoryFixture = new();
private readonly FileFixture _fileFixture; private readonly FileFixture _fileFixture = new();
private readonly WindowsRootItemFixture _windowsRootItemFixture; private readonly WindowsRootItemFixture _windowsRootItemFixture = new();
private readonly UnixRootItemFixture _unixRootItemFixture; private readonly UnixRootItemFixture _unixRootItemFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemItemMappingTests"/> class.
/// </summary>
public FileSystemItemMappingTests()
{
_fileSystemPathIdFixture = new FileSystemPathIdFixture();
_directoryFixture = new DirectoryFixture();
_fileFixture = new FileFixture();
_windowsRootItemFixture = new WindowsRootItemFixture();
_unixRootItemFixture = new UnixRootItemFixture();
}
[Fact] [Fact]
public void ToFileSystemItemModel_WhenMappingFileSystemItem_ShouldMapCorrectly() public void ToFileSystemItemModel_WhenMappingFileSystemItem_ShouldMapCorrectly()
@@ -18,15 +18,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.FileSystemManagement.Files
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class FileMappingTests public class FileMappingTests
{ {
private readonly FileFixture _fileFixture; private readonly FileFixture _fileFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="FileMappingTests"/> class.
/// </summary>
public FileMappingTests()
{
_fileFixture = new();
}
[Fact] [Fact]
public void ToFileSystemTreeNodeResponse_WhenMappingFile_ShouldMapCorrectly() public void ToFileSystemTreeNodeResponse_WhenMappingFile_ShouldMapCorrectly()
@@ -16,13 +16,6 @@ public class GetFilesRequestMappingTests
{ {
private readonly GetFilesRequestFixture _getFilesRequestFixture = new(); private readonly GetFilesRequestFixture _getFilesRequestFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetFilesRequestMappingTests"/> class.
/// </summary>
public GetFilesRequestMappingTests()
{
}
[Fact] [Fact]
public void ToQuery_WhenMappingGetFilesRequest_ShouldMapCorrectly() public void ToQuery_WhenMappingGetFilesRequest_ShouldMapCorrectly()
{ {
@@ -16,13 +16,6 @@ public class GetTreeFilesRequestMappingTests
{ {
private readonly GetTreeFilesRequestFixture _getTreeFilesRequestFixture = new(); private readonly GetTreeFilesRequestFixture _getTreeFilesRequestFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetTreeFilesRequestMappingTests"/> class.
/// </summary>
public GetTreeFilesRequestMappingTests()
{
}
[Fact] [Fact]
public void ToQuery_WhenMappingGetTreeFilesRequest_ShouldMapCorrectly() public void ToQuery_WhenMappingGetTreeFilesRequest_ShouldMapCorrectly()
{ {
@@ -18,13 +18,6 @@ public class CheckPathExistsRequestMappingTests
{ {
private readonly CheckPathExistsRequestFixture _checkPathExistsRequestFixture = new(); private readonly CheckPathExistsRequestFixture _checkPathExistsRequestFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="CheckPathExistsRequestMappingTests"/> class.
/// </summary>
public CheckPathExistsRequestMappingTests()
{
}
[Fact] [Fact]
public void ToQuery_WhenMappingCheckPathExistsRequest_ShouldMapCorrectly() public void ToQuery_WhenMappingCheckPathExistsRequest_ShouldMapCorrectly()
{ {
@@ -18,13 +18,6 @@ public class CombinePathRequestMappingTests
{ {
private readonly CombinePathRequestFixture _combinePathRequestFixture = new(); private readonly CombinePathRequestFixture _combinePathRequestFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="CombinePathRequestMappingTests"/> class.
/// </summary>
public CombinePathRequestMappingTests()
{
}
[Fact] [Fact]
public void ToCommand_WhenMappingCombinePathRequest_ShouldMapCorrectly() public void ToCommand_WhenMappingCombinePathRequest_ShouldMapCorrectly()
{ {
@@ -18,13 +18,6 @@ public class GetPathParentRequestMappingTests
{ {
private readonly GetPathParentRequestFixture _getPathParentRequestFixture = new(); private readonly GetPathParentRequestFixture _getPathParentRequestFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetPathParentRequestMappingTests"/> class.
/// </summary>
public GetPathParentRequestMappingTests()
{
}
[Fact] [Fact]
public void ToQuery_WhenMappingGetPathParentRequest_ShouldMapCorrectly() public void ToQuery_WhenMappingGetPathParentRequest_ShouldMapCorrectly()
{ {
@@ -18,13 +18,6 @@ public class GetPathRootRequestMappingTests
{ {
private readonly GetPathRootRequestFixture _getPathRootRequestFixture = new(); private readonly GetPathRootRequestFixture _getPathRootRequestFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetPathRootRequestMappingTests"/> class.
/// </summary>
public GetPathRootRequestMappingTests()
{
}
[Fact] [Fact]
public void ToQuery_WhenMappingGetPathRootRequest_ShouldMapCorrectly() public void ToQuery_WhenMappingGetPathRootRequest_ShouldMapCorrectly()
{ {
@@ -18,13 +18,6 @@ public class SplitPathRequestMappingTests
{ {
private readonly SplitPathRequestFixture _splitPathRequestFixture = new(); private readonly SplitPathRequestFixture _splitPathRequestFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="SplitPathRequestMappingTests"/> class.
/// </summary>
public SplitPathRequestMappingTests()
{
}
[Fact] [Fact]
public void ToCommand_WhenMappingSplitPathRequest_ShouldMapCorrectly() public void ToCommand_WhenMappingSplitPathRequest_ShouldMapCorrectly()
{ {
@@ -18,13 +18,6 @@ public class ValidatePathRequestMappingTests
{ {
private readonly ValidatePathRequestFixture _validatePathRequestFixture = new(); private readonly ValidatePathRequestFixture _validatePathRequestFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="ValidatePathRequestMappingTests"/> class.
/// </summary>
public ValidatePathRequestMappingTests()
{
}
[Fact] [Fact]
public void ToQuery_WhenMappingValidatePathRequest_ShouldMapCorrectly() public void ToQuery_WhenMappingValidatePathRequest_ShouldMapCorrectly()
{ {
@@ -18,13 +18,6 @@ public class GetThumbnailRequestMappingTests
{ {
private readonly GetThumbnailRequestFixture _getThumbnailRequestFixture = new(); private readonly GetThumbnailRequestFixture _getThumbnailRequestFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetThumbnailRequestMappingTests"/> class.
/// </summary>
public GetThumbnailRequestMappingTests()
{
}
[Fact] [Fact]
public void ToQuery_WhenMappingGetThumbnailRequest_ShouldMapCorrectly() public void ToQuery_WhenMappingGetThumbnailRequest_ShouldMapCorrectly()
{ {
@@ -18,15 +18,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.MediaLibrary.WrittenConten
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class AddBookRequestMappingTests public class AddBookRequestMappingTests
{ {
private readonly AddBookRequestFixture _requestFixture; private readonly AddBookRequestFixture _requestFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="AddBookRequestMappingTests"/> class.
/// </summary>
public AddBookRequestMappingTests()
{
_requestFixture = new AddBookRequestFixture();
}
[Fact] [Fact]
public void ToCommand_WhenMappingCompleteRequest_ShouldMapAllPropertiesCorrectly() public void ToCommand_WhenMappingCompleteRequest_ShouldMapAllPropertiesCorrectly()
@@ -20,15 +20,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.MediaLibrary.WrittenConten
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class BookEntityMappingTests public class BookEntityMappingTests
{ {
private readonly BookEntityFixture _bookEntityFixture; private readonly BookEntityFixture _bookEntityFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="BookEntityMappingTests"/> class.
/// </summary>
public BookEntityMappingTests()
{
_bookEntityFixture = new BookEntityFixture();
}
[Fact] [Fact]
public void ToDomainEntity_WhenMappingValidBookEntity_ShouldMapCorrectly() public void ToDomainEntity_WhenMappingValidBookEntity_ShouldMapCorrectly()
@@ -16,15 +16,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.MediaLibrary.WrittenConten
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class BookMappingTests public class BookMappingTests
{ {
private readonly BookFixture _bookFixture; private readonly BookFixture _bookFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="BookMappingTests"/> class.
/// </summary>
public BookMappingTests()
{
_bookFixture = new BookFixture();
}
[Fact] [Fact]
public void ToRepositoryEntity_WhenMappingCompleteBook_ShouldMapAllPropertiesCorrectly() public void ToRepositoryEntity_WhenMappingCompleteBook_ShouldMapAllPropertiesCorrectly()
@@ -18,15 +18,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.MediaLibrary.WrittenConten
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class BookRatingDtoMappingTests public class BookRatingDtoMappingTests
{ {
private readonly BookRatingDtoFixture _bookRatingDtoFixture; private readonly BookRatingDtoFixture _bookRatingDtoFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="BookRatingDtoMappingTests"/> class.
/// </summary>
public BookRatingDtoMappingTests()
{
_bookRatingDtoFixture = new BookRatingDtoFixture();
}
[Fact] [Fact]
public void ToDomainEntity_WhenMappingCompleteBookRatinDto_ShouldMapAllPropertiesCorrectly() public void ToDomainEntity_WhenMappingCompleteBookRatinDto_ShouldMapAllPropertiesCorrectly()
@@ -19,15 +19,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.MediaLibrary.WrittenConten
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class BookRatingEntityMappingTests public class BookRatingEntityMappingTests
{ {
private readonly BookRatingEntityFixture _fixture; private readonly BookRatingEntityFixture _fixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="BookRatingEntityMappingTests"/> class.
/// </summary>
public BookRatingEntityMappingTests()
{
_fixture = new BookRatingEntityFixture();
}
[Fact] [Fact]
public void ToResponse_WhenMappingValidBookRatingEntity_ShouldMapCorrectly() public void ToResponse_WhenMappingValidBookRatingEntity_ShouldMapCorrectly()
@@ -19,15 +19,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.MediaLibrary.WrittenConten
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class BookRatingMappingTests public class BookRatingMappingTests
{ {
private readonly BookRatingFixture _bookRatingFixture; private readonly BookRatingFixture _bookRatingFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="BookRatingMappingTests"/> class.
/// </summary>
public BookRatingMappingTests()
{
_bookRatingFixture = new BookRatingFixture();
}
[Fact] [Fact]
public void ToRepositoryEntity_WhenMappingCompleteBookRating_ShouldMapAllPropertiesCorrectly() public void ToRepositoryEntity_WhenMappingCompleteBookRating_ShouldMapAllPropertiesCorrectly()
@@ -19,15 +19,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.MediaLibrary.WrittenConten
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class IsbnDtoMappingTests public class IsbnDtoMappingTests
{ {
private readonly IsbnDtoFixture _isbnDtoFixture; private readonly IsbnDtoFixture _isbnDtoFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="IsbnDtoMappingTests"/> class.
/// </summary>
public IsbnDtoMappingTests()
{
_isbnDtoFixture = new IsbnDtoFixture();
}
[Fact] [Fact]
public void ToDomainEntity_WhenMappingValidIsbn10Dto_ShouldMapCorrectly() public void ToDomainEntity_WhenMappingValidIsbn10Dto_ShouldMapCorrectly()
@@ -18,15 +18,7 @@ namespace Lumina.Application.UnitTests.Common.Mapping.MediaLibrary.WrittenConten
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class IsbnMappingTests public class IsbnMappingTests
{ {
private readonly IsbnFixture _isbnFixture; private readonly IsbnFixture _isbnFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="IsbnMappingTests"/> class.
/// </summary>
public IsbnMappingTests()
{
_isbnFixture = new IsbnFixture();
}
[Fact] [Fact]
public void ToRepositoryEntity_WhenMappingIsbn10_ShouldMapCorrectly() public void ToRepositoryEntity_WhenMappingIsbn10_ShouldMapCorrectly()
@@ -32,7 +32,7 @@ public class AddRoleCommandHandlerTests
private readonly ICurrentUserService _mockCurrentUserService; private readonly ICurrentUserService _mockCurrentUserService;
private readonly IRoleRepository _mockRoleRepository; private readonly IRoleRepository _mockRoleRepository;
private readonly AddRoleCommandHandler _sut; private readonly AddRoleCommandHandler _sut;
private readonly AddRoleCommandFixture _addRoleCommandFixture; private readonly AddRoleCommandFixture _addRoleCommandFixture = new();
private readonly Guid _userId; private readonly Guid _userId;
/// <summary> /// <summary>
@@ -47,7 +47,6 @@ public class AddRoleCommandHandlerTests
_mockAuthorizationService = Substitute.For<IAuthorizationService>(); _mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>(); _mockCurrentUserService = Substitute.For<ICurrentUserService>();
_mockRoleRepository = Substitute.For<IRoleRepository>(); _mockRoleRepository = Substitute.For<IRoleRepository>();
_addRoleCommandFixture = new AddRoleCommandFixture();
_userId = Guid.NewGuid(); _userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId); _mockCurrentUserService.UserId.Returns(_userId);
@@ -17,17 +17,8 @@ namespace Lumina.Application.UnitTests.Core.Admin.Authorization.Roles.Commands.A
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class AddRoleCommandValidatorTests public class AddRoleCommandValidatorTests
{ {
private readonly AddRoleCommandValidator _validator; private readonly AddRoleCommandValidator _validator = new();
private readonly AddRoleCommandFixture _fixture; private readonly AddRoleCommandFixture _fixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="AddRoleCommandValidatorTests"/> class.
/// </summary>
public AddRoleCommandValidatorTests()
{
_validator = new AddRoleCommandValidator();
_fixture = new AddRoleCommandFixture();
}
[Fact] [Fact]
public void Validate_WhenRoleNameIsNull_ShouldHaveValidationError() public void Validate_WhenRoleNameIsNull_ShouldHaveValidationError()
@@ -29,7 +29,7 @@ public class DeleteRoleCommandHandlerTests
private readonly ICurrentUserService _mockCurrentUserService; private readonly ICurrentUserService _mockCurrentUserService;
private readonly IRoleRepository _mockRoleRepository; private readonly IRoleRepository _mockRoleRepository;
private readonly DeleteRoleCommandHandler _sut; private readonly DeleteRoleCommandHandler _sut;
private readonly DeleteRoleCommandFixture _deleteRoleCommandFixture; private readonly DeleteRoleCommandFixture _deleteRoleCommandFixture = new();
private readonly Guid _userId; private readonly Guid _userId;
/// <summary> /// <summary>
@@ -44,7 +44,6 @@ public class DeleteRoleCommandHandlerTests
_mockAuthorizationService = Substitute.For<IAuthorizationService>(); _mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>(); _mockCurrentUserService = Substitute.For<ICurrentUserService>();
_mockRoleRepository = Substitute.For<IRoleRepository>(); _mockRoleRepository = Substitute.For<IRoleRepository>();
_deleteRoleCommandFixture = new DeleteRoleCommandFixture();
_userId = Guid.NewGuid(); _userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId); _mockCurrentUserService.UserId.Returns(_userId);
@@ -16,15 +16,7 @@ namespace Lumina.Application.UnitTests.Core.Admin.Authorization.Roles.Commands.D
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class DeleteRoleCommandValidatorTests public class DeleteRoleCommandValidatorTests
{ {
private readonly DeleteRoleCommandValidator _validator; private readonly DeleteRoleCommandValidator _validator = new();
/// <summary>
/// Initializes a new instance of the <see cref="DeleteRoleCommandValidatorTests"/> class.
/// </summary>
public DeleteRoleCommandValidatorTests()
{
_validator = new DeleteRoleCommandValidator();
}
[Fact] [Fact]
public void Validate_WhenRoleIdIsEmpty_ShouldHaveValidationError() public void Validate_WhenRoleIdIsEmpty_ShouldHaveValidationError()
@@ -32,7 +32,7 @@ public class UpdateRoleCommandHandlerTests
private readonly ICurrentUserService _mockCurrentUserService; private readonly ICurrentUserService _mockCurrentUserService;
private readonly IRoleRepository _mockRoleRepository; private readonly IRoleRepository _mockRoleRepository;
private readonly UpdateRoleCommandHandler _sut; private readonly UpdateRoleCommandHandler _sut;
private readonly UpdateRoleCommandFixture _updateRoleCommandFixture; private readonly UpdateRoleCommandFixture _updateRoleCommandFixture = new();
private readonly Guid _userId; private readonly Guid _userId;
/// <summary> /// <summary>
@@ -47,7 +47,6 @@ public class UpdateRoleCommandHandlerTests
_mockAuthorizationService = Substitute.For<IAuthorizationService>(); _mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>(); _mockCurrentUserService = Substitute.For<ICurrentUserService>();
_mockRoleRepository = Substitute.For<IRoleRepository>(); _mockRoleRepository = Substitute.For<IRoleRepository>();
_updateRoleCommandFixture = new UpdateRoleCommandFixture();
_userId = Guid.NewGuid(); _userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId); _mockCurrentUserService.UserId.Returns(_userId);
@@ -17,17 +17,8 @@ namespace Lumina.Application.UnitTests.Core.Admin.Authorization.Roles.Commands.U
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class UpdateRoleCommandValidatorTests public class UpdateRoleCommandValidatorTests
{ {
private readonly UpdateRoleCommandValidator _validator; private readonly UpdateRoleCommandValidator _validator = new();
private readonly UpdateRoleCommandFixture _fixture; private readonly UpdateRoleCommandFixture _fixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="UpdateRoleCommandValidatorTests"/> class.
/// </summary>
public UpdateRoleCommandValidatorTests()
{
_validator = new UpdateRoleCommandValidator();
_fixture = new UpdateRoleCommandFixture();
}
[Fact] [Fact]
public void Validate_WhenRoleIdIsEmpty_ShouldHaveValidationError() public void Validate_WhenRoleIdIsEmpty_ShouldHaveValidationError()
@@ -31,7 +31,7 @@ public class GetRolePermissionsQueryHandlerTests
private readonly ICurrentUserService _mockCurrentUserService; private readonly ICurrentUserService _mockCurrentUserService;
private readonly IRoleRepository _mockRoleRepository; private readonly IRoleRepository _mockRoleRepository;
private readonly GetRolePermissionsQueryHandler _sut; private readonly GetRolePermissionsQueryHandler _sut;
private readonly GetRolePermissionsQueryFixture _getRolePermissionsQueryFixture; private readonly GetRolePermissionsQueryFixture _getRolePermissionsQueryFixture = new();
private readonly Guid _userId; private readonly Guid _userId;
/// <summary> /// <summary>
@@ -46,7 +46,6 @@ public class GetRolePermissionsQueryHandlerTests
_mockAuthorizationService = Substitute.For<IAuthorizationService>(); _mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>(); _mockCurrentUserService = Substitute.For<ICurrentUserService>();
_mockRoleRepository = Substitute.For<IRoleRepository>(); _mockRoleRepository = Substitute.For<IRoleRepository>();
_getRolePermissionsQueryFixture = new GetRolePermissionsQueryFixture();
_userId = Guid.NewGuid(); _userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId); _mockCurrentUserService.UserId.Returns(_userId);
@@ -16,15 +16,7 @@ namespace Lumina.Application.UnitTests.Core.Admin.Authorization.Roles.Queries.Ge
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class GetRolePermissionsQueryValidatorTests public class GetRolePermissionsQueryValidatorTests
{ {
private readonly GetRolePermissionsQueryValidator _validator; private readonly GetRolePermissionsQueryValidator _validator = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetRolePermissionsQueryValidatorTests"/> class.
/// </summary>
public GetRolePermissionsQueryValidatorTests()
{
_validator = new GetRolePermissionsQueryValidator();
}
[Fact] [Fact]
public void Validate_WhenRoleIdIsEmpty_ShouldHaveValidationError() public void Validate_WhenRoleIdIsEmpty_ShouldHaveValidationError()
@@ -30,7 +30,7 @@ public class GetRolesQueryHandlerTests
private readonly ICurrentUserService _mockCurrentUserService; private readonly ICurrentUserService _mockCurrentUserService;
private readonly IRoleRepository _mockRoleRepository; private readonly IRoleRepository _mockRoleRepository;
private readonly GetRolesQueryHandler _sut; private readonly GetRolesQueryHandler _sut;
private readonly GetRolesQueryFixture _getRolesQueryFixture; private readonly GetRolesQueryFixture _getRolesQueryFixture = new();
private readonly Guid _userId; private readonly Guid _userId;
/// <summary> /// <summary>
@@ -42,7 +42,6 @@ public class GetRolesQueryHandlerTests
_mockAuthorizationService = Substitute.For<IAuthorizationService>(); _mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>(); _mockCurrentUserService = Substitute.For<ICurrentUserService>();
_mockRoleRepository = Substitute.For<IRoleRepository>(); _mockRoleRepository = Substitute.For<IRoleRepository>();
_getRolesQueryFixture = new GetRolesQueryFixture();
_userId = Guid.NewGuid(); _userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId); _mockCurrentUserService.UserId.Returns(_userId);
@@ -29,8 +29,8 @@ public class GetDirectoriesQueryHandlerTests
private readonly IFixture _fixture; private readonly IFixture _fixture;
private readonly IDirectoryService _mockDirectoryService; private readonly IDirectoryService _mockDirectoryService;
private readonly GetDirectoriesQueryHandler _sut; private readonly GetDirectoriesQueryHandler _sut;
private readonly DirectoryFixture _directoryFixture; private readonly DirectoryFixture _directoryFixture = new();
private readonly GetDirectoriesQueryFixture _getDirectoriesQueryFixture; private readonly GetDirectoriesQueryFixture _getDirectoriesQueryFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GetDirectoriesQueryHandlerTests"/> class. /// Initializes a new instance of the <see cref="GetDirectoriesQueryHandlerTests"/> class.
@@ -43,8 +43,6 @@ public class GetDirectoriesQueryHandlerTests
mockValidator.Validate(Arg.Any<GetDirectoriesQuery>()) mockValidator.Validate(Arg.Any<GetDirectoriesQuery>())
.Returns([]); .Returns([]);
_sut = new GetDirectoriesQueryHandler(_mockDirectoryService, mockValidator); _sut = new GetDirectoriesQueryHandler(_mockDirectoryService, mockValidator);
_directoryFixture = new DirectoryFixture();
_getDirectoriesQueryFixture = new GetDirectoriesQueryFixture();
} }
[Fact] [Fact]
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Directories.Que
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class GetDirectoriesQueryValidatorTests public class GetDirectoriesQueryValidatorTests
{ {
private readonly GetDirectoriesQueryValidator _validator; private readonly GetDirectoriesQueryValidator _validator = new();
private readonly GetDirectoriesQueryFixture _getDirectoriesQueryFixture; private readonly GetDirectoriesQueryFixture _getDirectoriesQueryFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetDirectoriesQueryValidatorTests"/> class.
/// </summary>
public GetDirectoriesQueryValidatorTests()
{
_validator = new GetDirectoriesQueryValidator();
_getDirectoriesQueryFixture = new GetDirectoriesQueryFixture();
}
[Fact] [Fact]
public void Validate_WhenPathIsNull_ShouldHaveValidationError() public void Validate_WhenPathIsNull_ShouldHaveValidationError()
@@ -25,7 +25,7 @@ public class GetDrivesQueryHandlerTests
{ {
private readonly IDriveService _mockDriveService; private readonly IDriveService _mockDriveService;
private readonly GetDrivesQueryHandler _sut; private readonly GetDrivesQueryHandler _sut;
private readonly GetDrivesQueryFixture _getDrivesQueryFixture; private readonly GetDrivesQueryFixture _getDrivesQueryFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GetDrivesQueryHandlerTests"/> class. /// Initializes a new instance of the <see cref="GetDrivesQueryHandlerTests"/> class.
@@ -33,7 +33,6 @@ public class GetDrivesQueryHandlerTests
public GetDrivesQueryHandlerTests() public GetDrivesQueryHandlerTests()
{ {
_mockDriveService = Substitute.For<IDriveService>(); _mockDriveService = Substitute.For<IDriveService>();
_getDrivesQueryFixture = new GetDrivesQueryFixture();
_sut = new GetDrivesQueryHandler(_mockDriveService); _sut = new GetDrivesQueryHandler(_mockDriveService);
} }
@@ -25,7 +25,7 @@ public class GetFileSystemQueryHandlerTests
private readonly IPlatformContextManager _mockPlatformContextManager; private readonly IPlatformContextManager _mockPlatformContextManager;
private readonly IPlatformContext _mockPlatformContext; private readonly IPlatformContext _mockPlatformContext;
private readonly GetFileSystemQueryHandler _sut; private readonly GetFileSystemQueryHandler _sut;
private readonly GetFileSystemQueryFixture _getFileSystemQueryFixture; private readonly GetFileSystemQueryFixture _getFileSystemQueryFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GetFileSystemQueryHandlerTests"/> class. /// Initializes a new instance of the <see cref="GetFileSystemQueryHandlerTests"/> class.
@@ -36,7 +36,6 @@ public class GetFileSystemQueryHandlerTests
_mockPlatformContextManager = Substitute.For<IPlatformContextManager>(); _mockPlatformContextManager = Substitute.For<IPlatformContextManager>();
_mockPlatformContext = Substitute.For<IPlatformContext>(); _mockPlatformContext = Substitute.For<IPlatformContext>();
_mockPlatformContextManager.GetCurrentContext().Returns(_mockPlatformContext); _mockPlatformContextManager.GetCurrentContext().Returns(_mockPlatformContext);
_getFileSystemQueryFixture = new GetFileSystemQueryFixture();
_sut = new GetFileSystemQueryHandler(_mockPlatformContextManager); _sut = new GetFileSystemQueryHandler(_mockPlatformContextManager);
} }
@@ -29,8 +29,8 @@ public class GetFilesQueryHandlerTests
private readonly IFixture _fixture; private readonly IFixture _fixture;
private readonly IFileService _mockFileService; private readonly IFileService _mockFileService;
private readonly GetFilesQueryHandler _sut; private readonly GetFilesQueryHandler _sut;
private readonly FileFixture _fileFixture; private readonly FileFixture _fileFixture = new();
private readonly GetFilesQueryFixture _getFilesQueryFixture; private readonly GetFilesQueryFixture _getFilesQueryFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GetFilesQueryHandlerTests"/> class. /// Initializes a new instance of the <see cref="GetFilesQueryHandlerTests"/> class.
@@ -43,8 +43,6 @@ public class GetFilesQueryHandlerTests
mockValidator.Validate(Arg.Any<GetFilesQuery>()) mockValidator.Validate(Arg.Any<GetFilesQuery>())
.Returns([]); .Returns([]);
_sut = new GetFilesQueryHandler(_mockFileService, mockValidator); _sut = new GetFilesQueryHandler(_mockFileService, mockValidator);
_fileFixture = new FileFixture();
_getFilesQueryFixture = new GetFilesQueryFixture();
} }
[Fact] [Fact]
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Files.Queries.G
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class GetFilesQueryValidatorTests public class GetFilesQueryValidatorTests
{ {
private readonly GetFilesQueryValidator _validator; private readonly GetFilesQueryValidator _validator = new();
private readonly GetFilesQueryFixture _getFilesQueryFixture; private readonly GetFilesQueryFixture _getFilesQueryFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetFilesQueryValidatorTests"/> class.
/// </summary>
public GetFilesQueryValidatorTests()
{
_validator = new GetFilesQueryValidator();
_getFilesQueryFixture = new GetFilesQueryFixture();
}
[Fact] [Fact]
public void Validate_WhenPathIsNull_ShouldHaveValidationError() public void Validate_WhenPathIsNull_ShouldHaveValidationError()
@@ -29,8 +29,8 @@ public class GetTreeFilesQueryHandlerTests
private readonly IFixture _fixture; private readonly IFixture _fixture;
private readonly IFileService _mockFileService; private readonly IFileService _mockFileService;
private readonly GetTreeFilesQueryHandler _sut; private readonly GetTreeFilesQueryHandler _sut;
private readonly FileFixture _fileFixture; private readonly FileFixture _fileFixture = new();
private readonly GetTreeFilesQueryFixture _getTreeFilesQueryFixture; private readonly GetTreeFilesQueryFixture _getTreeFilesQueryFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GetTreeFilesQueryHandler"/> class. /// Initializes a new instance of the <see cref="GetTreeFilesQueryHandler"/> class.
@@ -43,8 +43,6 @@ public class GetTreeFilesQueryHandlerTests
mockValidator.Validate(Arg.Any<GetTreeFilesQuery>()) mockValidator.Validate(Arg.Any<GetTreeFilesQuery>())
.Returns([]); .Returns([]);
_sut = new GetTreeFilesQueryHandler(_mockFileService, mockValidator); _sut = new GetTreeFilesQueryHandler(_mockFileService, mockValidator);
_fileFixture = new FileFixture();
_getTreeFilesQueryFixture = new GetTreeFilesQueryFixture();
} }
[Fact] [Fact]
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Files.Queries.G
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class GetTreeFilesQueryValidatorTests public class GetTreeFilesQueryValidatorTests
{ {
private readonly GetTreeFilesQueryValidator _validator; private readonly GetTreeFilesQueryValidator _validator = new();
private readonly GetTreeFilesQueryFixture _getTreeFilesQueryFixture; private readonly GetTreeFilesQueryFixture _getTreeFilesQueryFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetTreeFilesQueryValidatorTests"/> class.
/// </summary>
public GetTreeFilesQueryValidatorTests()
{
_validator = new GetTreeFilesQueryValidator();
_getTreeFilesQueryFixture = new GetTreeFilesQueryFixture();
}
[Fact] [Fact]
public void Validate_WhenPathIsNull_ShouldHaveValidationError() public void Validate_WhenPathIsNull_ShouldHaveValidationError()
@@ -24,7 +24,7 @@ public class CombinePathCommandHandlerTests
private readonly IFixture _fixture; private readonly IFixture _fixture;
private readonly IPathService _mockPathService; private readonly IPathService _mockPathService;
private readonly CombinePathCommandHandler _sut; private readonly CombinePathCommandHandler _sut;
private readonly CombinePathCommandFixture _combinePathCommandFixture; private readonly CombinePathCommandFixture _combinePathCommandFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="CombinePathCommandHandlerTests"/> class. /// Initializes a new instance of the <see cref="CombinePathCommandHandlerTests"/> class.
@@ -37,7 +37,6 @@ public class CombinePathCommandHandlerTests
mockValidator.Validate(Arg.Any<CombinePathCommand>()) mockValidator.Validate(Arg.Any<CombinePathCommand>())
.Returns([]); .Returns([]);
_sut = new CombinePathCommandHandler(_mockPathService, mockValidator); _sut = new CombinePathCommandHandler(_mockPathService, mockValidator);
_combinePathCommandFixture = new CombinePathCommandFixture();
} }
[Fact] [Fact]
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Paths.Commands.
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class CombinePathCommandValidatorTests public class CombinePathCommandValidatorTests
{ {
private readonly CombinePathCommandValidator _validator; private readonly CombinePathCommandValidator _validator = new();
private readonly CombinePathCommandFixture _combinePathCommandFixture; private readonly CombinePathCommandFixture _combinePathCommandFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="CombinePathCommandValidatorTests"/> class.
/// </summary>
public CombinePathCommandValidatorTests()
{
_validator = new CombinePathCommandValidator();
_combinePathCommandFixture = new CombinePathCommandFixture();
}
[Fact] [Fact]
public void Validate_WhenOriginalPathIsNull_ShouldHaveValidationError() public void Validate_WhenOriginalPathIsNull_ShouldHaveValidationError()
@@ -29,8 +29,8 @@ public class SplitPathCommandHandlerTests
private readonly IFixture _fixture; private readonly IFixture _fixture;
private readonly IPathService _mockPathService; private readonly IPathService _mockPathService;
private readonly SplitPathCommandHandler _sut; private readonly SplitPathCommandHandler _sut;
private readonly PathSegmentFixture _pathSegmentFixture; private readonly PathSegmentFixture _pathSegmentFixture = new();
private readonly SplitPathCommandFixture _splitPathCommandFixture; private readonly SplitPathCommandFixture _splitPathCommandFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="SplitPathCommandHandlerTests"/> class. /// Initializes a new instance of the <see cref="SplitPathCommandHandlerTests"/> class.
@@ -43,8 +43,6 @@ public class SplitPathCommandHandlerTests
mockValidator.Validate(Arg.Any<SplitPathCommand>()) mockValidator.Validate(Arg.Any<SplitPathCommand>())
.Returns([]); .Returns([]);
_sut = new SplitPathCommandHandler(_mockPathService, mockValidator); _sut = new SplitPathCommandHandler(_mockPathService, mockValidator);
_pathSegmentFixture = new PathSegmentFixture();
_splitPathCommandFixture = new SplitPathCommandFixture();
} }
[Fact] [Fact]
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Paths.Commands.
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class SplitPathCommandValidatorTests public class SplitPathCommandValidatorTests
{ {
private readonly SplitPathCommandValidator _validator; private readonly SplitPathCommandValidator _validator = new();
private readonly SplitPathCommandFixture _splitPathCommandFixture; private readonly SplitPathCommandFixture _splitPathCommandFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="SplitPathCommandValidatorTests"/> class.
/// </summary>
public SplitPathCommandValidatorTests()
{
_validator = new SplitPathCommandValidator();
_splitPathCommandFixture = new SplitPathCommandFixture();
}
[Fact] [Fact]
public void Validate_WhenPathIsNull_ShouldHaveValidationError() public void Validate_WhenPathIsNull_ShouldHaveValidationError()
@@ -21,7 +21,7 @@ public class CheckPathExistsQueryHandlerTests
{ {
private readonly IPathService _mockPathService; private readonly IPathService _mockPathService;
private readonly CheckPathExistsQueryHandler _sut; private readonly CheckPathExistsQueryHandler _sut;
private readonly CheckPathExistsQueryFixture _checkPathExistsQueryFixture; private readonly CheckPathExistsQueryFixture _checkPathExistsQueryFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="CheckPathExistsQueryHandlerTests"/> class. /// Initializes a new instance of the <see cref="CheckPathExistsQueryHandlerTests"/> class.
@@ -29,7 +29,6 @@ public class CheckPathExistsQueryHandlerTests
public CheckPathExistsQueryHandlerTests() public CheckPathExistsQueryHandlerTests()
{ {
_mockPathService = Substitute.For<IPathService>(); _mockPathService = Substitute.For<IPathService>();
_checkPathExistsQueryFixture = new CheckPathExistsQueryFixture();
IValidator<CheckPathExistsQuery> mockValidator = Substitute.For<IValidator<CheckPathExistsQuery>>(); IValidator<CheckPathExistsQuery> mockValidator = Substitute.For<IValidator<CheckPathExistsQuery>>();
mockValidator.Validate(Arg.Any<CheckPathExistsQuery>()) mockValidator.Validate(Arg.Any<CheckPathExistsQuery>())
.Returns([]); .Returns([]);
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Paths.Queries.C
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class CheckPathExistsQueryValidatorTests public class CheckPathExistsQueryValidatorTests
{ {
private readonly CheckPathExistsQueryValidator _validator; private readonly CheckPathExistsQueryValidator _validator = new();
private readonly CheckPathExistsQueryFixture _checkPathExistsQueryFixture; private readonly CheckPathExistsQueryFixture _checkPathExistsQueryFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="CheckPathExistsQueryValidatorTests"/> class.
/// </summary>
public CheckPathExistsQueryValidatorTests()
{
_validator = new CheckPathExistsQueryValidator();
_checkPathExistsQueryFixture = new CheckPathExistsQueryFixture();
}
[Fact] [Fact]
public void Validate_WhenPathIsNull_ShouldHaveValidationError() public void Validate_WhenPathIsNull_ShouldHaveValidationError()
@@ -28,8 +28,8 @@ public class GetPathParentQueryHandlerTests
private readonly IFixture _fixture; private readonly IFixture _fixture;
private readonly IPathService _mockPathService; private readonly IPathService _mockPathService;
private readonly GetPathParentQueryHandler _sut; private readonly GetPathParentQueryHandler _sut;
private readonly PathSegmentFixture _pathSegmentFixture; private readonly PathSegmentFixture _pathSegmentFixture = new();
private readonly GetPathParentQueryFixture _getPathParentQueryFixture; private readonly GetPathParentQueryFixture _getPathParentQueryFixture = new();
public GetPathParentQueryHandlerTests() public GetPathParentQueryHandlerTests()
{ {
@@ -39,8 +39,6 @@ public class GetPathParentQueryHandlerTests
mockValidator.Validate(Arg.Any<GetPathParentQuery>()) mockValidator.Validate(Arg.Any<GetPathParentQuery>())
.Returns([]); .Returns([]);
_sut = new GetPathParentQueryHandler(_mockPathService, mockValidator); _sut = new GetPathParentQueryHandler(_mockPathService, mockValidator);
_pathSegmentFixture = new PathSegmentFixture();
_getPathParentQueryFixture = new GetPathParentQueryFixture();
} }
[Fact] [Fact]
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Paths.Queries.G
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class GetPathParentQueryValidatorTests public class GetPathParentQueryValidatorTests
{ {
private readonly GetPathParentQueryValidator _validator; private readonly GetPathParentQueryValidator _validator = new();
private readonly GetPathParentQueryFixture _getPathParentQueryFixture; private readonly GetPathParentQueryFixture _getPathParentQueryFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetPathParentQueryValidatorTests"/> class.
/// </summary>
public GetPathParentQueryValidatorTests()
{
_validator = new GetPathParentQueryValidator();
_getPathParentQueryFixture = new GetPathParentQueryFixture();
}
[Fact] [Fact]
public void Validate_WhenPathIsNull_ShouldHaveValidationError() public void Validate_WhenPathIsNull_ShouldHaveValidationError()
@@ -23,8 +23,8 @@ public class GetPathRootQueryHandlerTests
{ {
private readonly IPathService _mockPathService; private readonly IPathService _mockPathService;
private readonly GetPathRootQueryHandler _sut; private readonly GetPathRootQueryHandler _sut;
private readonly PathSegmentFixture _pathSegmentFixture; private readonly PathSegmentFixture _pathSegmentFixture = new();
private readonly GetPathRootQueryFixture _getPathRootQueryFixture; private readonly GetPathRootQueryFixture _getPathRootQueryFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GetPathRootQueryHandlerTests"/> class. /// Initializes a new instance of the <see cref="GetPathRootQueryHandlerTests"/> class.
@@ -32,12 +32,10 @@ public class GetPathRootQueryHandlerTests
public GetPathRootQueryHandlerTests() public GetPathRootQueryHandlerTests()
{ {
_mockPathService = Substitute.For<IPathService>(); _mockPathService = Substitute.For<IPathService>();
_getPathRootQueryFixture = new GetPathRootQueryFixture();
IValidator<GetPathRootQuery> mockValidator = Substitute.For<IValidator<GetPathRootQuery>>(); IValidator<GetPathRootQuery> mockValidator = Substitute.For<IValidator<GetPathRootQuery>>();
mockValidator.Validate(Arg.Any<GetPathRootQuery>()) mockValidator.Validate(Arg.Any<GetPathRootQuery>())
.Returns([]); .Returns([]);
_sut = new GetPathRootQueryHandler(_mockPathService, mockValidator); _sut = new GetPathRootQueryHandler(_mockPathService, mockValidator);
_pathSegmentFixture = new PathSegmentFixture();
} }
[Fact] [Fact]
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Paths.Queries.G
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class GetPathRootQueryValidatorTests public class GetPathRootQueryValidatorTests
{ {
private readonly GetPathRootQueryValidator _validator; private readonly GetPathRootQueryValidator _validator = new();
private readonly GetPathRootQueryFixture _getPathRootQueryFixture; private readonly GetPathRootQueryFixture _getPathRootQueryFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetPathRootQueryValidatorTests"/> class.
/// </summary>
public GetPathRootQueryValidatorTests()
{
_validator = new GetPathRootQueryValidator();
_getPathRootQueryFixture = new GetPathRootQueryFixture();
}
[Fact] [Fact]
public void Validate_WhenPathIsNull_ShouldHaveValidationError() public void Validate_WhenPathIsNull_ShouldHaveValidationError()
@@ -23,7 +23,7 @@ public class ValidatePathQueryHandlerTests
private readonly IPathService _mockPathService; private readonly IPathService _mockPathService;
private readonly IValidator<ValidatePathQuery> _mockValidator; private readonly IValidator<ValidatePathQuery> _mockValidator;
private readonly ValidatePathQueryHandler _sut; private readonly ValidatePathQueryHandler _sut;
private readonly ValidatePathQueryFixture _validatePathQueryFixture; private readonly ValidatePathQueryFixture _validatePathQueryFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ValidatePathQueryHandlerTests"/> class. /// Initializes a new instance of the <see cref="ValidatePathQueryHandlerTests"/> class.
@@ -32,7 +32,6 @@ public class ValidatePathQueryHandlerTests
{ {
_mockPathService = Substitute.For<IPathService>(); _mockPathService = Substitute.For<IPathService>();
_mockValidator = Substitute.For<IValidator<ValidatePathQuery>>(); _mockValidator = Substitute.For<IValidator<ValidatePathQuery>>();
_validatePathQueryFixture = new ValidatePathQueryFixture();
_mockValidator.Validate(Arg.Any<ValidatePathQuery>()) _mockValidator.Validate(Arg.Any<ValidatePathQuery>())
.Returns([]); .Returns([]);
_sut = new ValidatePathQueryHandler(_mockPathService, _mockValidator); _sut = new ValidatePathQueryHandler(_mockPathService, _mockValidator);
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Paths.Queries.V
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class ValidatePathQueryValidatorTests public class ValidatePathQueryValidatorTests
{ {
private readonly ValidatePathQueryValidator _validator; private readonly ValidatePathQueryValidator _validator = new();
private readonly ValidatePathQueryFixture _validatePathQueryFixture; private readonly ValidatePathQueryFixture _validatePathQueryFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="ValidatePathQueryValidatorTests"/> class.
/// </summary>
public ValidatePathQueryValidatorTests()
{
_validator = new ValidatePathQueryValidator();
_validatePathQueryFixture = new ValidatePathQueryFixture();
}
[Fact] [Fact]
public void Validate_WhenPathIsNull_ShouldHaveValidationError() public void Validate_WhenPathIsNull_ShouldHaveValidationError()
@@ -26,15 +26,13 @@ public class GetThumbnailQueryHandlerTests
private readonly IFixture _fixture; private readonly IFixture _fixture;
private readonly IThumbnailService _mockThumbnailService; private readonly IThumbnailService _mockThumbnailService;
private readonly GetThumbnailQueryHandler _sut; private readonly GetThumbnailQueryHandler _sut;
private readonly GetThumbnailQueryFixture _getThumbnailQueryFixture; private readonly GetThumbnailQueryFixture _getThumbnailQueryFixture = new();
private readonly ThumbnailFixture _thumbnailFixture; private readonly ThumbnailFixture _thumbnailFixture = new();
public GetThumbnailQueryHandlerTests() public GetThumbnailQueryHandlerTests()
{ {
_fixture = new Fixture().Customize(new AutoNSubstituteCustomization()); _fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
_mockThumbnailService = Substitute.For<IThumbnailService>(); _mockThumbnailService = Substitute.For<IThumbnailService>();
_getThumbnailQueryFixture = new GetThumbnailQueryFixture();
_thumbnailFixture = new ThumbnailFixture();
IValidator<GetThumbnailQuery> mockValidator = Substitute.For<IValidator<GetThumbnailQuery>>(); IValidator<GetThumbnailQuery> mockValidator = Substitute.For<IValidator<GetThumbnailQuery>>();
mockValidator.Validate(Arg.Any<GetThumbnailQuery>()) mockValidator.Validate(Arg.Any<GetThumbnailQuery>())
.Returns([]); .Returns([]);
@@ -15,15 +15,7 @@ namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Thumbnails.Quer
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class GetThumbnailQueryValidatorTests public class GetThumbnailQueryValidatorTests
{ {
private readonly GetThumbnailQueryValidator _validator; private readonly GetThumbnailQueryValidator _validator = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetThumbnailQueryValidatorTests"/> class.
/// </summary>
public GetThumbnailQueryValidatorTests()
{
_validator = new GetThumbnailQueryValidator();
}
[Fact] [Fact]
public void Validate_WhenPathIsNull_ShouldHaveValidationError() public void Validate_WhenPathIsNull_ShouldHaveValidationError()
@@ -39,7 +39,7 @@ public class SetupApplicationCommandHandlerTests
private readonly IDataSeedService _mockDataSeedService; private readonly IDataSeedService _mockDataSeedService;
private readonly SetupApplicationCommandHandler _sut; private readonly SetupApplicationCommandHandler _sut;
private readonly UserEntityFixture _userEntityFixture = new(); private readonly UserEntityFixture _userEntityFixture = new();
private readonly SetupApplicationCommandFixture _setupApplicationCommandFixture; private readonly SetupApplicationCommandFixture _setupApplicationCommandFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="SetupApplicationCommandHandlerTests"/> class. /// Initializes a new instance of the <see cref="SetupApplicationCommandHandlerTests"/> class.
@@ -54,7 +54,6 @@ public class SetupApplicationCommandHandlerTests
_mockUserRepository = Substitute.For<IUserRepository>(); _mockUserRepository = Substitute.For<IUserRepository>();
_mockDateTimeProvider = Substitute.For<IDateTimeProvider>(); _mockDateTimeProvider = Substitute.For<IDateTimeProvider>();
_mockDataSeedService = Substitute.For<IDataSeedService>(); _mockDataSeedService = Substitute.For<IDataSeedService>();
_setupApplicationCommandFixture = new SetupApplicationCommandFixture();
IValidator<SetupApplicationCommand> mockValidator = Substitute.For<IValidator<SetupApplicationCommand>>(); IValidator<SetupApplicationCommand> mockValidator = Substitute.For<IValidator<SetupApplicationCommand>>();
mockValidator.Validate(Arg.Any<SetupApplicationCommand>()) mockValidator.Validate(Arg.Any<SetupApplicationCommand>())
.Returns([]); .Returns([]);
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.Maintenance.ApplicationSetup.Command
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class SetupApplicationCommandValidatorTests public class SetupApplicationCommandValidatorTests
{ {
private readonly SetupApplicationCommandValidator _validator; private readonly SetupApplicationCommandValidator _validator = new();
private readonly SetupApplicationCommandFixture _commandFixture; private readonly SetupApplicationCommandFixture _commandFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="SetupApplicationCommandValidatorTests"/> class.
/// </summary>
public SetupApplicationCommandValidatorTests()
{
_validator = new SetupApplicationCommandValidator();
_commandFixture = new SetupApplicationCommandFixture();
}
[Fact] [Fact]
public void Validate_WhenUsernameIsNull_ShouldHaveValidationError() public void Validate_WhenUsernameIsNull_ShouldHaveValidationError()
@@ -33,7 +33,7 @@ public class AddBookCommandHandlerTests
private readonly IUnitOfWork _mockUnitOfWork; private readonly IUnitOfWork _mockUnitOfWork;
private readonly IBookRepository _mockBookRepository; private readonly IBookRepository _mockBookRepository;
private readonly AddBookCommandHandler _sut; private readonly AddBookCommandHandler _sut;
private readonly AddBookCommandFixture _commandBookFixture; private readonly AddBookCommandFixture _commandBookFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="AddBookCommandHandlerTests"/> class. /// Initializes a new instance of the <see cref="AddBookCommandHandlerTests"/> class.
@@ -53,7 +53,6 @@ public class AddBookCommandHandlerTests
mockValidator.Validate(Arg.Any<AddBookCommand>()) mockValidator.Validate(Arg.Any<AddBookCommand>())
.Returns([]); .Returns([]);
_sut = new AddBookCommandHandler(_mockUnitOfWork, mockValidator); _sut = new AddBookCommandHandler(_mockUnitOfWork, mockValidator);
_commandBookFixture = new AddBookCommandFixture();
} }
[Fact] [Fact]
@@ -20,17 +20,8 @@ namespace Lumina.Application.UnitTests.Core.MediaLibrary.WrittenContentLibrary.B
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class AddBookCommandValidatorTests public class AddBookCommandValidatorTests
{ {
private readonly AddBookCommandFixture _commandBookFixture; private readonly AddBookCommandFixture _commandBookFixture = new();
private readonly AddBookCommandValidator _validator; private readonly AddBookCommandValidator _validator = new();
/// <summary>
/// Initializes a new instance of the <see cref="AddBookCommandValidatorTests"/> class.
/// </summary>
public AddBookCommandValidatorTests()
{
_validator = new AddBookCommandValidator();
_commandBookFixture = new AddBookCommandFixture();
}
[Fact] [Fact]
public void Validate_WhenTitleIsNull_ShouldHaveValidationError() public void Validate_WhenTitleIsNull_ShouldHaveValidationError()
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authentication.Comma
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class ChangePasswordCommandValidatorTests public class ChangePasswordCommandValidatorTests
{ {
private readonly ChangePasswordCommandValidator _validator; private readonly ChangePasswordCommandValidator _validator = new();
private readonly ChangePasswordCommandFixture _changePasswordCommandFixture; private readonly ChangePasswordCommandFixture _changePasswordCommandFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="ChangePasswordCommandValidatorTests"/> class.
/// </summary>
public ChangePasswordCommandValidatorTests()
{
_validator = new ChangePasswordCommandValidator();
_changePasswordCommandFixture = new ChangePasswordCommandFixture();
}
[Fact] [Fact]
public void Validate_WhenUsernameIsNull_ShouldHaveValidationError() public void Validate_WhenUsernameIsNull_ShouldHaveValidationError()
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authentication.Comma
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class RecoverPasswordCommandValidatorTests public class RecoverPasswordCommandValidatorTests
{ {
private readonly RecoverPasswordCommandValidator _validator; private readonly RecoverPasswordCommandValidator _validator = new();
private readonly RecoverPasswordCommandFixture _recoverPasswordCommandFixture; private readonly RecoverPasswordCommandFixture _recoverPasswordCommandFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="RecoverPasswordCommandValidatorTests"/> class.
/// </summary>
public RecoverPasswordCommandValidatorTests()
{
_validator = new RecoverPasswordCommandValidator();
_recoverPasswordCommandFixture = new RecoverPasswordCommandFixture();
}
[Fact] [Fact]
public void Validate_WhenUsernameIsNull_ShouldHaveValidationError() public void Validate_WhenUsernameIsNull_ShouldHaveValidationError()
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authentication.Comma
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class RegisterUserCommandValidatorTests public class RegisterUserCommandValidatorTests
{ {
private readonly RegisterUserCommandValidator _validator; private readonly RegisterUserCommandValidator _validator = new();
private readonly RegisterUserCommandFixture _registerUserCommandFixture; private readonly RegisterUserCommandFixture _registerUserCommandFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="RegisterUserCommandValidatorTests"/> class.
/// </summary>
public RegisterUserCommandValidatorTests()
{
_validator = new RegisterUserCommandValidator();
_registerUserCommandFixture = new RegisterUserCommandFixture();
}
[Fact] [Fact]
public void Validate_WhenUsernameIsNull_ShouldHaveValidationError() public void Validate_WhenUsernameIsNull_ShouldHaveValidationError()
@@ -33,7 +33,7 @@ public class GetUsersQueryHandlerTests
private readonly IUserRepository _mockUserRepository; private readonly IUserRepository _mockUserRepository;
private readonly GetUsersQueryHandler _sut; private readonly GetUsersQueryHandler _sut;
private readonly UserEntityFixture _userEntityFixture = new(); private readonly UserEntityFixture _userEntityFixture = new();
private readonly GetUsersQueryFixture _getUsersQueryFixture; private readonly GetUsersQueryFixture _getUsersQueryFixture = new();
private readonly Guid _userId; private readonly Guid _userId;
/// <summary> /// <summary>
@@ -45,7 +45,6 @@ public class GetUsersQueryHandlerTests
_mockAuthorizationService = Substitute.For<IAuthorizationService>(); _mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>(); _mockCurrentUserService = Substitute.For<ICurrentUserService>();
_mockUserRepository = Substitute.For<IUserRepository>(); _mockUserRepository = Substitute.For<IUserRepository>();
_getUsersQueryFixture = new GetUsersQueryFixture();
_userId = Guid.NewGuid(); _userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId); _mockCurrentUserService.UserId.Returns(_userId);
@@ -16,17 +16,8 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authentication.Queri
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class LoginUserQueryValidatorTests public class LoginUserQueryValidatorTests
{ {
private readonly LoginUserQueryValidator _validator; private readonly LoginUserQueryValidator _validator = new();
private readonly LoginUserQueryFixture _loginUserQueryFixture; private readonly LoginUserQueryFixture _loginUserQueryFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="LoginUserQueryValidatorTests"/> class.
/// </summary>
public LoginUserQueryValidatorTests()
{
_validator = new LoginUserQueryValidator();
_loginUserQueryFixture = new LoginUserQueryFixture();
}
[Fact] [Fact]
public void Validate_WhenUsernameIsNull_ShouldHaveValidationError() public void Validate_WhenUsernameIsNull_ShouldHaveValidationError()
@@ -40,7 +40,7 @@ public class UpdateUserRoleAndPermissionsCommandHandlerTests
private readonly IPermissionRepository _mockPermissionRepository; private readonly IPermissionRepository _mockPermissionRepository;
private readonly UpdateUserRoleAndPermissionsCommandHandler _sut; private readonly UpdateUserRoleAndPermissionsCommandHandler _sut;
private readonly UserEntityFixture _userEntityFixture = new(); private readonly UserEntityFixture _userEntityFixture = new();
private readonly UpdateUserRoleAndPermissionsCommandFixture _updateUserRoleAndPermissionsCommandFixture; private readonly UpdateUserRoleAndPermissionsCommandFixture _updateUserRoleAndPermissionsCommandFixture = new();
private readonly Guid _userId; private readonly Guid _userId;
/// <summary> /// <summary>
@@ -54,7 +54,6 @@ public class UpdateUserRoleAndPermissionsCommandHandlerTests
_mockUserRepository = Substitute.For<IUserRepository>(); _mockUserRepository = Substitute.For<IUserRepository>();
_mockRoleRepository = Substitute.For<IRoleRepository>(); _mockRoleRepository = Substitute.For<IRoleRepository>();
_mockPermissionRepository = Substitute.For<IPermissionRepository>(); _mockPermissionRepository = Substitute.For<IPermissionRepository>();
_updateUserRoleAndPermissionsCommandFixture = new UpdateUserRoleAndPermissionsCommandFixture();
_userId = Guid.NewGuid(); _userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId); _mockCurrentUserService.UserId.Returns(_userId);
@@ -17,15 +17,7 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authorization.Comman
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class UpdateUserRoleAndPermissionsCommandValidatorTests public class UpdateUserRoleAndPermissionsCommandValidatorTests
{ {
private readonly UpdateUserRoleAndPermissionsCommandValidator _validator; private readonly UpdateUserRoleAndPermissionsCommandValidator _validator = new();
/// <summary>
/// Initializes a new instance of the <see cref="UpdateUserRoleAndPermissionsCommandValidatorTests"/> class.
/// </summary>
public UpdateUserRoleAndPermissionsCommandValidatorTests()
{
_validator = new UpdateUserRoleAndPermissionsCommandValidator();
}
[Fact] [Fact]
public void Validate_WhenUserIdIsEmpty_ShouldHaveValidationError() public void Validate_WhenUserIdIsEmpty_ShouldHaveValidationError()
@@ -27,8 +27,8 @@ public class GetAuthorizationQueryHandlerTests
private readonly IAuthorizationService _mockAuthorizationService; private readonly IAuthorizationService _mockAuthorizationService;
private readonly ICurrentUserService _mockCurrentUserService; private readonly ICurrentUserService _mockCurrentUserService;
private readonly GetAuthorizationQueryHandler _sut; private readonly GetAuthorizationQueryHandler _sut;
private readonly GetAuthorizationQueryFixture _getAuthorizationQueryFixture; private readonly GetAuthorizationQueryFixture _getAuthorizationQueryFixture = new();
private readonly UserAuthorizationEntityFixture _userAuthorizationEntityFixture; private readonly UserAuthorizationEntityFixture _userAuthorizationEntityFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GetAuthorizationQueryHandlerTests"/> class. /// Initializes a new instance of the <see cref="GetAuthorizationQueryHandlerTests"/> class.
@@ -37,8 +37,6 @@ public class GetAuthorizationQueryHandlerTests
{ {
_mockAuthorizationService = Substitute.For<IAuthorizationService>(); _mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>(); _mockCurrentUserService = Substitute.For<ICurrentUserService>();
_getAuthorizationQueryFixture = new GetAuthorizationQueryFixture();
_userAuthorizationEntityFixture = new UserAuthorizationEntityFixture();
IValidator<GetAuthorizationQuery> mockValidator = Substitute.For<IValidator<GetAuthorizationQuery>>(); IValidator<GetAuthorizationQuery> mockValidator = Substitute.For<IValidator<GetAuthorizationQuery>>();
mockValidator.Validate(Arg.Any<GetAuthorizationQuery>()) mockValidator.Validate(Arg.Any<GetAuthorizationQuery>())
.Returns([]); .Returns([]);
@@ -17,17 +17,8 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authorization.Querie
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class GetAuthorizationQueryValidatorTests public class GetAuthorizationQueryValidatorTests
{ {
private readonly GetAuthorizationQueryValidator _validator; private readonly GetAuthorizationQueryValidator _validator = new();
private readonly GetAuthorizationQueryFixture _getAuthorizationQueryFixture; private readonly GetAuthorizationQueryFixture _getAuthorizationQueryFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetAuthorizationQueryValidatorTests"/> class.
/// </summary>
public GetAuthorizationQueryValidatorTests()
{
_validator = new GetAuthorizationQueryValidator();
_getAuthorizationQueryFixture = new GetAuthorizationQueryFixture();
}
[Fact] [Fact]
public void Validate_WhenUserIdIsNull_ShouldHaveValidationError() public void Validate_WhenUserIdIsNull_ShouldHaveValidationError()
@@ -33,7 +33,7 @@ public class GetUserPermissionsQueryHandlerTests
private readonly ICurrentUserService _mockCurrentUserService; private readonly ICurrentUserService _mockCurrentUserService;
private readonly IUserRepository _mockUserRepository; private readonly IUserRepository _mockUserRepository;
private readonly GetUserPermissionsQueryHandler _sut; private readonly GetUserPermissionsQueryHandler _sut;
private readonly GetUserPermissionsQueryFixture _getUserPermissionsQueryFixture; private readonly GetUserPermissionsQueryFixture _getUserPermissionsQueryFixture = new();
private readonly Guid _userId; private readonly Guid _userId;
/// <summary> /// <summary>
@@ -45,7 +45,6 @@ public class GetUserPermissionsQueryHandlerTests
_mockAuthorizationService = Substitute.For<IAuthorizationService>(); _mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>(); _mockCurrentUserService = Substitute.For<ICurrentUserService>();
_mockUserRepository = Substitute.For<IUserRepository>(); _mockUserRepository = Substitute.For<IUserRepository>();
_getUserPermissionsQueryFixture = new GetUserPermissionsQueryFixture();
_userId = Guid.NewGuid(); _userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId); _mockCurrentUserService.UserId.Returns(_userId);
@@ -16,15 +16,7 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authorization.Querie
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class GetUserPermissionsQueryValidatorTests public class GetUserPermissionsQueryValidatorTests
{ {
private readonly GetUserPermissionsQueryValidator _validator; private readonly GetUserPermissionsQueryValidator _validator = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetUserPermissionsQueryValidatorTests"/> class.
/// </summary>
public GetUserPermissionsQueryValidatorTests()
{
_validator = new GetUserPermissionsQueryValidator();
}
[Fact] [Fact]
public void Validate_WhenUserIdIsNull_ShouldHaveValidationError() public void Validate_WhenUserIdIsNull_ShouldHaveValidationError()
@@ -32,7 +32,7 @@ public class GetUserRoleQueryHandlerTests
private readonly IUserRepository _mockUserRepository; private readonly IUserRepository _mockUserRepository;
private readonly GetUserRoleQueryHandler _sut; private readonly GetUserRoleQueryHandler _sut;
private readonly UserEntityFixture _userEntityFixture = new(); private readonly UserEntityFixture _userEntityFixture = new();
private readonly GetUserRoleQueryFixture _getUserRoleQueryFixture; private readonly GetUserRoleQueryFixture _getUserRoleQueryFixture = new();
private readonly Guid _userId; private readonly Guid _userId;
/// <summary> /// <summary>
@@ -44,7 +44,6 @@ public class GetUserRoleQueryHandlerTests
_mockAuthorizationService = Substitute.For<IAuthorizationService>(); _mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>(); _mockCurrentUserService = Substitute.For<ICurrentUserService>();
_mockUserRepository = Substitute.For<IUserRepository>(); _mockUserRepository = Substitute.For<IUserRepository>();
_getUserRoleQueryFixture = new GetUserRoleQueryFixture();
_userId = Guid.NewGuid(); _userId = Guid.NewGuid();
_mockCurrentUserService.UserId.Returns(_userId); _mockCurrentUserService.UserId.Returns(_userId);
@@ -16,15 +16,7 @@ namespace Lumina.Application.UnitTests.Core.UsersManagement.Authorization.Querie
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
public class GetUserRoleQueryValidatorTests public class GetUserRoleQueryValidatorTests
{ {
private readonly GetUserRoleQueryValidator _validator; private readonly GetUserRoleQueryValidator _validator = new();
/// <summary>
/// Initializes a new instance of the <see cref="GetUserRoleQueryValidatorTests"/> class.
/// </summary>
public GetUserRoleQueryValidatorTests()
{
_validator = new GetUserRoleQueryValidator();
}
[Fact] [Fact]
public void Validate_WhenUserIdIsNull_ShouldHaveValidationError() public void Validate_WhenUserIdIsNull_ShouldHaveValidationError()
@@ -26,7 +26,7 @@ public class PermissionRepositoryTests
{ {
private readonly LuminaDbContext _mockContext; private readonly LuminaDbContext _mockContext;
private readonly PermissionRepository _sut; private readonly PermissionRepository _sut;
private readonly PermissionEntityFixture _permissionEntityFixture; private readonly PermissionEntityFixture _permissionEntityFixture = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="PermissionRepositoryTests"/> class. /// Initializes a new instance of the <see cref="PermissionRepositoryTests"/> class.
@@ -35,7 +35,6 @@ public class PermissionRepositoryTests
{ {
_mockContext = Create.MockedDbContextFor<LuminaDbContext>(); _mockContext = Create.MockedDbContextFor<LuminaDbContext>();
_sut = new PermissionRepository(_mockContext); _sut = new PermissionRepository(_mockContext);
_permissionEntityFixture = new PermissionEntityFixture();
} }
[Fact] [Fact]
Loaded 100 of 147 files, more files were not shown because too many files have changed in this diff. Show more