mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 14:11:10 +00:00
Renames project paths from Lumina to Nemera
This commit is contained in:
1 parent
ce6fddb4c9
commit
0f659a4877
6450 files changed
No files matched your search
+55
@@ -0,0 +1,55 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.UsersManagement.Authentication.Commands.ChangePassword;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Authentication.Commands.ChangePassword;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ChangePasswordCommand"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ChangePasswordCommandFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid command to change a password.
|
||||
/// </summary>
|
||||
/// <param name="username">Optional. The username.</param>
|
||||
/// <param name="currentPassword">Optional. The current password.</param>
|
||||
/// <param name="newPassword">Optional. The new password.</param>
|
||||
/// <param name="newPasswordConfirm">Optional. The new password confirmation.</param>
|
||||
/// <returns>The created command.</returns>
|
||||
public ChangePasswordCommand Create(
|
||||
string? username = null,
|
||||
string? currentPassword = null,
|
||||
string? newPassword = null,
|
||||
string? newPasswordConfirm = null)
|
||||
{
|
||||
string resolvedCurrentPassword = currentPassword ?? "CurrentP@ss123";
|
||||
string resolvedNewPassword = newPassword ?? "Abcd123$";
|
||||
return new Faker<ChangePasswordCommand>()
|
||||
.CustomInstantiator(f => new ChangePasswordCommand(
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!
|
||||
))
|
||||
.RuleFor(x => x.Username, f => username ?? f.Person.UserName)
|
||||
.RuleFor(x => x.CurrentPassword, resolvedCurrentPassword)
|
||||
.RuleFor(x => x.NewPassword, resolvedNewPassword)
|
||||
.RuleFor(x => x.NewPasswordConfirm, newPasswordConfirm ?? resolvedNewPassword);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="ChangePasswordCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<ChangePasswordCommand> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.UsersManagement.Authentication.Commands.RecoverPassword;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Authentication.Commands.RecoverPassword;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="RecoverPasswordCommand"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RecoverPasswordCommandFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid command to recover a password.
|
||||
/// </summary>
|
||||
/// <param name="username">Optional. The username.</param>
|
||||
/// <param name="totpCode">Optional. The TOTP code.</param>
|
||||
/// <param name="includeTotpCode">Whether the TOTP code should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created command.</returns>
|
||||
public RecoverPasswordCommand Create(string? username = null, string? totpCode = null, bool includeTotpCode = true)
|
||||
{
|
||||
return new Faker<RecoverPasswordCommand>()
|
||||
.CustomInstantiator(f => new RecoverPasswordCommand(
|
||||
default!,
|
||||
default!
|
||||
))
|
||||
.RuleFor(x => x.Username, f => username ?? f.Person.UserName)
|
||||
.RuleFor(x => x.TotpCode, f => includeTotpCode ? (totpCode ?? f.Random.Replace("######")) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="RecoverPasswordCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<RecoverPasswordCommand> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.UsersManagement.Authentication.Commands.RegisterUser;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Authentication.Commands.RegisterUser;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="RegisterUserCommand"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RegisterUserCommandFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid command for a new account registration.
|
||||
/// </summary>
|
||||
/// <param name="username">Optional. The username.</param>
|
||||
/// <param name="password">Optional. The password.</param>
|
||||
/// <param name="passwordConfirm">Optional. The password confirmation.</param>
|
||||
/// <param name="use2fa">Whether to use two-factor authentication.</param>
|
||||
/// <returns>The created command.</returns>
|
||||
public RegisterUserCommand Create(
|
||||
string? username = null,
|
||||
string? password = null,
|
||||
string? passwordConfirm = null,
|
||||
bool use2fa = true)
|
||||
{
|
||||
string resolvedPassword = password ?? "Abcd123$";
|
||||
return new Faker<RegisterUserCommand>()
|
||||
.CustomInstantiator(f => new RegisterUserCommand(
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
true
|
||||
))
|
||||
.RuleFor(x => x.Username, f => username ?? f.Person.UserName)
|
||||
.RuleFor(x => x.Password, resolvedPassword)
|
||||
.RuleFor(x => x.PasswordConfirm, passwordConfirm ?? resolvedPassword)
|
||||
.RuleFor(x => x.Use2fa, use2fa);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="RegisterUserCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<RegisterUserCommand> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.UsersManagement.Authentication.Queries.GetUsers;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Authentication.Queries.GetUsers;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetUsersQuery"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetUsersQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get users.
|
||||
/// </summary>
|
||||
/// <returns>The created query.</returns>
|
||||
public GetUsersQuery Create()
|
||||
{
|
||||
return new GetUsersQuery();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetUsersQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetUsersQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.UsersManagement.Authentication.Queries.LoginUser;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Authentication.Queries.LoginUser;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="LoginUserQuery"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class LoginUserQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid query for user login.
|
||||
/// </summary>
|
||||
/// <param name="username">Optional. The username.</param>
|
||||
/// <param name="password">Optional. The password.</param>
|
||||
/// <param name="includeTotpCode">Whether the TOTP code should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="totpCode">Optional. The TOTP code. When provided, the TOTP code is included even if <paramref name="includeTotpCode"/> is <see langword="false"/>.</param>
|
||||
/// <returns>The created query.</returns>
|
||||
public LoginUserQuery Create(
|
||||
string? username = null,
|
||||
string? password = null,
|
||||
bool includeTotpCode = false,
|
||||
string? totpCode = null)
|
||||
{
|
||||
string resolvedPassword = password ?? "Abcd123$";
|
||||
bool shouldIncludeTotpCode = includeTotpCode || totpCode is not null;
|
||||
Faker<LoginUserQuery> faker = new Faker<LoginUserQuery>()
|
||||
.CustomInstantiator(f => new LoginUserQuery(
|
||||
default!,
|
||||
default!,
|
||||
default
|
||||
))
|
||||
.RuleFor(x => x.Username, f => username ?? f.Person.UserName)
|
||||
.RuleFor(x => x.Password, resolvedPassword);
|
||||
|
||||
if (shouldIncludeTotpCode)
|
||||
faker.RuleFor(x => x.TotpCode, f => totpCode ?? f.Random.Replace("######")); // Generates 6 random digits when no code is pinned.
|
||||
return faker.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="LoginUserQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<LoginUserQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Commands.UpdateUserRoleAndPermissions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Authorization.Commands.UpdateUserRoleAndPermissions;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateUserRoleAndPermissionsCommand"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateUserRoleAndPermissionsCommandFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid command to update user role and permissions.
|
||||
/// </summary>
|
||||
/// <param name="userId">Optional. The user Id.</param>
|
||||
/// <param name="roleId">Optional. The role Id to assign. If null, no role will be assigned.</param>
|
||||
/// <param name="permissions">Optional. The permission Ids to assign.</param>
|
||||
/// <param name="permissionCount">The number of permissions to generate when none are provided.</param>
|
||||
/// <param name="includePermissions">Whether the permissions should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created command.</returns>
|
||||
public UpdateUserRoleAndPermissionsCommand Create(
|
||||
Guid? userId = null,
|
||||
Guid? roleId = null,
|
||||
IEnumerable<Guid>? permissions = null,
|
||||
int permissionCount = 3,
|
||||
bool includePermissions = true)
|
||||
{
|
||||
return new Faker<UpdateUserRoleAndPermissionsCommand>()
|
||||
.CustomInstantiator(f => new UpdateUserRoleAndPermissionsCommand(
|
||||
userId ?? Guid.NewGuid(),
|
||||
roleId,
|
||||
default!))
|
||||
.RuleFor(x => x.Permissions, f => includePermissions
|
||||
? [.. permissions ?? Enumerable.Range(0, permissionCount).Select(_ => Guid.NewGuid())]
|
||||
: null!)
|
||||
.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateUserRoleAndPermissionsCommand"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="UpdateUserRoleAndPermissionsCommand"/> instances.</returns>
|
||||
public List<UpdateUserRoleAndPermissionsCommand> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetAuthorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Authorization.Queries.GetAuthorization;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetAuthorizationQuery"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetAuthorizationQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get authorization details.
|
||||
/// </summary>
|
||||
/// <param name="userId">Optional. The user Id to use. If null, a random GUID will be generated.</param>
|
||||
/// <returns>The created query.</returns>
|
||||
public GetAuthorizationQuery Create(Guid? userId = null)
|
||||
{
|
||||
return new Faker<GetAuthorizationQuery>()
|
||||
.CustomInstantiator(f => new GetAuthorizationQuery(
|
||||
userId ?? f.Random.Guid()
|
||||
))
|
||||
.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetAuthorizationQuery"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetAuthorizationQuery"/> instances.</returns>
|
||||
public List<GetAuthorizationQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserPermissions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Authorization.Queries.GetUserPermissions;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetUserPermissionsQuery"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetUserPermissionsQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get user permissions.
|
||||
/// </summary>
|
||||
/// <param name="userId">Optional. The user Id.</param>
|
||||
/// <param name="includeUserId">Whether the user Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created query.</returns>
|
||||
public GetUserPermissionsQuery Create(Guid? userId = null, bool includeUserId = true)
|
||||
{
|
||||
return new Faker<GetUserPermissionsQuery>()
|
||||
.CustomInstantiator(f => new GetUserPermissionsQuery(
|
||||
includeUserId ? (userId ?? Guid.NewGuid()) : null))
|
||||
.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetUserPermissionsQuery"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetUserPermissionsQuery"/> instances.</returns>
|
||||
public List<GetUserPermissionsQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserRole;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Authorization.Queries.GetUserRole;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetUserRoleQuery"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetUserRoleQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get a user's role.
|
||||
/// </summary>
|
||||
/// <param name="userId">Optional. The user Id.</param>
|
||||
/// <param name="includeUserId">Whether the user Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created query.</returns>
|
||||
public GetUserRoleQuery Create(Guid? userId = null, bool includeUserId = true)
|
||||
{
|
||||
return new Faker<GetUserRoleQuery>()
|
||||
.CustomInstantiator(f => new GetUserRoleQuery(
|
||||
includeUserId ? (userId ?? Guid.NewGuid()) : null))
|
||||
.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetUserRoleQuery"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetUserRoleQuery"/> instances.</returns>
|
||||
public List<GetUserRoleQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.UsersManagement.Settings.Commands.UpdatePlaybackState;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Settings.Commands.UpdatePlaybackState;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdatePlaybackStateCommand"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdatePlaybackStateCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid command to update the playback state the player reports for the current user.
|
||||
/// </summary>
|
||||
/// <param name="volume">Optional. The last volume the player reported, as a value between 0 and 1.</param>
|
||||
/// <param name="isMuted">Optional. The last mute state the player reported.</param>
|
||||
/// <param name="includeVolume">Whether the volume should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsMuted">Whether the mute state should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="UpdatePlaybackStateCommand"/>.</returns>
|
||||
public UpdatePlaybackStateCommand Create(
|
||||
double? volume = null,
|
||||
bool? isMuted = null,
|
||||
bool includeVolume = true,
|
||||
bool includeIsMuted = true)
|
||||
{
|
||||
return new UpdatePlaybackStateCommand(
|
||||
includeVolume ? volume ?? _faker.Random.Double(0, 1) : null,
|
||||
includeIsMuted ? isMuted ?? _faker.Random.Bool() : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdatePlaybackStateCommand"/> instances.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="UpdatePlaybackStateCommand"/> instances.</returns>
|
||||
public List<UpdatePlaybackStateCommand> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.UsersManagement.Settings.Commands.UpdateUserSettings;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Playback;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Settings.Commands.UpdateUserSettings;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateUserSettingsCommand"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateUserSettingsCommandFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid command to update the settings of the current user.
|
||||
/// </summary>
|
||||
/// <param name="isPaginationEnabled">Optional. Whether pagination is enabled for the user, or not.</param>
|
||||
/// <param name="itemsPerPage">Optional. The number of library items displayed per page when pagination is enabled.</param>
|
||||
/// <param name="shouldIgnoreThePrefixForAlphaPicker">Optional. Whether the "The" prefix is ignored by the alpha picker, or not.</param>
|
||||
/// <param name="isThemeCachingEnabled">Optional. Whether the theme data served to this user is cached, or not.</param>
|
||||
/// <param name="shouldAggregateMetadataWhenMissing">Optional. Whether the metadata of the media library items is aggregated from multiple providers, when fields are missing.</param>
|
||||
/// <param name="shouldAggregateArtworkWhenMissing">Optional. Whether the artwork of the media library items is aggregated from multiple providers, when it is missing.</param>
|
||||
/// <param name="shouldRenderPdfAsImages">Optional. Whether PDF books are rendered as page images for the user.</param>
|
||||
/// <param name="shouldPreserveBookStyles">Optional. Whether the styles of the book content are preserved when it is rendered for the user.</param>
|
||||
/// <param name="shouldKeepDownloadingWhilePaused">Optional. Whether the player keeps downloading a track while playback is paused, or not.</param>
|
||||
/// <param name="shouldAutoplay">Optional. Whether the player continues playback at the end of an album or artist, or not.</param>
|
||||
/// <param name="isGaplessPlaybackEnabled">Optional. Whether the player transitions between consecutive tracks without a gap, or not.</param>
|
||||
/// <param name="replayGainMode">Optional. The way ReplayGain normalization is applied to the tracks the user plays.</param>
|
||||
/// <param name="streamingQuality">Optional. The quality cap applied to the audio the server normalizes for the user.</param>
|
||||
/// <param name="vuMeterOrientation">Optional. The direction in which each channel of the VU meter of the audio player grows.</param>
|
||||
/// <param name="vuMeterSegmentCount">Optional. The number of segments each channel of the VU meter is divided into.</param>
|
||||
/// <param name="vuMeterSegmentGap">Optional. The gap, in pixels, between the segments and the channels of the VU meter.</param>
|
||||
/// <param name="vuMeterMediumThreshold">Optional. The level above which a segment of the VU meter is drawn with its medium state.</param>
|
||||
/// <param name="vuMeterHighThreshold">Optional. The level above which a segment of the VU meter is drawn with its high state.</param>
|
||||
/// <param name="vuMeterShowPeak">Optional. Whether the VU meter holds the peak level of each channel after it falls.</param>
|
||||
/// <param name="vuMeterPeakHoldDurationInMilliseconds">Optional. The time a peak of the VU meter is held before it starts falling.</param>
|
||||
/// <param name="vuMeterReleasePerSecond">Optional. The number of level units the display of the VU meter falls per second when the input level drops.</param>
|
||||
/// <param name="vuMeterPeakReleasePerSecond">Optional. The number of level units the peak of the VU meter falls per second after its hold time elapsed.</param>
|
||||
/// <param name="includeVuMeterOrientation">Whether to generate the VU meter orientation, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterSegmentCount">Whether to generate the VU meter segment count, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterSegmentGap">Whether to generate the VU meter segment gap, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterMediumThreshold">Whether to generate the VU meter medium threshold, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterHighThreshold">Whether to generate the VU meter high threshold, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterShowPeak">Whether to generate the VU meter peak marker setting, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterPeakHoldDurationInMilliseconds">Whether to generate the VU meter peak hold duration, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterReleasePerSecond">Whether to generate the VU meter release rate, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterPeakReleasePerSecond">Whether to generate the VU meter peak release rate, or leave it <see langword="null"/>.</param>
|
||||
/// <returns>The created command.</returns>
|
||||
public UpdateUserSettingsCommand Create(
|
||||
bool? isPaginationEnabled = null,
|
||||
int? itemsPerPage = null,
|
||||
bool? shouldIgnoreThePrefixForAlphaPicker = null,
|
||||
bool? isThemeCachingEnabled = null,
|
||||
bool? shouldAggregateMetadataWhenMissing = null,
|
||||
bool? shouldAggregateArtworkWhenMissing = null,
|
||||
bool? shouldRenderPdfAsImages = null,
|
||||
bool? shouldPreserveBookStyles = null,
|
||||
bool? shouldKeepDownloadingWhilePaused = null,
|
||||
bool? shouldAutoplay = null,
|
||||
bool? isGaplessPlaybackEnabled = null,
|
||||
ReplayGainMode? replayGainMode = null,
|
||||
PlaybackStreamingQuality? streamingQuality = null,
|
||||
VuMeterOrientation? vuMeterOrientation = null,
|
||||
int? vuMeterSegmentCount = null,
|
||||
int? vuMeterSegmentGap = null,
|
||||
double? vuMeterMediumThreshold = null,
|
||||
double? vuMeterHighThreshold = null,
|
||||
bool? vuMeterShowPeak = null,
|
||||
int? vuMeterPeakHoldDurationInMilliseconds = null,
|
||||
double? vuMeterReleasePerSecond = null,
|
||||
double? vuMeterPeakReleasePerSecond = null,
|
||||
bool includeVuMeterOrientation = true,
|
||||
bool includeVuMeterSegmentCount = true,
|
||||
bool includeVuMeterSegmentGap = true,
|
||||
bool includeVuMeterMediumThreshold = true,
|
||||
bool includeVuMeterHighThreshold = true,
|
||||
bool includeVuMeterShowPeak = true,
|
||||
bool includeVuMeterPeakHoldDurationInMilliseconds = true,
|
||||
bool includeVuMeterReleasePerSecond = true,
|
||||
bool includeVuMeterPeakReleasePerSecond = true)
|
||||
{
|
||||
// The high threshold is generated from the medium one, so a randomized command always describes a valid meter.
|
||||
double? mediumThreshold = includeVuMeterMediumThreshold
|
||||
? vuMeterMediumThreshold ?? Random.Shared.NextDouble()
|
||||
: null;
|
||||
double? highThreshold = includeVuMeterHighThreshold
|
||||
? vuMeterHighThreshold ?? (mediumThreshold is null ? Random.Shared.NextDouble() : mediumThreshold.Value + Random.Shared.NextDouble() * (1 - mediumThreshold.Value))
|
||||
: null;
|
||||
return new Faker<UpdateUserSettingsCommand>()
|
||||
.CustomInstantiator(f => new UpdateUserSettingsCommand(default, default, default, default, default, default, default, default, default, default, default, default, default, default, default, default, default, default, default, default, default, default))
|
||||
.RuleFor(x => x.IsPaginationEnabled, f => isPaginationEnabled ?? f.Random.Bool())
|
||||
.RuleFor(x => x.ItemsPerPage, f => itemsPerPage ?? f.Random.Int(1, 100))
|
||||
.RuleFor(x => x.ShouldIgnoreThePrefixForAlphaPicker, f => shouldIgnoreThePrefixForAlphaPicker ?? f.Random.Bool())
|
||||
.RuleFor(x => x.IsThemeCachingEnabled, f => isThemeCachingEnabled ?? f.Random.Bool())
|
||||
.RuleFor(x => x.ShouldAggregateMetadataWhenMissing, f => shouldAggregateMetadataWhenMissing ?? f.Random.Bool())
|
||||
.RuleFor(x => x.ShouldAggregateArtworkWhenMissing, f => shouldAggregateArtworkWhenMissing ?? f.Random.Bool())
|
||||
.RuleFor(x => x.ShouldRenderPdfAsImages, f => shouldRenderPdfAsImages ?? f.Random.Bool())
|
||||
.RuleFor(x => x.ShouldPreserveBookStyles, f => shouldPreserveBookStyles ?? f.Random.Bool())
|
||||
.RuleFor(x => x.ShouldKeepDownloadingWhilePaused, f => shouldKeepDownloadingWhilePaused ?? f.Random.Bool())
|
||||
.RuleFor(x => x.ShouldAutoplay, f => shouldAutoplay ?? f.Random.Bool())
|
||||
.RuleFor(x => x.IsGaplessPlaybackEnabled, f => isGaplessPlaybackEnabled ?? f.Random.Bool())
|
||||
.RuleFor(x => x.ReplayGainMode, f => replayGainMode ?? f.PickRandom<ReplayGainMode>())
|
||||
.RuleFor(x => x.StreamingQuality, f => streamingQuality ?? f.PickRandom<PlaybackStreamingQuality>())
|
||||
.RuleFor(x => x.VuMeterOrientation, f => includeVuMeterOrientation ? vuMeterOrientation ?? f.PickRandom<VuMeterOrientation>() : null)
|
||||
.RuleFor(x => x.VuMeterSegmentCount, f => includeVuMeterSegmentCount ? vuMeterSegmentCount ?? f.Random.Int(1, 128) : null)
|
||||
.RuleFor(x => x.VuMeterSegmentGap, f => includeVuMeterSegmentGap ? vuMeterSegmentGap ?? f.Random.Int(0, 32) : null)
|
||||
.RuleFor(x => x.VuMeterMediumThreshold, f => mediumThreshold)
|
||||
.RuleFor(x => x.VuMeterHighThreshold, f => highThreshold)
|
||||
.RuleFor(x => x.VuMeterShowPeak, f => includeVuMeterShowPeak ? vuMeterShowPeak ?? f.Random.Bool() : null)
|
||||
.RuleFor(x => x.VuMeterPeakHoldDurationInMilliseconds, f => includeVuMeterPeakHoldDurationInMilliseconds ? vuMeterPeakHoldDurationInMilliseconds ?? f.Random.Int(0, 10000) : null)
|
||||
.RuleFor(x => x.VuMeterReleasePerSecond, f => includeVuMeterReleasePerSecond ? vuMeterReleasePerSecond ?? f.Random.Double(0, 100) : null)
|
||||
.RuleFor(x => x.VuMeterPeakReleasePerSecond, f => includeVuMeterPeakReleasePerSecond ? vuMeterPeakReleasePerSecond ?? f.Random.Double(0, 100) : null)
|
||||
.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateUserSettingsCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdateUserSettingsCommand> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.UsersManagement.Settings.Queries.GetPlaybackState;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Settings.Queries.GetPlaybackState;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetPlaybackStateQuery"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetPlaybackStateQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GetPlaybackStateQuery"/> instance.
|
||||
/// </summary>
|
||||
/// <returns>The created <see cref="GetPlaybackStateQuery"/>.</returns>
|
||||
public GetPlaybackStateQuery Create()
|
||||
{
|
||||
return new GetPlaybackStateQuery();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetPlaybackStateQuery"/> instances.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetPlaybackStateQuery"/> instances.</returns>
|
||||
public List<GetPlaybackStateQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.UsersManagement.Settings.Queries.GetUserSettings;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.UsersManagement.Settings.Queries.GetUserSettings;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetUserSettingsQuery"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetUserSettingsQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get the settings of the current user.
|
||||
/// </summary>
|
||||
/// <returns>The created query.</returns>
|
||||
public GetUserSettingsQuery Create()
|
||||
{
|
||||
return new GetUserSettingsQuery();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetUserSettingsQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetUserSettingsQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user