mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
Standardizes test conventions and documentation
This commit is contained in:
1 parent
7aeed04255
commit
f42dc709de
190 files changed
+2180
-2814
No files matched your search
+6
-3
@@ -15,17 +15,20 @@ namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Authorization;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddRoleRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="AddRoleRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="roleName">Optional name of the role.</param>
|
||||
/// <param name="permissions">Optional collection of permission identifiers.</param>
|
||||
/// <returns>A configured <see cref="AddRoleRequest"/> instance.</returns>
|
||||
public AddRoleRequest Create(string? roleName = null, List<Guid>? permissions = null)
|
||||
public AddRoleRequest Create(
|
||||
string? roleName = null,
|
||||
List<Guid>? permissions = null)
|
||||
{
|
||||
Faker faker = new();
|
||||
return new AddRoleRequest(
|
||||
RoleName: roleName ?? faker.Commerce.Department(),
|
||||
RoleName: roleName ?? _faker.Commerce.Department(),
|
||||
Permissions: permissions ?? [Guid.NewGuid(), Guid.NewGuid()]
|
||||
);
|
||||
}
|
||||
|
||||
+3
-4
@@ -1,5 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.Enums.Common;
|
||||
using Lumina.Presentation.Web.Common.Requests.Libraries;
|
||||
using System;
|
||||
@@ -24,7 +23,7 @@ public class GetBooksLiteRequestFixture
|
||||
/// <param name="perPage">Optional number of books to retrieve per page.</param>
|
||||
/// <param name="searchTerm">Optional search term used to filter results.</param>
|
||||
/// <param name="filterAlphaKey">Optional alpha key used to filter the results.</param>
|
||||
/// <param name="ignoreThePrefixForAlphaPicker">Whether the leading "The " prefix is ignored by the alpha picker.</param>
|
||||
/// <param name="shouldIgnoreThePrefixForAlphaPicker">Whether the leading "The " prefix is ignored by the alpha picker.</param>
|
||||
/// <param name="sortBy">Optional name of the field by which to sort the results.</param>
|
||||
/// <param name="sortOrder">Optional direction in which to sort the results.</param>
|
||||
/// <returns>A configured <see cref="GetBooksLiteRequest"/> instance.</returns>
|
||||
@@ -34,7 +33,7 @@ public class GetBooksLiteRequestFixture
|
||||
int? perPage = null,
|
||||
string? searchTerm = null,
|
||||
string? filterAlphaKey = null,
|
||||
bool ignoreThePrefixForAlphaPicker = false,
|
||||
bool shouldIgnoreThePrefixForAlphaPicker = false,
|
||||
string? sortBy = null,
|
||||
SortOrder? sortOrder = null)
|
||||
{
|
||||
@@ -45,7 +44,7 @@ public class GetBooksLiteRequestFixture
|
||||
PerPage = perPage,
|
||||
SearchTerm = searchTerm,
|
||||
FilterAlphaKey = filterAlphaKey,
|
||||
IgnoreThePrefixForAlphaPicker = ignoreThePrefixForAlphaPicker,
|
||||
ShouldIgnoreThePrefixForAlphaPicker = shouldIgnoreThePrefixForAlphaPicker,
|
||||
SortBy = sortBy,
|
||||
SortOrder = sortOrder
|
||||
};
|
||||
|
||||
+5
-3
@@ -14,16 +14,18 @@ namespace Lumina.Presentation.Web.Fixtures.Common.Requests.UsersManagement.Authe
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class LoginViewRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="LoginViewRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="returnUrl">Optional URL to return to, after login.</param>
|
||||
/// <returns>A configured <see cref="LoginViewRequest"/> instance.</returns>
|
||||
public LoginViewRequest Create(string? returnUrl = null)
|
||||
public LoginViewRequest Create(
|
||||
string? returnUrl = null)
|
||||
{
|
||||
Faker faker = new();
|
||||
return new LoginViewRequest(
|
||||
ReturnUrl: returnUrl ?? $"/{faker.Random.AlphaNumeric(8)}"
|
||||
ReturnUrl: returnUrl ?? $"/{_faker.Random.AlphaNumeric(8)}"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+10
-5
@@ -14,6 +14,8 @@ namespace Lumina.Presentation.Web.Fixtures.Common.Requests.UsersManagement;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ChangePasswordRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ChangePasswordRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
@@ -22,13 +24,16 @@ public class ChangePasswordRequestFixture
|
||||
/// <param name="newPassword">Optional new password.</param>
|
||||
/// <param name="newPasswordConfirm">Optional confirmation of the new password.</param>
|
||||
/// <returns>A configured <see cref="ChangePasswordRequest"/> instance.</returns>
|
||||
public ChangePasswordRequest Create(string? username = null, string? currentPassword = null, string? newPassword = null, string? newPasswordConfirm = null)
|
||||
public ChangePasswordRequest Create(
|
||||
string? username = null,
|
||||
string? currentPassword = null,
|
||||
string? newPassword = null,
|
||||
string? newPasswordConfirm = null)
|
||||
{
|
||||
Faker faker = new();
|
||||
string generatedNewPassword = newPassword ?? faker.Internet.Password(12);
|
||||
string generatedNewPassword = newPassword ?? _faker.Internet.Password(12);
|
||||
return new ChangePasswordRequest(
|
||||
Username: username ?? faker.Internet.UserName(),
|
||||
CurrentPassword: currentPassword ?? faker.Internet.Password(12),
|
||||
Username: username ?? _faker.Internet.UserName(),
|
||||
CurrentPassword: currentPassword ?? _faker.Internet.Password(12),
|
||||
NewPassword: generatedNewPassword,
|
||||
NewPasswordConfirm: newPasswordConfirm ?? generatedNewPassword
|
||||
);
|
||||
|
||||
+9
-4
@@ -14,6 +14,8 @@ namespace Lumina.Presentation.Web.Fixtures.Common.Requests.UsersManagement;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class LoginRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="LoginRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
@@ -22,12 +24,15 @@ public class LoginRequestFixture
|
||||
/// <param name="totpCode">Optional TOTP code.</param>
|
||||
/// <param name="returnUrl">Optional URL to return to, after login.</param>
|
||||
/// <returns>A configured <see cref="LoginRequest"/> instance.</returns>
|
||||
public LoginRequest Create(string? username = null, string? password = null, string? totpCode = null, string? returnUrl = null)
|
||||
public LoginRequest Create(
|
||||
string? username = null,
|
||||
string? password = null,
|
||||
string? totpCode = null,
|
||||
string? returnUrl = null)
|
||||
{
|
||||
Faker faker = new();
|
||||
return new LoginRequest(
|
||||
Username: username ?? faker.Internet.UserName(),
|
||||
Password: password ?? faker.Internet.Password(12),
|
||||
Username: username ?? _faker.Internet.UserName(),
|
||||
Password: password ?? _faker.Internet.Password(12),
|
||||
TotpCode: totpCode,
|
||||
ReturnUrl: returnUrl
|
||||
);
|
||||
|
||||
+6
-3
@@ -14,17 +14,20 @@ namespace Lumina.Presentation.Web.Fixtures.Common.Requests.UsersManagement;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RecoverPasswordRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="RecoverPasswordRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="username">Optional username.</param>
|
||||
/// <param name="totpCode">Optional TOTP code.</param>
|
||||
/// <returns>A configured <see cref="RecoverPasswordRequest"/> instance.</returns>
|
||||
public RecoverPasswordRequest Create(string? username = null, string? totpCode = null)
|
||||
public RecoverPasswordRequest Create(
|
||||
string? username = null,
|
||||
string? totpCode = null)
|
||||
{
|
||||
Faker faker = new();
|
||||
return new RecoverPasswordRequest(
|
||||
Username: username ?? faker.Internet.UserName(),
|
||||
Username: username ?? _faker.Internet.UserName(),
|
||||
TotpCode: totpCode
|
||||
);
|
||||
}
|
||||
|
||||
+10
-4
@@ -14,6 +14,8 @@ namespace Lumina.Presentation.Web.Fixtures.Common.Requests.UsersManagement;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RegisterRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="RegisterRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
@@ -23,12 +25,16 @@ public class RegisterRequestFixture
|
||||
/// <param name="registrationType">Optional registration type, e.g. "Admin" or "User".</param>
|
||||
/// <param name="use2fa">Whether two-factor authentication is enabled for the account.</param>
|
||||
/// <returns>A configured <see cref="RegisterRequest"/> instance.</returns>
|
||||
public RegisterRequest Create(string? username = null, string? password = null, string? passwordConfirm = null, string? registrationType = "User", bool use2fa = true)
|
||||
public RegisterRequest Create(
|
||||
string? username = null,
|
||||
string? password = null,
|
||||
string? passwordConfirm = null,
|
||||
string? registrationType = "User",
|
||||
bool use2fa = true)
|
||||
{
|
||||
Faker faker = new();
|
||||
string generatedPassword = password ?? faker.Internet.Password(12);
|
||||
string generatedPassword = password ?? _faker.Internet.Password(12);
|
||||
return new RegisterRequest(
|
||||
Username: username ?? faker.Internet.UserName(),
|
||||
Username: username ?? _faker.Internet.UserName(),
|
||||
Password: generatedPassword,
|
||||
PasswordConfirm: passwordConfirm ?? generatedPassword,
|
||||
RegistrationType: registrationType,
|
||||
|
||||
Reference in new issue
Block a user