Adds test fixtures and endpoint test coverage

This commit is contained in:
BinaryAlley committed 2026-08-24 14:19:45 -07:00
1 parent c82fadc7a2
commit 7aeed04255
198 files changed
+11649

No files matched your search

@@ -0,0 +1,39 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Responses.Authentication;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Responses.Authentication;
/// <summary>
/// Fixture class for the <see cref="ChangePasswordResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class ChangePasswordResponseFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="ChangePasswordResponse"/>.
/// </summary>
/// <param name="isPasswordChanged">Optional. Whether the password was changed.</param>
/// <returns>The created <see cref="ChangePasswordResponse"/>.</returns>
public ChangePasswordResponse Create(
bool? isPasswordChanged = null)
{
return new ChangePasswordResponse(isPasswordChanged ?? _faker.Random.Bool());
}
/// <summary>
/// Creates a list of <see cref="ChangePasswordResponse"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<ChangePasswordResponse> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,50 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Responses.Authentication;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Responses.Authentication;
/// <summary>
/// Fixture class for the <see cref="LoginResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class LoginResponseFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="LoginResponse"/>.
/// </summary>
/// <param name="id">Optional. The Id of the authenticated user.</param>
/// <param name="username">Optional. The username of the authenticated user.</param>
/// <param name="token">Optional. The authentication token of the user.</param>
/// <param name="usesTotp">Optional. Whether the user uses two-factor authentication.</param>
/// <returns>The created <see cref="LoginResponse"/>.</returns>
public LoginResponse Create(
Guid? id = null,
string? username = null,
string? token = null,
bool? usesTotp = null)
{
return new LoginResponse(
id ?? Guid.NewGuid(),
username ?? _faker.Internet.UserName(),
token ?? _faker.Random.Hexadecimal(32),
usesTotp ?? _faker.Random.Bool());
}
/// <summary>
/// Creates a list of <see cref="LoginResponse"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<LoginResponse> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,39 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Responses.Authentication;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Responses.Authentication;
/// <summary>
/// Fixture class for the <see cref="RecoverPasswordResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class RecoverPasswordResponseFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="RecoverPasswordResponse"/>.
/// </summary>
/// <param name="isPasswordReset">Optional. Whether the password was reset.</param>
/// <returns>The created <see cref="RecoverPasswordResponse"/>.</returns>
public RecoverPasswordResponse Create(
bool? isPasswordReset = null)
{
return new RecoverPasswordResponse(isPasswordReset ?? _faker.Random.Bool());
}
/// <summary>
/// Creates a list of <see cref="RecoverPasswordResponse"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<RecoverPasswordResponse> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,48 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Responses.Authorization;
using Lumina.Domain.SharedKernel.Common.Enums.Authorization;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Responses.Authorization;
/// <summary>
/// Fixture class for the <see cref="AuthorizationResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class AuthorizationResponseFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="AuthorizationResponse"/>.
/// </summary>
/// <param name="userId">Optional. The Id of the user.</param>
/// <param name="role">Optional. The role of the user.</param>
/// <param name="permissions">Optional. The permissions of the user.</param>
/// <returns>The created <see cref="AuthorizationResponse"/>.</returns>
public AuthorizationResponse Create(
Guid? userId = null,
string? role = null,
IReadOnlySet<AuthorizationPermission>? permissions = null)
{
return new AuthorizationResponse(
userId ?? Guid.NewGuid(),
role,
permissions ?? new HashSet<AuthorizationPermission>());
}
/// <summary>
/// Creates a list of <see cref="AuthorizationResponse"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<AuthorizationResponse> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,42 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Responses.Authorization;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Responses.Authorization;
/// <summary>
/// Fixture class for the <see cref="RoleResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class RoleResponseFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="RoleResponse"/>.
/// </summary>
/// <param name="id">Optional. The Id of the role.</param>
/// <param name="roleName">Optional. The name of the role.</param>
/// <returns>The created <see cref="RoleResponse"/>.</returns>
public RoleResponse Create(
Guid? id = null,
string? roleName = null)
{
return new RoleResponse(id ?? Guid.NewGuid(), roleName ?? _faker.Commerce.Department());
}
/// <summary>
/// Creates a list of <see cref="RoleResponse"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<RoleResponse> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,40 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Responses.FileSystemManagement.FileSystem;
using Lumina.Domain.SharedKernel.Common.Enums.FileSystem;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.FileSystem;
/// <summary>
/// Fixture class for the <see cref="FileSystemTypeResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class FileSystemTypeResponseFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="FileSystemTypeResponse"/>.
/// </summary>
/// <param name="platformType">Optional. The type of the file system platform.</param>
/// <returns>The created <see cref="FileSystemTypeResponse"/>.</returns>
public FileSystemTypeResponse Create(
PlatformType? platformType = null)
{
return new FileSystemTypeResponse(platformType ?? _faker.PickRandom<PlatformType>());
}
/// <summary>
/// Creates a list of <see cref="FileSystemTypeResponse"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<FileSystemTypeResponse> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,39 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.Path;
/// <summary>
/// Fixture class for the <see cref="PathExistsResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class PathExistsResponseFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="PathExistsResponse"/>.
/// </summary>
/// <param name="exists">Optional. Whether the path exists.</param>
/// <returns>The created <see cref="PathExistsResponse"/>.</returns>
public PathExistsResponse Create(
bool? exists = null)
{
return new PathExistsResponse(exists ?? _faker.Random.Bool());
}
/// <summary>
/// Creates a list of <see cref="PathExistsResponse"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<PathExistsResponse> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,39 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.Path;
/// <summary>
/// Fixture class for the <see cref="PathValidResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class PathValidResponseFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="PathValidResponse"/>.
/// </summary>
/// <param name="isValid">Optional. Whether the path is valid.</param>
/// <returns>The created <see cref="PathValidResponse"/>.</returns>
public PathValidResponse Create(
bool? isValid = null)
{
return new PathValidResponse(isValid ?? _faker.Random.Bool());
}
/// <summary>
/// Creates a list of <see cref="PathValidResponse"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<PathValidResponse> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,39 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.MediaLibrary.Management;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Responses.MediaLibrary.Management;
/// <summary>
/// Fixture class for the <see cref="MediaLibraryScanResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MediaLibraryScanResponseFixture
{
/// <summary>
/// Creates a random valid <see cref="MediaLibraryScanResponse"/>.
/// </summary>
/// <param name="scanId">Optional. The Id of the media library scan.</param>
/// <param name="libraryId">Optional. The Id of the media library the scan belongs to.</param>
/// <returns>The created <see cref="MediaLibraryScanResponse"/>.</returns>
public MediaLibraryScanResponse Create(
Guid? scanId = null,
Guid? libraryId = null)
{
return new MediaLibraryScanResponse(scanId ?? Guid.NewGuid(), libraryId ?? Guid.NewGuid());
}
/// <summary>
/// Creates a list of <see cref="MediaLibraryScanResponse"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MediaLibraryScanResponse> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,39 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Responses.UsersManagement;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Responses.UsersManagement;
/// <summary>
/// Fixture class for the <see cref="InitializationResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class InitializationResponseFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="InitializationResponse"/>.
/// </summary>
/// <param name="isInitialized">Optional. Whether the application is initialized.</param>
/// <returns>The created <see cref="InitializationResponse"/>.</returns>
public InitializationResponse Create(
bool? isInitialized = null)
{
return new InitializationResponse(isInitialized ?? _faker.Random.Bool());
}
/// <summary>
/// Creates a list of <see cref="InitializationResponse"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<InitializationResponse> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}