mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 16: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
+59
@@ -0,0 +1,59 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Authentication;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ChangePasswordRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ChangePasswordRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="ChangePasswordRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="username">Optional. The username for the password change.</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>
|
||||
/// <param name="includeUsername">Whether the username should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCurrentPassword">Whether the current password should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeNewPassword">Whether the new password should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeNewPasswordConfirm">Whether the new password confirmation should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="ChangePasswordRequest"/>.</returns>
|
||||
public ChangePasswordRequest Create(
|
||||
string? username = null,
|
||||
string? currentPassword = null,
|
||||
string? newPassword = null,
|
||||
string? newPasswordConfirm = null,
|
||||
bool includeUsername = true,
|
||||
bool includeCurrentPassword = true,
|
||||
bool includeNewPassword = true,
|
||||
bool includeNewPasswordConfirm = true)
|
||||
{
|
||||
string generatedNewPassword = newPassword ?? _faker.Internet.Password();
|
||||
return new ChangePasswordRequest(
|
||||
includeUsername ? (username ?? _faker.Internet.UserName()) : null,
|
||||
includeCurrentPassword ? (currentPassword ?? _faker.Internet.Password()) : null,
|
||||
includeNewPassword ? generatedNewPassword : null,
|
||||
includeNewPasswordConfirm ? (newPasswordConfirm ?? generatedNewPassword) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="ChangePasswordRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<ChangePasswordRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Authentication;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="LoginRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class LoginRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="LoginRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="username">Optional. The username for login.</param>
|
||||
/// <param name="password">Optional. The password for login.</param>
|
||||
/// <param name="totpCode">Optional. The TOTP code for two-factor authentication.</param>
|
||||
/// <param name="includeUsername">Whether the username should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePassword">Whether the password should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeTotpCode">Whether the TOTP code should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="LoginRequest"/>.</returns>
|
||||
public LoginRequest Create(
|
||||
string? username = null,
|
||||
string? password = null,
|
||||
string? totpCode = null,
|
||||
bool includeUsername = true,
|
||||
bool includePassword = true,
|
||||
bool includeTotpCode = true)
|
||||
{
|
||||
return new LoginRequest(
|
||||
includeUsername ? (username ?? _faker.Internet.UserName()) : null,
|
||||
includePassword ? (password ?? _faker.Internet.Password()) : null,
|
||||
includeTotpCode ? (totpCode ?? _faker.Random.Number(100000, 999999).ToString()) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="LoginRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<LoginRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Authentication;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="RecoverPasswordRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RecoverPasswordRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="RecoverPasswordRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="username">Optional. The username for password recovery.</param>
|
||||
/// <param name="totpCode">Optional. The TOTP code for verification.</param>
|
||||
/// <param name="includeUsername">Whether the username should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeTotpCode">Whether the TOTP code should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="RecoverPasswordRequest"/>.</returns>
|
||||
public RecoverPasswordRequest Create(
|
||||
string? username = null,
|
||||
string? totpCode = null,
|
||||
bool includeUsername = true,
|
||||
bool includeTotpCode = true)
|
||||
{
|
||||
return new RecoverPasswordRequest(
|
||||
includeUsername ? (username ?? _faker.Internet.UserName()) : null,
|
||||
includeTotpCode ? (totpCode ?? _faker.Random.Number(100000, 999999).ToString()) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="RecoverPasswordRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<RecoverPasswordRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Authentication;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Authentication;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="RegistrationRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RegistrationRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="RegistrationRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="username">Optional. The username for registration.</param>
|
||||
/// <param name="password">Optional. The password for registration.</param>
|
||||
/// <param name="passwordConfirm">Optional. The password confirmation.</param>
|
||||
/// <param name="use2fa">Optional. Whether to use two-factor authentication.</param>
|
||||
/// <param name="includeUsername">Whether the username should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePassword">Whether the password should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePasswordConfirm">Whether the password confirmation should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="RegistrationRequest"/>.</returns>
|
||||
public RegistrationRequest Create(
|
||||
string? username = null,
|
||||
string? password = null,
|
||||
string? passwordConfirm = null,
|
||||
bool? use2fa = null,
|
||||
bool includeUsername = true,
|
||||
bool includePassword = true,
|
||||
bool includePasswordConfirm = true)
|
||||
{
|
||||
string generatedPassword = password ?? _faker.Internet.Password();
|
||||
return new RegistrationRequest(
|
||||
includeUsername ? (username ?? _faker.Internet.UserName()) : null,
|
||||
includePassword ? generatedPassword : null,
|
||||
includePasswordConfirm ? (passwordConfirm ?? generatedPassword) : null,
|
||||
use2fa ?? _faker.Random.Bool()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="RegistrationRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<RegistrationRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AddRoleRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddRoleRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="AddRoleRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="roleName">Optional. The name of the role.</param>
|
||||
/// <param name="permissions">Optional. The Ids of the permissions granted to the role.</param>
|
||||
/// <param name="includePermissions">Whether the permissions should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="AddRoleRequest"/>.</returns>
|
||||
public AddRoleRequest Create(
|
||||
string? roleName = null,
|
||||
List<Guid>? permissions = null,
|
||||
bool includePermissions = true)
|
||||
{
|
||||
return new AddRoleRequest(roleName ?? _faker.Commerce.Department(), includePermissions ? (permissions ?? []) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="AddRoleRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<AddRoleRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="DeleteRoleRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class DeleteRoleRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="DeleteRoleRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="roleId">Optional. The Id of the role to delete.</param>
|
||||
/// <param name="includeRoleId">Whether the role Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="DeleteRoleRequest"/>.</returns>
|
||||
public DeleteRoleRequest Create(
|
||||
Guid? roleId = null,
|
||||
bool includeRoleId = true)
|
||||
{
|
||||
return new DeleteRoleRequest(includeRoleId ? (roleId ?? Guid.NewGuid()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="DeleteRoleRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<DeleteRoleRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetAuthorizationRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetAuthorizationRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a <see cref="GetAuthorizationRequest"/> with default or specified values.
|
||||
/// </summary>
|
||||
/// <param name="userId">Optional. The user Id to use.</param>
|
||||
/// <param name="includeUserId">Whether the user Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetAuthorizationRequest"/>.</returns>
|
||||
public GetAuthorizationRequest Create(Guid? userId = null, bool includeUserId = true)
|
||||
{
|
||||
return new GetAuthorizationRequest(
|
||||
UserId: includeUserId ? (userId ?? Guid.NewGuid()) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetAuthorizationRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetAuthorizationRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetRolePermissionsRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetRolePermissionsRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetRolePermissionsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="roleId">The Id of the role whose permissions are retrieved.</param>
|
||||
/// <returns>The created <see cref="GetRolePermissionsRequest"/>.</returns>
|
||||
public GetRolePermissionsRequest Create(
|
||||
Guid? roleId = null)
|
||||
{
|
||||
return new GetRolePermissionsRequest(roleId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetRolePermissionsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetRolePermissionsRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetUserPermissionsRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetUserPermissionsRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetUserPermissionsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="userId">Optional. The Id of the user whose permissions are retrieved.</param>
|
||||
/// <param name="includeUserId">Whether the user Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetUserPermissionsRequest"/>.</returns>
|
||||
public GetUserPermissionsRequest Create(
|
||||
Guid? userId = null,
|
||||
bool includeUserId = true)
|
||||
{
|
||||
return new GetUserPermissionsRequest(includeUserId ? (userId ?? Guid.NewGuid()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetUserPermissionsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetUserPermissionsRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetUserRoleRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetUserRoleRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetUserRoleRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="userId">Optional. The Id of the user whose role is retrieved.</param>
|
||||
/// <param name="includeUserId">Whether the user Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetUserRoleRequest"/>.</returns>
|
||||
public GetUserRoleRequest Create(
|
||||
Guid? userId = null,
|
||||
bool includeUserId = true)
|
||||
{
|
||||
return new GetUserRoleRequest(includeUserId ? (userId ?? Guid.NewGuid()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetUserRoleRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetUserRoleRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateRoleRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateRoleRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="UpdateRoleRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="roleId">Optional. The Id of the role to update.</param>
|
||||
/// <param name="roleName">Optional. The name of the role.</param>
|
||||
/// <param name="permissions">Optional. The Ids of the permissions of the role.</param>
|
||||
/// <returns>The created <see cref="UpdateRoleRequest"/>.</returns>
|
||||
public UpdateRoleRequest Create(
|
||||
Guid? roleId = null,
|
||||
string? roleName = null,
|
||||
List<Guid>? permissions = null)
|
||||
{
|
||||
return new UpdateRoleRequest(
|
||||
roleId ?? Guid.NewGuid(),
|
||||
roleName ?? _faker.Random.Word(),
|
||||
permissions ?? [Guid.NewGuid(), Guid.NewGuid()]
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateRoleRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdateRoleRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateUserRoleAndPermissionsRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateUserRoleAndPermissionsRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="UpdateUserRoleAndPermissionsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="userId">Optional. The Id of the user whose role and permissions are updated.</param>
|
||||
/// <param name="roleId">Optional. The Id of the role assigned to the user.</param>
|
||||
/// <param name="permissions">Optional. The Ids of the permissions assigned to the user.</param>
|
||||
/// <param name="includeRoleId">Whether the role Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="UpdateUserRoleAndPermissionsRequest"/>.</returns>
|
||||
public UpdateUserRoleAndPermissionsRequest Create(
|
||||
Guid? userId = null,
|
||||
Guid? roleId = null,
|
||||
List<Guid>? permissions = null,
|
||||
bool includeRoleId = true)
|
||||
{
|
||||
return new UpdateUserRoleAndPermissionsRequest(
|
||||
userId ?? Guid.NewGuid(),
|
||||
includeRoleId ? (roleId ?? Guid.NewGuid()) : null,
|
||||
permissions ?? [Guid.NewGuid(), Guid.NewGuid()]
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateUserRoleAndPermissionsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdateUserRoleAndPermissionsRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Favorites;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Favorites;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Favorites;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AddFavoriteRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddFavoriteRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly FavoriteMediaKind[] _supportedMediaKinds =
|
||||
[
|
||||
FavoriteMediaKind.MusicArtist,
|
||||
FavoriteMediaKind.MusicAlbum,
|
||||
FavoriteMediaKind.MusicTrack,
|
||||
FavoriteMediaKind.Book
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="AddFavoriteRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="mediaKind">Optional. The kind of the media item to favorite. Defaults to a random supported kind.</param>
|
||||
/// <param name="mediaItemId">Optional. The Id of the media item to favorite.</param>
|
||||
/// <param name="includeMediaKind">Whether the media kind should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaItemId">Whether the media item Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="AddFavoriteRequest"/>.</returns>
|
||||
public AddFavoriteRequest Create(
|
||||
FavoriteMediaKind? mediaKind = null,
|
||||
Guid? mediaItemId = null,
|
||||
bool includeMediaKind = true,
|
||||
bool includeMediaItemId = true)
|
||||
{
|
||||
return new AddFavoriteRequest(
|
||||
includeMediaKind ? (mediaKind ?? _faker.Random.ArrayElement(_supportedMediaKinds)) : null,
|
||||
includeMediaItemId ? (mediaItemId ?? _faker.Random.Guid()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="AddFavoriteRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="AddFavoriteRequest"/> instances.</returns>
|
||||
public List<AddFavoriteRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Favorites;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Favorites;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Favorites;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetFavoriteStatusRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetFavoriteStatusRequestFixture
|
||||
{
|
||||
private const int DEFAULT_MEDIA_ITEM_COUNT = 3;
|
||||
|
||||
private readonly Faker _faker = new();
|
||||
private readonly FavoriteMediaKind[] _supportedMediaKinds =
|
||||
[
|
||||
FavoriteMediaKind.MusicArtist,
|
||||
FavoriteMediaKind.MusicAlbum,
|
||||
FavoriteMediaKind.MusicTrack,
|
||||
FavoriteMediaKind.Book
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetFavoriteStatusRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="mediaKind">Optional. The kind of the media items to check. Defaults to a random supported kind.</param>
|
||||
/// <param name="mediaItemIds">Optional. The Ids of the media items to check. Defaults to a bounded list of random Ids.</param>
|
||||
/// <param name="includeMediaKind">Whether the media kind should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaItemIds">Whether the media item Ids should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetFavoriteStatusRequest"/>.</returns>
|
||||
public GetFavoriteStatusRequest Create(
|
||||
FavoriteMediaKind? mediaKind = null,
|
||||
List<Guid>? mediaItemIds = null,
|
||||
bool includeMediaKind = true,
|
||||
bool includeMediaItemIds = true)
|
||||
{
|
||||
return new GetFavoriteStatusRequest(
|
||||
includeMediaKind ? (mediaKind ?? _faker.Random.ArrayElement(_supportedMediaKinds)) : null,
|
||||
includeMediaItemIds ? (mediaItemIds ?? CreateRandomMediaItemIds()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetFavoriteStatusRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetFavoriteStatusRequest"/> instances.</returns>
|
||||
public List<GetFavoriteStatusRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a bounded list of random media item Ids.
|
||||
/// </summary>
|
||||
/// <returns>The created list of media item Ids.</returns>
|
||||
private List<Guid> CreateRandomMediaItemIds()
|
||||
{
|
||||
return [.. Enumerable.Range(0, DEFAULT_MEDIA_ITEM_COUNT).Select(_ => _faker.Random.Guid())];
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Favorites;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Favorites;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Favorites;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetFavoritesRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetFavoritesRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly FavoriteMediaKind[] _supportedMediaKinds =
|
||||
[
|
||||
FavoriteMediaKind.MusicArtist,
|
||||
FavoriteMediaKind.MusicAlbum,
|
||||
FavoriteMediaKind.MusicTrack,
|
||||
FavoriteMediaKind.Book
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetFavoritesRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="mediaKind">Optional. The kind of media item to restrict the favorites to. Defaults to a random supported kind.</param>
|
||||
/// <param name="currentPage">Optional. The one based page of favorites to return. Defaults to a bounded random page.</param>
|
||||
/// <param name="perPage">Optional. The number of favorites per page. Defaults to a bounded random page size.</param>
|
||||
/// <param name="includeMediaKind">Whether the media kind should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCurrentPage">Whether the current page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePerPage">Whether the per page count should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetFavoritesRequest"/>.</returns>
|
||||
public GetFavoritesRequest Create(
|
||||
FavoriteMediaKind? mediaKind = null,
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
bool includeMediaKind = true,
|
||||
bool includeCurrentPage = true,
|
||||
bool includePerPage = true)
|
||||
{
|
||||
return new GetFavoritesRequest(
|
||||
includeMediaKind ? (mediaKind ?? _faker.Random.ArrayElement(_supportedMediaKinds)) : null,
|
||||
includeCurrentPage ? (currentPage ?? _faker.Random.Int(1, 100)) : null,
|
||||
includePerPage ? (perPage ?? _faker.Random.Int(1, 200)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetFavoritesRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetFavoritesRequest"/> instances.</returns>
|
||||
public List<GetFavoritesRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Directories;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetDirectoriesRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetDirectoriesRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="GetDirectoriesRequest"/> with default or random values.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The file system path for which to get the directories.</param>
|
||||
/// <param name="shouldIncludeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||
/// <returns>The created <see cref="GetDirectoriesRequest"/>.</returns>
|
||||
public GetDirectoriesRequest Create(
|
||||
string? path = null,
|
||||
bool? shouldIncludeHiddenElements = null)
|
||||
{
|
||||
return new GetDirectoriesRequest(
|
||||
Path: path ?? _faker.System.FilePath(),
|
||||
ShouldIncludeHiddenElements: shouldIncludeHiddenElements ?? _faker.Random.Bool()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetDirectoriesRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetDirectoriesRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Files;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetFilesRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetFilesRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="GetFilesRequest"/> with default or random values.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The file system path for which to get the files.</param>
|
||||
/// <param name="shouldIncludeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||
/// <returns>The created <see cref="GetFilesRequest"/>.</returns>
|
||||
public GetFilesRequest Create(
|
||||
string? path = null,
|
||||
bool? shouldIncludeHiddenElements = null)
|
||||
{
|
||||
return new GetFilesRequest(
|
||||
Path: path ?? _faker.System.FilePath(),
|
||||
ShouldIncludeHiddenElements: shouldIncludeHiddenElements ?? _faker.Random.Bool()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetFilesRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetFilesRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Files;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetTreeFilesRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetTreeFilesRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="GetTreeFilesRequest"/> with default or random values.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The file system path for which to get the tree files.</param>
|
||||
/// <param name="shouldIncludeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||
/// <returns>The created <see cref="GetTreeFilesRequest"/>.</returns>
|
||||
public GetTreeFilesRequest Create(
|
||||
string? path = null,
|
||||
bool? shouldIncludeHiddenElements = null)
|
||||
{
|
||||
return new GetTreeFilesRequest(
|
||||
Path: path ?? _faker.System.FilePath(),
|
||||
ShouldIncludeHiddenElements: shouldIncludeHiddenElements ?? _faker.Random.Bool()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetTreeFilesRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetTreeFilesRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="CheckPathExistsRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class CheckPathExistsRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="CheckPathExistsRequest"/> with default or random values.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The path to check.</param>
|
||||
/// <param name="shouldIncludeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||
/// <returns>The created <see cref="CheckPathExistsRequest"/>.</returns>
|
||||
public CheckPathExistsRequest Create(
|
||||
string? path = null,
|
||||
bool? shouldIncludeHiddenElements = null)
|
||||
{
|
||||
return new CheckPathExistsRequest(
|
||||
Path: path ?? _faker.System.FilePath(),
|
||||
ShouldIncludeHiddenElements: shouldIncludeHiddenElements ?? _faker.Random.Bool()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="CheckPathExistsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<CheckPathExistsRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="CombinePathRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class CombinePathRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="CombinePathRequest"/> with default or random values.
|
||||
/// </summary>
|
||||
/// <param name="originalPath">Optional. The original path.</param>
|
||||
/// <param name="newPath">Optional. The new path to combine.</param>
|
||||
/// <returns>The created <see cref="CombinePathRequest"/>.</returns>
|
||||
public CombinePathRequest Create(string? originalPath = null, string? newPath = null)
|
||||
{
|
||||
return new CombinePathRequest(
|
||||
OriginalPath: originalPath ?? _faker.System.DirectoryPath(),
|
||||
NewPath: newPath ?? _faker.System.FileName()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="CombinePathRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<CombinePathRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetPathParentRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetPathParentRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="GetPathParentRequest"/> with a default or random value.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The path to get the parent of.</param>
|
||||
/// <returns>The created <see cref="GetPathParentRequest"/>.</returns>
|
||||
public GetPathParentRequest Create(string? path = null)
|
||||
{
|
||||
return new GetPathParentRequest(
|
||||
Path: path ?? _faker.System.FilePath()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetPathParentRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetPathParentRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetPathRootRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetPathRootRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="GetPathRootRequest"/> with a default or random value.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The path to get the root of.</param>
|
||||
/// <returns>The created <see cref="GetPathRootRequest"/>.</returns>
|
||||
public GetPathRootRequest Create(string? path = null)
|
||||
{
|
||||
return new GetPathRootRequest(
|
||||
Path: path ?? _faker.System.FilePath()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetPathRootRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetPathRootRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="SplitPathRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class SplitPathRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="SplitPathRequest"/> with a default or random value.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The path to split.</param>
|
||||
/// <returns>The created <see cref="SplitPathRequest"/>.</returns>
|
||||
public SplitPathRequest Create(string? path = null)
|
||||
{
|
||||
return new SplitPathRequest(
|
||||
Path: path ?? _faker.System.FilePath()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="SplitPathRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<SplitPathRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ValidatePathRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ValidatePathRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="ValidatePathRequest"/> with a default or random value.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The path to validate.</param>
|
||||
/// <returns>The created <see cref="ValidatePathRequest"/>.</returns>
|
||||
public ValidatePathRequest Create(string? path = null)
|
||||
{
|
||||
return new ValidatePathRequest(
|
||||
Path: path ?? _faker.System.FilePath()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="ValidatePathRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<ValidatePathRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Thumbnails;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Thumbnails;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetThumbnailRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetThumbnailRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="GetThumbnailRequest"/> with default or random values.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The path of the file to get the thumbnail for.</param>
|
||||
/// <param name="quality">Optional. The quality of the thumbnail.</param>
|
||||
/// <returns>The created <see cref="GetThumbnailRequest"/>.</returns>
|
||||
public GetThumbnailRequest Create(string? path = null, int? quality = null)
|
||||
{
|
||||
return new GetThumbnailRequest(
|
||||
Path: path ?? _faker.System.FilePath(),
|
||||
Quality: quality ?? _faker.Random.Int(1, 100)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetThumbnailRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetThumbnailRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ClearResumePointsRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ClearResumePointsRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="ClearResumePointsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library to restrict the deletion to. Defaults to a random Id.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="ClearResumePointsRequest"/>.</returns>
|
||||
public ClearResumePointsRequest Create(
|
||||
string? libraryId = null,
|
||||
bool includeLibraryId = true)
|
||||
{
|
||||
return new ClearResumePointsRequest(
|
||||
includeLibraryId ? libraryId ?? _faker.Random.Guid().ToString() : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="ClearResumePointsRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="ClearResumePointsRequest"/> instances.</returns>
|
||||
public List<ClearResumePointsRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="CompleteConsumptionRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class CompleteConsumptionRequestFixture
|
||||
{
|
||||
private const double MAXIMUM_DURATION_SECONDS = 36_000;
|
||||
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MediaPositionRequestFixture _mediaPositionRequestFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="CompleteConsumptionRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="position">Optional. The final position reported for the media item.</param>
|
||||
/// <param name="includePosition">Whether the position should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="progressFraction">Optional. The fraction of the media item that the client reached. Defaults to a bounded random fraction between zero and one.</param>
|
||||
/// <param name="includeProgressFraction">Whether the progress fraction should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="consumedDurationInSeconds">Optional. The active duration consumed by the session, in seconds. Defaults to a bounded random duration.</param>
|
||||
/// <param name="includeConsumedDurationInSeconds">Whether the consumed duration should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="consecutivePagesRead">Optional. The number of consecutive pages read in the session.</param>
|
||||
/// <param name="includeConsecutivePagesRead">Whether the optional consecutive pages argument should be supplied at all. When <see langword="false"/>, the argument is omitted, so the record default applies.</param>
|
||||
/// <returns>The created <see cref="CompleteConsumptionRequest"/>.</returns>
|
||||
public CompleteConsumptionRequest Create(
|
||||
MediaPositionRequest? position = null,
|
||||
bool includePosition = true,
|
||||
double? progressFraction = null,
|
||||
bool includeProgressFraction = true,
|
||||
double? consumedDurationInSeconds = null,
|
||||
bool includeConsumedDurationInSeconds = true,
|
||||
int? consecutivePagesRead = null,
|
||||
bool includeConsecutivePagesRead = true)
|
||||
{
|
||||
MediaPositionRequest? resolvedPosition = includePosition ? position ?? _mediaPositionRequestFixture.Create() : null;
|
||||
double? resolvedProgressFraction = includeProgressFraction ? progressFraction ?? _faker.Random.Double(0, 1) : null;
|
||||
double? resolvedConsumedDurationInSeconds = includeConsumedDurationInSeconds ? consumedDurationInSeconds ?? _faker.Random.Double(0, MAXIMUM_DURATION_SECONDS) : null;
|
||||
if (!includeConsecutivePagesRead)
|
||||
return new CompleteConsumptionRequest(resolvedPosition, resolvedProgressFraction, resolvedConsumedDurationInSeconds);
|
||||
return new CompleteConsumptionRequest(resolvedPosition, resolvedProgressFraction, resolvedConsumedDurationInSeconds, consecutivePagesRead);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="CompleteConsumptionRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="CompleteConsumptionRequest"/> instances.</returns>
|
||||
public List<CompleteConsumptionRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="DeleteConsumptionItemHistoryRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class DeleteConsumptionItemHistoryRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MediaKind[] _supportedMediaKinds =
|
||||
[
|
||||
MediaKind.MusicTrack,
|
||||
MediaKind.PodcastEpisode,
|
||||
MediaKind.Audiobook,
|
||||
MediaKind.Movie,
|
||||
MediaKind.TvEpisode,
|
||||
MediaKind.Book,
|
||||
MediaKind.Photo,
|
||||
MediaKind.Video
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="DeleteConsumptionItemHistoryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="mediaKind">Optional. The name of the kind of the consumed media item. Defaults to the name of a random supported kind.</param>
|
||||
/// <param name="mediaItemId">Optional. The Id of the consumed media item. Defaults to a random Id.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library that contains the media item. Defaults to a random Id.</param>
|
||||
/// <param name="includeMediaKind">Whether the media kind name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaItemId">Whether the media item Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="DeleteConsumptionItemHistoryRequest"/>.</returns>
|
||||
public DeleteConsumptionItemHistoryRequest Create(
|
||||
string? mediaKind = null,
|
||||
string? mediaItemId = null,
|
||||
string? libraryId = null,
|
||||
bool includeMediaKind = true,
|
||||
bool includeMediaItemId = true,
|
||||
bool includeLibraryId = true)
|
||||
{
|
||||
return new DeleteConsumptionItemHistoryRequest(
|
||||
includeMediaKind ? mediaKind ?? _faker.Random.ArrayElement(_supportedMediaKinds).ToString() : null,
|
||||
includeMediaItemId ? mediaItemId ?? _faker.Random.Guid().ToString() : null,
|
||||
includeLibraryId ? libraryId ?? _faker.Random.Guid().ToString() : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="DeleteConsumptionItemHistoryRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="DeleteConsumptionItemHistoryRequest"/> instances.</returns>
|
||||
public List<DeleteConsumptionItemHistoryRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetAllUsersConsumptionStatisticsRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetAllUsersConsumptionStatisticsRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MediaKind[] _supportedMediaKinds =
|
||||
[
|
||||
MediaKind.MusicTrack,
|
||||
MediaKind.PodcastEpisode,
|
||||
MediaKind.Audiobook,
|
||||
MediaKind.Movie,
|
||||
MediaKind.TvEpisode,
|
||||
MediaKind.Book,
|
||||
MediaKind.Photo,
|
||||
MediaKind.Video
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetAllUsersConsumptionStatisticsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library to restrict the statistics to. Defaults to a random Id.</param>
|
||||
/// <param name="mediaKind">Optional. The name of the kind of media to restrict the statistics to. Defaults to the name of a random supported kind.</param>
|
||||
/// <param name="fromUtc">Optional. The inclusive start of the date range. Defaults to a bounded UTC moment in the past, as a text value.</param>
|
||||
/// <param name="toUtc">Optional. The inclusive end of the date range. Defaults to a bounded UTC moment, as a text value.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaKind">Whether the media kind name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFromUtc">Whether the start of the date range should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeToUtc">Whether the end of the date range should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetAllUsersConsumptionStatisticsRequest"/>.</returns>
|
||||
public GetAllUsersConsumptionStatisticsRequest Create(
|
||||
string? libraryId = null,
|
||||
string? mediaKind = null,
|
||||
string? fromUtc = null,
|
||||
string? toUtc = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeMediaKind = true,
|
||||
bool includeFromUtc = true,
|
||||
bool includeToUtc = true)
|
||||
{
|
||||
string resolvedFromUtc = fromUtc ?? DateTime.UtcNow.AddDays(-_faker.Random.Int(1, 30)).ToString("o", CultureInfo.InvariantCulture);
|
||||
string resolvedToUtc = toUtc ?? DateTime.UtcNow.AddDays(_faker.Random.Int(1, 30)).ToString("o", CultureInfo.InvariantCulture);
|
||||
|
||||
return new GetAllUsersConsumptionStatisticsRequest(
|
||||
includeLibraryId ? libraryId ?? _faker.Random.Guid().ToString() : null,
|
||||
includeMediaKind ? mediaKind ?? _faker.Random.ArrayElement(_supportedMediaKinds).ToString() : null,
|
||||
includeFromUtc ? resolvedFromUtc : null,
|
||||
includeToUtc ? resolvedToUtc : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetAllUsersConsumptionStatisticsRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetAllUsersConsumptionStatisticsRequest"/> instances.</returns>
|
||||
public List<GetAllUsersConsumptionStatisticsRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetConsumptionStatisticsRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetConsumptionStatisticsRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MediaKind[] _supportedMediaKinds =
|
||||
[
|
||||
MediaKind.MusicTrack,
|
||||
MediaKind.PodcastEpisode,
|
||||
MediaKind.Audiobook,
|
||||
MediaKind.Movie,
|
||||
MediaKind.TvEpisode,
|
||||
MediaKind.Book,
|
||||
MediaKind.Photo,
|
||||
MediaKind.Video
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetConsumptionStatisticsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library to restrict the statistics to. Defaults to a random Id.</param>
|
||||
/// <param name="mediaKind">Optional. The name of the kind of media to restrict the statistics to. Defaults to the name of a random supported kind.</param>
|
||||
/// <param name="fromUtc">Optional. The inclusive start of the date range. Defaults to a bounded UTC moment in the past, as a text value.</param>
|
||||
/// <param name="toUtc">Optional. The inclusive end of the date range. Defaults to a bounded UTC moment, as a text value.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaKind">Whether the media kind name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFromUtc">Whether the start of the date range should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeToUtc">Whether the end of the date range should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetConsumptionStatisticsRequest"/>.</returns>
|
||||
public GetConsumptionStatisticsRequest Create(
|
||||
string? libraryId = null,
|
||||
string? mediaKind = null,
|
||||
string? fromUtc = null,
|
||||
string? toUtc = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeMediaKind = true,
|
||||
bool includeFromUtc = true,
|
||||
bool includeToUtc = true)
|
||||
{
|
||||
string resolvedFromUtc = fromUtc ?? DateTime.UtcNow.AddDays(-_faker.Random.Int(1, 30)).ToString("o", CultureInfo.InvariantCulture);
|
||||
string resolvedToUtc = toUtc ?? DateTime.UtcNow.AddDays(_faker.Random.Int(1, 30)).ToString("o", CultureInfo.InvariantCulture);
|
||||
|
||||
return new GetConsumptionStatisticsRequest(
|
||||
includeLibraryId ? libraryId ?? _faker.Random.Guid().ToString() : null,
|
||||
includeMediaKind ? mediaKind ?? _faker.Random.ArrayElement(_supportedMediaKinds).ToString() : null,
|
||||
includeFromUtc ? resolvedFromUtc : null,
|
||||
includeToUtc ? resolvedToUtc : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetConsumptionStatisticsRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetConsumptionStatisticsRequest"/> instances.</returns>
|
||||
public List<GetConsumptionStatisticsRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetGenreConsumptionRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetGenreConsumptionRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MediaKind[] _supportedMediaKinds =
|
||||
[
|
||||
MediaKind.MusicTrack,
|
||||
MediaKind.PodcastEpisode,
|
||||
MediaKind.Audiobook,
|
||||
MediaKind.Movie,
|
||||
MediaKind.TvEpisode,
|
||||
MediaKind.Book,
|
||||
MediaKind.Photo,
|
||||
MediaKind.Video
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetGenreConsumptionRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library to restrict the statistics to. Defaults to a random Id.</param>
|
||||
/// <param name="mediaKind">Optional. The name of the kind of media to restrict the statistics to. Defaults to the name of a random supported kind.</param>
|
||||
/// <param name="fromUtc">Optional. The inclusive start of the date range. Defaults to a bounded UTC moment in the past, as a text value.</param>
|
||||
/// <param name="toUtc">Optional. The inclusive end of the date range. Defaults to a bounded UTC moment in the future, as a text value.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaKind">Whether the media kind name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFromUtc">Whether the start of the date range should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeToUtc">Whether the end of the date range should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetGenreConsumptionRequest"/>.</returns>
|
||||
public GetGenreConsumptionRequest Create(
|
||||
string? libraryId = null,
|
||||
string? mediaKind = null,
|
||||
string? fromUtc = null,
|
||||
string? toUtc = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeMediaKind = true,
|
||||
bool includeFromUtc = true,
|
||||
bool includeToUtc = true)
|
||||
{
|
||||
string resolvedFromUtc = fromUtc ?? DateTime.UtcNow.AddDays(-_faker.Random.Int(1, 30)).ToString("o", CultureInfo.InvariantCulture);
|
||||
string resolvedToUtc = toUtc ?? DateTime.UtcNow.AddDays(_faker.Random.Int(1, 30)).ToString("o", CultureInfo.InvariantCulture);
|
||||
|
||||
return new GetGenreConsumptionRequest(
|
||||
includeLibraryId ? libraryId ?? _faker.Random.Guid().ToString() : null,
|
||||
includeMediaKind ? mediaKind ?? _faker.Random.ArrayElement(_supportedMediaKinds).ToString() : null,
|
||||
includeFromUtc ? resolvedFromUtc : null,
|
||||
includeToUtc ? resolvedToUtc : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetGenreConsumptionRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetGenreConsumptionRequest"/> instances.</returns>
|
||||
public List<GetGenreConsumptionRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetMostConsumedRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetMostConsumedRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MediaKind[] _supportedMediaKinds =
|
||||
[
|
||||
MediaKind.MusicTrack,
|
||||
MediaKind.PodcastEpisode,
|
||||
MediaKind.Audiobook,
|
||||
MediaKind.Movie,
|
||||
MediaKind.TvEpisode,
|
||||
MediaKind.Book,
|
||||
MediaKind.Photo,
|
||||
MediaKind.Video
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetMostConsumedRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library to restrict the history to. Defaults to a random Id.</param>
|
||||
/// <param name="mediaKind">Optional. The name of the kind of media to restrict the history to. Defaults to the name of a random supported kind.</param>
|
||||
/// <param name="currentPage">Optional. The one based page of media items to return. Defaults to a bounded positive page.</param>
|
||||
/// <param name="perPage">Optional. The number of media items per page. Defaults to a bounded positive count.</param>
|
||||
/// <param name="fromUtc">Optional. The inclusive start of the date range. Defaults to a bounded UTC moment in the past, as a text value.</param>
|
||||
/// <param name="toUtc">Optional. The inclusive end of the date range. Defaults to a bounded UTC moment, as a text value.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaKind">Whether the media kind name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCurrentPage">Whether the current page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePerPage">Whether the count per page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFromUtc">Whether the start of the date range should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeToUtc">Whether the end of the date range should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetMostConsumedRequest"/>.</returns>
|
||||
public GetMostConsumedRequest Create(
|
||||
string? libraryId = null,
|
||||
string? mediaKind = null,
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
string? fromUtc = null,
|
||||
string? toUtc = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeMediaKind = true,
|
||||
bool includeCurrentPage = true,
|
||||
bool includePerPage = true,
|
||||
bool includeFromUtc = true,
|
||||
bool includeToUtc = true)
|
||||
{
|
||||
string resolvedFromUtc = fromUtc ?? DateTime.UtcNow.AddDays(-_faker.Random.Int(1, 30)).ToString("o", CultureInfo.InvariantCulture);
|
||||
string resolvedToUtc = toUtc ?? DateTime.UtcNow.AddDays(_faker.Random.Int(1, 30)).ToString("o", CultureInfo.InvariantCulture);
|
||||
|
||||
return new GetMostConsumedRequest(
|
||||
includeLibraryId ? libraryId ?? _faker.Random.Guid().ToString() : null,
|
||||
includeMediaKind ? mediaKind ?? _faker.Random.ArrayElement(_supportedMediaKinds).ToString() : null,
|
||||
includeCurrentPage ? currentPage ?? _faker.Random.Int(1, 100) : null,
|
||||
includePerPage ? perPage ?? _faker.Random.Int(1, 50) : null,
|
||||
includeFromUtc ? resolvedFromUtc : null,
|
||||
includeToUtc ? resolvedToUtc : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetMostConsumedRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetMostConsumedRequest"/> instances.</returns>
|
||||
public List<GetMostConsumedRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetRecentlyConsumedRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetRecentlyConsumedRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MediaKind[] _supportedMediaKinds =
|
||||
[
|
||||
MediaKind.MusicTrack,
|
||||
MediaKind.PodcastEpisode,
|
||||
MediaKind.Audiobook,
|
||||
MediaKind.Movie,
|
||||
MediaKind.TvEpisode,
|
||||
MediaKind.Book,
|
||||
MediaKind.Photo,
|
||||
MediaKind.Video
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetRecentlyConsumedRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library to restrict the history to. Defaults to a random Id.</param>
|
||||
/// <param name="mediaKind">Optional. The name of the kind of media to restrict the history to. Defaults to the name of a random supported kind.</param>
|
||||
/// <param name="currentPage">Optional. The one based page of media items to return. Defaults to a bounded positive page.</param>
|
||||
/// <param name="perPage">Optional. The number of media items per page. Defaults to a bounded positive count.</param>
|
||||
/// <param name="fromUtc">Optional. The inclusive start of the date range. Defaults to a bounded UTC moment in the past, as a text value.</param>
|
||||
/// <param name="toUtc">Optional. The inclusive end of the date range. Defaults to a bounded UTC moment, as a text value.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaKind">Whether the media kind name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCurrentPage">Whether the current page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePerPage">Whether the count per page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFromUtc">Whether the start of the date range should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeToUtc">Whether the end of the date range should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetRecentlyConsumedRequest"/>.</returns>
|
||||
public GetRecentlyConsumedRequest Create(
|
||||
string? libraryId = null,
|
||||
string? mediaKind = null,
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
string? fromUtc = null,
|
||||
string? toUtc = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeMediaKind = true,
|
||||
bool includeCurrentPage = true,
|
||||
bool includePerPage = true,
|
||||
bool includeFromUtc = true,
|
||||
bool includeToUtc = true)
|
||||
{
|
||||
string resolvedFromUtc = fromUtc ?? DateTime.UtcNow.AddDays(-_faker.Random.Int(1, 30)).ToString("o", CultureInfo.InvariantCulture);
|
||||
string resolvedToUtc = toUtc ?? DateTime.UtcNow.AddDays(_faker.Random.Int(1, 30)).ToString("o", CultureInfo.InvariantCulture);
|
||||
|
||||
return new GetRecentlyConsumedRequest(
|
||||
includeLibraryId ? libraryId ?? _faker.Random.Guid().ToString() : null,
|
||||
includeMediaKind ? mediaKind ?? _faker.Random.ArrayElement(_supportedMediaKinds).ToString() : null,
|
||||
includeCurrentPage ? currentPage ?? _faker.Random.Int(1, 100) : null,
|
||||
includePerPage ? perPage ?? _faker.Random.Int(1, 50) : null,
|
||||
includeFromUtc ? resolvedFromUtc : null,
|
||||
includeToUtc ? resolvedToUtc : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetRecentlyConsumedRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetRecentlyConsumedRequest"/> instances.</returns>
|
||||
public List<GetRecentlyConsumedRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetTagConsumptionRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetTagConsumptionRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MediaKind[] _supportedMediaKinds =
|
||||
[
|
||||
MediaKind.MusicTrack,
|
||||
MediaKind.PodcastEpisode,
|
||||
MediaKind.Audiobook,
|
||||
MediaKind.Movie,
|
||||
MediaKind.TvEpisode,
|
||||
MediaKind.Book,
|
||||
MediaKind.Photo,
|
||||
MediaKind.Video
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetTagConsumptionRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library to restrict the statistics to. Defaults to a random Id.</param>
|
||||
/// <param name="mediaKind">Optional. The name of the kind of media to restrict the statistics to. Defaults to the name of a random supported kind.</param>
|
||||
/// <param name="fromUtc">Optional. The inclusive start of the date range. Defaults to a bounded UTC moment in the past, as a text value.</param>
|
||||
/// <param name="toUtc">Optional. The inclusive end of the date range. Defaults to a bounded UTC moment, as a text value.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaKind">Whether the media kind name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFromUtc">Whether the start of the date range should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeToUtc">Whether the end of the date range should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetTagConsumptionRequest"/>.</returns>
|
||||
public GetTagConsumptionRequest Create(
|
||||
string? libraryId = null,
|
||||
string? mediaKind = null,
|
||||
string? fromUtc = null,
|
||||
string? toUtc = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeMediaKind = true,
|
||||
bool includeFromUtc = true,
|
||||
bool includeToUtc = true)
|
||||
{
|
||||
string resolvedFromUtc = fromUtc ?? DateTime.UtcNow.AddDays(-_faker.Random.Int(1, 30)).ToString("o", CultureInfo.InvariantCulture);
|
||||
string resolvedToUtc = toUtc ?? DateTime.UtcNow.AddDays(_faker.Random.Int(1, 30)).ToString("o", CultureInfo.InvariantCulture);
|
||||
|
||||
return new GetTagConsumptionRequest(
|
||||
includeLibraryId ? libraryId ?? _faker.Random.Guid().ToString() : null,
|
||||
includeMediaKind ? mediaKind ?? _faker.Random.ArrayElement(_supportedMediaKinds).ToString() : null,
|
||||
includeFromUtc ? resolvedFromUtc : null,
|
||||
includeToUtc ? resolvedToUtc : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetTagConsumptionRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetTagConsumptionRequest"/> instances.</returns>
|
||||
public List<GetTagConsumptionRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaConsumption;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MediaPositionRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MediaPositionRequestFixture
|
||||
{
|
||||
private const double MAXIMUM_OFFSET_SECONDS = 7_200;
|
||||
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="MediaPositionRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="kind">Optional. The kind of the position, as the name of a <see cref="MediaPositionKind"/> member. Defaults to a random valid kind.</param>
|
||||
/// <param name="timeOffsetSeconds">Optional. The position within the media item, in seconds. Defaults to a bounded random offset for a time offset position.</param>
|
||||
/// <param name="location">Optional. The opaque locator within the media item. Defaults to a random word for a location position.</param>
|
||||
/// <param name="includeKind">Whether the kind should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeTimeOffsetSeconds">Whether the time offset should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLocation">Whether the location should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="MediaPositionRequest"/>.</returns>
|
||||
public MediaPositionRequest Create(
|
||||
string? kind = null,
|
||||
double? timeOffsetSeconds = null,
|
||||
string? location = null,
|
||||
bool includeKind = true,
|
||||
bool includeTimeOffsetSeconds = true,
|
||||
bool includeLocation = true)
|
||||
{
|
||||
string? resolvedKind = includeKind ? kind ?? _faker.PickRandom<MediaPositionKind>().ToString() : null;
|
||||
bool isTimeOffset = resolvedKind == nameof(MediaPositionKind.TimeOffset);
|
||||
double? resolvedTimeOffsetSeconds = includeTimeOffsetSeconds
|
||||
? timeOffsetSeconds ?? (isTimeOffset ? _faker.Random.Double(0, MAXIMUM_OFFSET_SECONDS) : (double?)null)
|
||||
: null;
|
||||
string? resolvedLocation = includeLocation
|
||||
? location ?? (isTimeOffset ? (string?)null : _faker.Lorem.Word())
|
||||
: null;
|
||||
|
||||
return new MediaPositionRequest(resolvedKind, resolvedTimeOffsetSeconds, resolvedLocation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="MediaPositionRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MediaPositionRequest"/> instances.</returns>
|
||||
public List<MediaPositionRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ReportConsumptionProgressRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ReportConsumptionProgressRequestFixture
|
||||
{
|
||||
private const double MAXIMUM_DURATION_SECONDS = 36_000;
|
||||
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MediaPositionRequestFixture _mediaPositionRequestFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="ReportConsumptionProgressRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="position">Optional. The last position reported for the media item.</param>
|
||||
/// <param name="includePosition">Whether the position should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="progressFraction">Optional. The fraction of the media item that the client reached. Defaults to a bounded random fraction between zero and one.</param>
|
||||
/// <param name="includeProgressFraction">Whether the progress fraction should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="consumedDurationInSeconds">Optional. The active duration consumed by the session, in seconds. Defaults to a bounded random duration.</param>
|
||||
/// <param name="includeConsumedDurationInSeconds">Whether the consumed duration should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="consecutivePagesRead">Optional. The number of consecutive pages read in the current session.</param>
|
||||
/// <param name="includeConsecutivePagesRead">Whether the consecutive pages argument should be supplied at all. When <see langword="false"/>, the argument is omitted, so the record default applies.</param>
|
||||
/// <returns>The created <see cref="ReportConsumptionProgressRequest"/>.</returns>
|
||||
public ReportConsumptionProgressRequest Create(
|
||||
MediaPositionRequest? position = null,
|
||||
bool includePosition = true,
|
||||
double? progressFraction = null,
|
||||
bool includeProgressFraction = true,
|
||||
double? consumedDurationInSeconds = null,
|
||||
bool includeConsumedDurationInSeconds = true,
|
||||
int? consecutivePagesRead = null,
|
||||
bool includeConsecutivePagesRead = true)
|
||||
{
|
||||
MediaPositionRequest? resolvedPosition = includePosition ? position ?? _mediaPositionRequestFixture.Create() : null;
|
||||
double? resolvedProgressFraction = includeProgressFraction ? progressFraction ?? _faker.Random.Double(0, 1) : null;
|
||||
double? resolvedConsumedDurationInSeconds = includeConsumedDurationInSeconds ? consumedDurationInSeconds ?? _faker.Random.Double(0, MAXIMUM_DURATION_SECONDS) : null;
|
||||
if (!includeConsecutivePagesRead)
|
||||
return new ReportConsumptionProgressRequest(resolvedPosition, resolvedProgressFraction, resolvedConsumedDurationInSeconds);
|
||||
return new ReportConsumptionProgressRequest(resolvedPosition, resolvedProgressFraction, resolvedConsumedDurationInSeconds, consecutivePagesRead ?? 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="ReportConsumptionProgressRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="ReportConsumptionProgressRequest"/> instances.</returns>
|
||||
public List<ReportConsumptionProgressRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="StopConsumptionRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class StopConsumptionRequestFixture
|
||||
{
|
||||
private const double MAXIMUM_DURATION_SECONDS = 36_000;
|
||||
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MediaPositionRequestFixture _mediaPositionRequestFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="StopConsumptionRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="position">Optional. The final position reported for the media item.</param>
|
||||
/// <param name="includePosition">Whether the position should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="progressFraction">Optional. The fraction of the media item that the client reached. Defaults to a bounded random fraction between zero and one.</param>
|
||||
/// <param name="includeProgressFraction">Whether the progress fraction should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="consumedDurationInSeconds">Optional. The active duration consumed by the session, in seconds. Defaults to a bounded random duration.</param>
|
||||
/// <param name="includeConsumedDurationInSeconds">Whether the consumed duration should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="consecutivePagesRead">Optional. The number of consecutive pages read in the session.</param>
|
||||
/// <param name="includeConsecutivePagesRead">Whether the optional consecutive pages argument should be supplied at all. When <see langword="false"/>, the argument is omitted, so the record default applies.</param>
|
||||
/// <returns>The created <see cref="StopConsumptionRequest"/>.</returns>
|
||||
public StopConsumptionRequest Create(
|
||||
MediaPositionRequest? position = null,
|
||||
bool includePosition = true,
|
||||
double? progressFraction = null,
|
||||
bool includeProgressFraction = true,
|
||||
double? consumedDurationInSeconds = null,
|
||||
bool includeConsumedDurationInSeconds = true,
|
||||
int? consecutivePagesRead = null,
|
||||
bool includeConsecutivePagesRead = true)
|
||||
{
|
||||
MediaPositionRequest? resolvedPosition = includePosition ? position ?? _mediaPositionRequestFixture.Create() : null;
|
||||
double? resolvedProgressFraction = includeProgressFraction ? progressFraction ?? _faker.Random.Double(0, 1) : null;
|
||||
double? resolvedConsumedDurationInSeconds = includeConsumedDurationInSeconds ? consumedDurationInSeconds ?? _faker.Random.Double(0, MAXIMUM_DURATION_SECONDS) : null;
|
||||
if (!includeConsecutivePagesRead)
|
||||
return new StopConsumptionRequest(resolvedPosition, resolvedProgressFraction, resolvedConsumedDurationInSeconds);
|
||||
return new StopConsumptionRequest(resolvedPosition, resolvedProgressFraction, resolvedConsumedDurationInSeconds, consecutivePagesRead);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="StopConsumptionRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="StopConsumptionRequest"/> instances.</returns>
|
||||
public List<StopConsumptionRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AddAlbumRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddAlbumRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
|
||||
private readonly AddTrackRequestFixture _addTrackRequestFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to add an album.
|
||||
/// </summary>
|
||||
/// <param name="metadata">Optional. The album metadata of the album.</param>
|
||||
/// <param name="mediaFormat">Optional. The physical or digital medium of the album.</param>
|
||||
/// <param name="packaging">Optional. The outermost physical packaging of the album.</param>
|
||||
/// <param name="barcode">Optional. The barcode of the album.</param>
|
||||
/// <param name="catalogNumber">Optional. The catalog number of the album.</param>
|
||||
/// <param name="label">Optional. The name of the label that issued the album.</param>
|
||||
/// <param name="asin">Optional. The ASIN of the album.</param>
|
||||
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz identifier of the release.</param>
|
||||
/// <param name="musicBrainzReleaseGroupId">Optional. The MusicBrainz identifier of the release group.</param>
|
||||
/// <param name="musicBrainzReleaseArtistId">Optional. The MusicBrainz identifier of the release artist.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that performed on the album.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the album.</param>
|
||||
/// <param name="tracks">Optional. The tracks of the album.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeTracks">Whether the tracks list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaFormat">Whether the media format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePackaging">Whether the packaging should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarcode">Whether the barcode should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCatalogNumbers">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLabel">Whether the label should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseId">Whether the MusicBrainz release Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseGroupId">Whether the MusicBrainz release group Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseArtistId">Whether the MusicBrainz release artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to add an album.</returns>
|
||||
public AddAlbumRequest Create(
|
||||
MusicAlbumMetadataDto? metadata = null,
|
||||
MusicMediaFormat? mediaFormat = null,
|
||||
MusicReleasePackaging? packaging = null,
|
||||
string? barcode = null,
|
||||
List<string>? catalogNumbers = null,
|
||||
string? label = null,
|
||||
string? asin = null,
|
||||
Guid? musicBrainzReleaseId = null,
|
||||
Guid? musicBrainzReleaseGroupId = null,
|
||||
Guid? musicBrainzReleaseArtistId = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
List<AddTrackRequest>? tracks = null,
|
||||
bool includeMetadata = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeTracks = true,
|
||||
bool includeMediaFormat = true,
|
||||
bool includePackaging = true,
|
||||
bool includeBarcode = true,
|
||||
bool includeCatalogNumbers = true,
|
||||
bool includeLabel = true,
|
||||
bool includeAsin = true,
|
||||
bool includeMusicBrainzReleaseId = true,
|
||||
bool includeMusicBrainzReleaseGroupId = true,
|
||||
bool includeMusicBrainzReleaseArtistId = true)
|
||||
{
|
||||
return new AddAlbumRequest(
|
||||
includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
|
||||
includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
|
||||
includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
|
||||
includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null,
|
||||
includeCatalogNumbers ? (catalogNumbers ?? [_faker.Random.AlphaNumeric(10)]) : null,
|
||||
includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
|
||||
includeAsin ? (asin ?? _faker.Random.AlphaNumeric(10)) : null,
|
||||
includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null,
|
||||
includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
|
||||
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
|
||||
includeTracks ? (tracks ?? _addTrackRequestFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="AddAlbumRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<AddAlbumRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetAlbumTracksLiteRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetAlbumTracksLiteRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="GetAlbumTracksLiteRequest"/> with default or random values.
|
||||
/// </summary>
|
||||
/// <param name="currentPage">Optional. The page of results to retrieve.</param>
|
||||
/// <param name="perPage">Optional. The maximum number of tracks to retrieve per page.</param>
|
||||
/// <param name="includeCurrentPage">Whether the current page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePerPage">Whether the per page count should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetAlbumTracksLiteRequest"/>.</returns>
|
||||
public GetAlbumTracksLiteRequest Create(
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
bool includeCurrentPage = true,
|
||||
bool includePerPage = true)
|
||||
{
|
||||
return new GetAlbumTracksLiteRequest(
|
||||
CurrentPage: includeCurrentPage ? (currentPage ?? _faker.Random.Number(1, 100)) : null,
|
||||
PerPage: includePerPage ? (perPage ?? _faker.Random.Number(1, 200)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetAlbumTracksLiteRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetAlbumTracksLiteRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateAlbumRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateAlbumRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to update an album.
|
||||
/// </summary>
|
||||
/// <param name="metadata">Optional. The album metadata of the album.</param>
|
||||
/// <param name="mediaFormat">Optional. The physical or digital medium of the album.</param>
|
||||
/// <param name="packaging">Optional. The outermost physical packaging of the album.</param>
|
||||
/// <param name="barcode">Optional. The barcode of the album.</param>
|
||||
/// <param name="catalogNumber">Optional. The catalog number of the album.</param>
|
||||
/// <param name="label">Optional. The name of the label that issued the album.</param>
|
||||
/// <param name="asin">Optional. The ASIN of the album.</param>
|
||||
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz identifier of the release.</param>
|
||||
/// <param name="musicBrainzReleaseGroupId">Optional. The MusicBrainz identifier of the release group.</param>
|
||||
/// <param name="musicBrainzReleaseArtistId">Optional. The MusicBrainz identifier of the release artist.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that performed on the album.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the album.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaFormat">Whether the media format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePackaging">Whether the packaging should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarcode">Whether the barcode should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCatalogNumbers">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLabel">Whether the label should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseId">Whether the MusicBrainz release Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseGroupId">Whether the MusicBrainz release group Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseArtistId">Whether the MusicBrainz release artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to update an album.</returns>
|
||||
public UpdateAlbumRequest Create(
|
||||
MusicAlbumMetadataDto? metadata = null,
|
||||
MusicMediaFormat? mediaFormat = null,
|
||||
MusicReleasePackaging? packaging = null,
|
||||
string? barcode = null,
|
||||
List<string>? catalogNumbers = null,
|
||||
string? label = null,
|
||||
string? asin = null,
|
||||
Guid? musicBrainzReleaseId = null,
|
||||
Guid? musicBrainzReleaseGroupId = null,
|
||||
Guid? musicBrainzReleaseArtistId = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
bool includeMetadata = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeMediaFormat = true,
|
||||
bool includePackaging = true,
|
||||
bool includeBarcode = true,
|
||||
bool includeCatalogNumbers = true,
|
||||
bool includeLabel = true,
|
||||
bool includeAsin = true,
|
||||
bool includeMusicBrainzReleaseId = true,
|
||||
bool includeMusicBrainzReleaseGroupId = true,
|
||||
bool includeMusicBrainzReleaseArtistId = true)
|
||||
{
|
||||
return new UpdateAlbumRequest(
|
||||
includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
|
||||
includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
|
||||
includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
|
||||
includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null,
|
||||
includeCatalogNumbers ? (catalogNumbers ?? [_faker.Random.AlphaNumeric(10)]) : null,
|
||||
includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
|
||||
includeAsin ? (asin ?? _faker.Random.AlphaNumeric(10)) : null,
|
||||
includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null,
|
||||
includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
|
||||
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateAlbumRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdateAlbumRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AddArtistRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddArtistRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
|
||||
private readonly AddAlbumRequestFixture _addAlbumRequestFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to add an artist.
|
||||
/// </summary>
|
||||
/// <param name="metadata">Optional. The metadata of the artist.</param>
|
||||
/// <param name="website">Optional. The website of the artist.</param>
|
||||
/// <param name="musicBrainzArtistId">Optional. The MusicBrainz identifier of the artist.</param>
|
||||
/// <param name="ipis">Optional. The IPI codes of the artist.</param>
|
||||
/// <param name="isnis">Optional. The ISNI codes of the artist.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that make up the artist.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the artist.</param>
|
||||
/// <param name="albums">Optional. The albums of the artist.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWebsite">Whether the website should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzArtistId">Whether the MusicBrainz artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIpis">Whether the IPI codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsnis">Whether the ISNI codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAlbums">Whether the albums list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to add an artist.</returns>
|
||||
public AddArtistRequest Create(
|
||||
MusicArtistMetadataDto? metadata = null,
|
||||
string? website = null,
|
||||
Guid? musicBrainzArtistId = null,
|
||||
List<string>? ipis = null,
|
||||
List<string>? isnis = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
List<AddAlbumRequest>? albums = null,
|
||||
bool includeMetadata = true,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeIpis = true,
|
||||
bool includeIsnis = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeAlbums = true)
|
||||
{
|
||||
return new AddArtistRequest(
|
||||
includeMetadata ? (metadata ?? _musicArtistMetadataDtoFixture.Create()) : null,
|
||||
includeWebsite ? (website ?? _faker.Internet.Url()) : null,
|
||||
includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : null,
|
||||
includeIpis ? (ipis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(9))]) : null,
|
||||
includeIsnis ? (isnis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(16))]) : null,
|
||||
includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
|
||||
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
|
||||
includeAlbums ? (albums ?? _addAlbumRequestFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="AddArtistRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<AddArtistRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetArtistAlbumsLiteRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetArtistAlbumsLiteRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to get the lightweight read models of the albums of an artist.
|
||||
/// </summary>
|
||||
/// <param name="currentPage">Optional. The page of results to retrieve.</param>
|
||||
/// <param name="perPage">Optional. The maximum number of albums to retrieve per page.</param>
|
||||
/// <param name="includeCurrentPage">Whether the current page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePerPage">Whether the per page count should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to get the lightweight read models of the albums of an artist.</returns>
|
||||
public GetArtistAlbumsLiteRequest Create(
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
bool includeCurrentPage = true,
|
||||
bool includePerPage = true)
|
||||
{
|
||||
return new GetArtistAlbumsLiteRequest(
|
||||
includeCurrentPage ? (currentPage ?? _faker.Random.Number(1, 100)) : null,
|
||||
includePerPage ? (perPage ?? _faker.Random.Number(1, 200)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetArtistAlbumsLiteRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetArtistAlbumsLiteRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetArtistsLiteRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetArtistsLiteRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to get the lightweight read models of the artists of a media library.
|
||||
/// </summary>
|
||||
/// <param name="currentPage">Optional. The page of results to retrieve.</param>
|
||||
/// <param name="perPage">Optional. The maximum number of artists to retrieve per page.</param>
|
||||
/// <param name="searchTerm">Optional. The search term used to filter the artists by name.</param>
|
||||
/// <param name="filterAlphaKey">Optional. The alpha key used to filter the results by the first character of their name, for the alpha picker.</param>
|
||||
/// <param name="shouldIgnoreThePrefixForAlphaPicker">Optional. Whether the leading "The " prefix of a name should be ignored when computing the alpha key, or not.</param>
|
||||
/// <param name="sortBy">Optional. The name of the field by which to sort the results.</param>
|
||||
/// <param name="sortOrder">Optional. The direction in which to sort the results.</param>
|
||||
/// <param name="includeCurrentPage">Whether the current page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePerPage">Whether the per page count should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSearchTerm">Whether the search term should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFilterAlphaKey">Whether the filter alpha key should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSortBy">Whether the sort field should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSortOrder">Whether the sort order should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to get the lightweight read models of the artists of a media library.</returns>
|
||||
public GetArtistsLiteRequest Create(
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
string? searchTerm = null,
|
||||
string? filterAlphaKey = null,
|
||||
bool shouldIgnoreThePrefixForAlphaPicker = false,
|
||||
string? sortBy = null,
|
||||
SortOrder? sortOrder = null,
|
||||
bool includeCurrentPage = true,
|
||||
bool includePerPage = true,
|
||||
bool includeSearchTerm = true,
|
||||
bool includeFilterAlphaKey = true,
|
||||
bool includeSortBy = true,
|
||||
bool includeSortOrder = true)
|
||||
{
|
||||
return new GetArtistsLiteRequest(
|
||||
includeCurrentPage ? (currentPage ?? _faker.Random.Number(1, 100)) : null,
|
||||
includePerPage ? (perPage ?? _faker.Random.Number(1, 200)) : null,
|
||||
includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null,
|
||||
includeFilterAlphaKey ? (filterAlphaKey ?? CreateFilterAlphaKey()) : null,
|
||||
shouldIgnoreThePrefixForAlphaPicker,
|
||||
includeSortBy ? (sortBy ?? _faker.Lorem.Word()) : null,
|
||||
includeSortOrder ? (sortOrder ?? _faker.PickRandom<SortOrder>()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetArtistsLiteRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetArtistsLiteRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid alpha key: a single ASCII letter, "#" for names starting with a digit, or "*" for any other first character.
|
||||
/// </summary>
|
||||
/// <returns>The created alpha key.</returns>
|
||||
private string CreateFilterAlphaKey()
|
||||
{
|
||||
return _faker.Random.Bool()
|
||||
? _faker.Random.Char('A', 'Z').ToString()
|
||||
: _faker.Random.ListItem(new[] { "#", "*" });
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetArtistsRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetArtistsRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to get the artists of a media library.
|
||||
/// </summary>
|
||||
/// <param name="currentPage">Optional. The page of results to retrieve.</param>
|
||||
/// <param name="perPage">Optional. The maximum number of artists to retrieve per page.</param>
|
||||
/// <param name="searchTerm">Optional. The search term used to filter the artists by name.</param>
|
||||
/// <param name="includeCurrentPage">Whether the current page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePerPage">Whether the per page count should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSearchTerm">Whether the search term should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to get the artists of a media library.</returns>
|
||||
public GetArtistsRequest Create(
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
string? searchTerm = null,
|
||||
bool includeCurrentPage = true,
|
||||
bool includePerPage = true,
|
||||
bool includeSearchTerm = true)
|
||||
{
|
||||
return new GetArtistsRequest(
|
||||
includeCurrentPage ? (currentPage ?? _faker.Random.Number(1, 100)) : null,
|
||||
includePerPage ? (perPage ?? _faker.Random.Number(1, 200)) : null,
|
||||
includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetArtistsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetArtistsRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateArtistAlbumRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateArtistAlbumRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
|
||||
private readonly UpdateArtistTrackRequestFixture _updateArtistTrackRequestFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to update an album of an artist.
|
||||
/// </summary>
|
||||
/// <param name="albumId">Optional. The Id of the album, when the album already exists.</param>
|
||||
/// <param name="metadata">Optional. The album metadata of the album.</param>
|
||||
/// <param name="mediaFormat">Optional. The physical or digital medium of the album.</param>
|
||||
/// <param name="packaging">Optional. The outermost physical packaging of the album.</param>
|
||||
/// <param name="barcode">Optional. The barcode of the album.</param>
|
||||
/// <param name="catalogNumber">Optional. The catalog number of the album.</param>
|
||||
/// <param name="label">Optional. The name of the label that issued the album.</param>
|
||||
/// <param name="asin">Optional. The ASIN of the album.</param>
|
||||
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz identifier of the release.</param>
|
||||
/// <param name="musicBrainzReleaseGroupId">Optional. The MusicBrainz identifier of the release group.</param>
|
||||
/// <param name="musicBrainzReleaseArtistId">Optional. The MusicBrainz identifier of the release artist.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that performed on the album.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the album.</param>
|
||||
/// <param name="tracks">Optional. The tracks of the album.</param>
|
||||
/// <param name="includeAlbumId">Whether the album Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaFormat">Whether the media format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePackaging">Whether the packaging should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarcode">Whether the barcode should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCatalogNumbers">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLabel">Whether the label should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseId">Whether the MusicBrainz release Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseGroupId">Whether the MusicBrainz release group Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseArtistId">Whether the MusicBrainz release artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeTracks">Whether the tracks list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to update an album of an artist.</returns>
|
||||
public UpdateArtistAlbumRequest Create(
|
||||
Guid? albumId = null,
|
||||
MusicAlbumMetadataDto? metadata = null,
|
||||
MusicMediaFormat? mediaFormat = null,
|
||||
MusicReleasePackaging? packaging = null,
|
||||
string? barcode = null,
|
||||
List<string>? catalogNumbers = null,
|
||||
string? label = null,
|
||||
string? asin = null,
|
||||
Guid? musicBrainzReleaseId = null,
|
||||
Guid? musicBrainzReleaseGroupId = null,
|
||||
Guid? musicBrainzReleaseArtistId = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
List<UpdateArtistTrackRequest>? tracks = null,
|
||||
bool includeAlbumId = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeMediaFormat = true,
|
||||
bool includePackaging = true,
|
||||
bool includeBarcode = true,
|
||||
bool includeCatalogNumbers = true,
|
||||
bool includeLabel = true,
|
||||
bool includeAsin = true,
|
||||
bool includeMusicBrainzReleaseId = true,
|
||||
bool includeMusicBrainzReleaseGroupId = true,
|
||||
bool includeMusicBrainzReleaseArtistId = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeTracks = true)
|
||||
{
|
||||
return new UpdateArtistAlbumRequest(
|
||||
includeAlbumId ? (albumId ?? _faker.Random.Guid()) : null,
|
||||
includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
|
||||
includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
|
||||
includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
|
||||
includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null,
|
||||
includeCatalogNumbers ? (catalogNumbers ?? [_faker.Random.String2(_faker.Random.Number(1, 50))]) : null,
|
||||
includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
|
||||
includeAsin ? (asin ?? _faker.Random.AlphaNumeric(10)) : null,
|
||||
includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null,
|
||||
includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
|
||||
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
|
||||
includeTracks ? (tracks ?? _updateArtistTrackRequestFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateArtistAlbumRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdateArtistAlbumRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateArtistRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateArtistRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
|
||||
private readonly UpdateArtistAlbumRequestFixture _updateArtistAlbumRequestFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to update an artist.
|
||||
/// </summary>
|
||||
/// <param name="metadata">Optional. The metadata of the artist.</param>
|
||||
/// <param name="website">Optional. The website of the artist.</param>
|
||||
/// <param name="musicBrainzArtistId">Optional. The MusicBrainz identifier of the artist.</param>
|
||||
/// <param name="ipis">Optional. The IPI codes of the artist.</param>
|
||||
/// <param name="isnis">Optional. The ISNI codes of the artist.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that make up the artist.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the artist.</param>
|
||||
/// <param name="albums">Optional. The albums of the artist.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWebsite">Whether the website should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzArtistId">Whether the MusicBrainz artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIpis">Whether the IPI codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsnis">Whether the ISNI codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAlbums">Whether the albums list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to update an artist.</returns>
|
||||
public UpdateArtistRequest Create(
|
||||
MusicArtistMetadataDto? metadata = null,
|
||||
string? website = null,
|
||||
Guid? musicBrainzArtistId = null,
|
||||
List<string>? ipis = null,
|
||||
List<string>? isnis = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
List<UpdateArtistAlbumRequest>? albums = null,
|
||||
bool includeMetadata = true,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeIpis = true,
|
||||
bool includeIsnis = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeAlbums = true)
|
||||
{
|
||||
return new UpdateArtistRequest(
|
||||
includeMetadata ? (metadata ?? _musicArtistMetadataDtoFixture.Create()) : null,
|
||||
includeWebsite ? (website ?? _faker.Internet.Url()) : null,
|
||||
includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : null,
|
||||
includeIpis ? (ipis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(9))]) : null,
|
||||
includeIsnis ? (isnis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(16))]) : null,
|
||||
includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
|
||||
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
|
||||
includeAlbums ? (albums ?? _updateArtistAlbumRequestFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateArtistRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdateArtistRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.Common;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateArtistTrackRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateArtistTrackRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new();
|
||||
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
|
||||
private readonly MoodDtoFixture _moodDtoFixture = new();
|
||||
private readonly IsrcDtoFixture _isrcDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to update a track of an album of an artist.
|
||||
/// </summary>
|
||||
/// <param name="trackId">Optional. The Id of the track, when the track already exists.</param>
|
||||
/// <param name="path">Optional. The file system path of the track.</param>
|
||||
/// <param name="metadata">Optional. The audio metadata of the track.</param>
|
||||
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
|
||||
/// <param name="discNumber">Optional. The number of the disc the track belongs to.</param>
|
||||
/// <param name="script">Optional. The script used by the language of the track.</param>
|
||||
/// <param name="key">Optional. The musical key of the track.</param>
|
||||
/// <param name="bpm">Optional. The tempo of the track in beats per minute.</param>
|
||||
/// <param name="work">Optional. The work the track is a recording of.</param>
|
||||
/// <param name="musicBrainzRecordingId">Optional. The MusicBrainz identifier of the recording.</param>
|
||||
/// <param name="musicBrainzTrackId">Optional. The MusicBrainz identifier of the track.</param>
|
||||
/// <param name="moods">Optional. The moods of the track.</param>
|
||||
/// <param name="isrcs">Optional. The ISRC codes of the track.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that performed on the track.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the track.</param>
|
||||
/// <param name="includeTrackId">Whether the track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePath">Whether the path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeTrackNumber">Whether the track number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDiscNumber">Whether the disc number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeKey">Whether the musical key should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBpm">Whether the tempo should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to update a track of an album of an artist.</returns>
|
||||
public UpdateArtistTrackRequest Create(
|
||||
Guid? trackId = null,
|
||||
string? path = null,
|
||||
MusicTrackMetadataDto? metadata = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
string? script = null,
|
||||
MusicKey? key = null,
|
||||
int? bpm = null,
|
||||
MusicWorkDto? work = null,
|
||||
Guid? musicBrainzRecordingId = null,
|
||||
Guid? musicBrainzTrackId = null,
|
||||
List<MoodDto>? moods = null,
|
||||
List<IsrcDto>? isrcs = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
bool includeTrackId = true,
|
||||
bool includePath = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeTrackNumber = true,
|
||||
bool includeDiscNumber = true,
|
||||
bool includeScript = true,
|
||||
bool includeKey = true,
|
||||
bool includeBpm = true,
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true)
|
||||
{
|
||||
return new UpdateArtistTrackRequest(
|
||||
includeTrackId ? (trackId ?? _faker.Random.Guid()) : null,
|
||||
includePath ? (path ?? Path.Combine(Path.GetTempPath(), "lumina-tracks", _faker.System.FileName())) : null,
|
||||
includeMetadata ? (metadata ?? _musicTrackMetadataDtoFixture.Create()) : null,
|
||||
includeTrackNumber ? (trackNumber ?? _faker.Random.Int(1, 30)) : null,
|
||||
includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
|
||||
includeScript ? (script ?? _faker.Random.AlphaNumeric(4)) : null,
|
||||
includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
|
||||
includeBpm ? (bpm ?? _faker.Random.Int(40, 220)) : null,
|
||||
includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null,
|
||||
includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
|
||||
includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateArtistTrackRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdateArtistTrackRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.Common;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AddTrackRequest"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddTrackRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new();
|
||||
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
|
||||
private readonly MoodDtoFixture _moodDtoFixture = new();
|
||||
private readonly IsrcDtoFixture _isrcDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to add a track.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The file system path of the track.</param>
|
||||
/// <param name="metadata">Optional. The audio metadata of the track.</param>
|
||||
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
|
||||
/// <param name="discNumber">Optional. The number of the disc the track belongs to.</param>
|
||||
/// <param name="script">Optional. The script used by the language of the track.</param>
|
||||
/// <param name="key">Optional. The musical key of the track.</param>
|
||||
/// <param name="bpm">Optional. The tempo of the track in beats per minute.</param>
|
||||
/// <param name="work">Optional. The work the track is a recording of.</param>
|
||||
/// <param name="musicBrainzRecordingId">Optional. The MusicBrainz identifier of the recording.</param>
|
||||
/// <param name="musicBrainzTrackId">Optional. The MusicBrainz identifier of the track.</param>
|
||||
/// <param name="moods">Optional. The list of moods of the track.</param>
|
||||
/// <param name="isrcs">Optional. The list of ISRC of the track.</param>
|
||||
/// <param name="contributors">Optional. The list of media contributors that performed on the track.</param>
|
||||
/// <param name="ratings">Optional. The list of ratings for this track.</param>
|
||||
/// <param name="includePath">Whether the path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeTrackNumber">Whether the track number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDiscNumber">Whether the disc number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeKey">Whether the musical key should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBpm">Whether the tempo should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to add a track.</returns>
|
||||
public AddTrackRequest Create(
|
||||
string? path = null,
|
||||
MusicTrackMetadataDto? metadata = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
string? script = null,
|
||||
MusicKey? key = null,
|
||||
int? bpm = null,
|
||||
MusicWorkDto? work = null,
|
||||
Guid? musicBrainzRecordingId = null,
|
||||
Guid? musicBrainzTrackId = null,
|
||||
List<MoodDto>? moods = null,
|
||||
List<IsrcDto>? isrcs = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
bool includePath = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeTrackNumber = true,
|
||||
bool includeDiscNumber = true,
|
||||
bool includeScript = true,
|
||||
bool includeKey = true,
|
||||
bool includeBpm = true,
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true)
|
||||
{
|
||||
return new AddTrackRequest(
|
||||
includePath ? path ?? Path.Combine(Path.GetTempPath(), "lumina-tracks", _faker.System.FileName()) : null,
|
||||
includeMetadata ? metadata ?? _musicTrackMetadataDtoFixture.Create() : null,
|
||||
includeTrackNumber ? trackNumber ?? _faker.Random.Int(1, 30) : null,
|
||||
includeDiscNumber ? discNumber ?? _faker.Random.Int(1, 3) : null,
|
||||
includeScript ? script ?? _faker.Random.AlphaNumeric(4) : null,
|
||||
includeKey ? key ?? _faker.PickRandom<MusicKey>() : null,
|
||||
includeBpm ? bpm ?? _faker.Random.Int(40, 220) : null,
|
||||
includeWork ? work ?? _musicWorkDtoFixture.Create() : null,
|
||||
includeMusicBrainzRecordingId ? musicBrainzRecordingId ?? _faker.Random.Guid() : null,
|
||||
includeMusicBrainzTrackId ? musicBrainzTrackId ?? _faker.Random.Guid() : null,
|
||||
includeMoods ? moods ?? _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeIsrcs ? isrcs ?? _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeContributors ? contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeRatings ? ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="AddTrackRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<AddTrackRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ShuffleTracksRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ShuffleTracksRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="ShuffleTracksRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">Optional. The maximum number of tracks to return.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist whose tracks are sampled.</param>
|
||||
/// <param name="albumId">Optional. The Id of the album whose tracks are sampled.</param>
|
||||
/// <param name="excludedTrackIds">Optional. The tracks that must not be returned.</param>
|
||||
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAlbumId">Whether the album Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeExcludedTrackIds">Whether the excluded track Ids should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="ShuffleTracksRequest"/>.</returns>
|
||||
public ShuffleTracksRequest Create(
|
||||
int? count = null,
|
||||
Guid? artistId = null,
|
||||
Guid? albumId = null,
|
||||
List<Guid>? excludedTrackIds = null,
|
||||
bool includeArtistId = true,
|
||||
bool includeAlbumId = true,
|
||||
bool includeExcludedTrackIds = true)
|
||||
{
|
||||
return new ShuffleTracksRequest(
|
||||
count ?? Random.Shared.Next(1, 501),
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid()) : null,
|
||||
includeAlbumId ? (albumId ?? Guid.NewGuid()) : null,
|
||||
includeExcludedTrackIds
|
||||
? (excludedTrackIds ?? [.. Enumerable.Range(0, Random.Shared.Next(0, 3)).Select(_ => Guid.NewGuid())])
|
||||
: null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="ShuffleTracksRequest"/> records with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="ShuffleTracksRequest"/> records.</returns>
|
||||
public List<ShuffleTracksRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.Common;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateTrackRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateTrackRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new();
|
||||
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
|
||||
private readonly MoodDtoFixture _moodDtoFixture = new();
|
||||
private readonly IsrcDtoFixture _isrcDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to update a track.
|
||||
/// </summary>
|
||||
/// <param name="metadata">Optional. The audio metadata of the track.</param>
|
||||
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
|
||||
/// <param name="discNumber">Optional. The number of the disc the track belongs to.</param>
|
||||
/// <param name="script">Optional. The script used by the language of the track.</param>
|
||||
/// <param name="key">Optional. The musical key of the track.</param>
|
||||
/// <param name="bpm">Optional. The tempo of the track in beats per minute.</param>
|
||||
/// <param name="work">Optional. The work the track is a recording of.</param>
|
||||
/// <param name="musicBrainzRecordingId">Optional. The MusicBrainz identifier of the recording.</param>
|
||||
/// <param name="musicBrainzTrackId">Optional. The MusicBrainz identifier of the track.</param>
|
||||
/// <param name="moods">Optional. The moods of the track.</param>
|
||||
/// <param name="isrcs">Optional. The ISRC codes of the track.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that performed on the track.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the track.</param>
|
||||
/// <param name="includeDiscNumber">Whether the disc number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeKey">Whether the musical key should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBpm">Whether the tempo should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeTrackNumber">Whether the track number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to update a track.</returns>
|
||||
public UpdateTrackRequest Create(
|
||||
MusicTrackMetadataDto? metadata = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
string? script = null,
|
||||
MusicKey? key = null,
|
||||
int? bpm = null,
|
||||
MusicWorkDto? work = null,
|
||||
Guid? musicBrainzRecordingId = null,
|
||||
Guid? musicBrainzTrackId = null,
|
||||
List<MoodDto>? moods = null,
|
||||
List<IsrcDto>? isrcs = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
bool includeDiscNumber = true,
|
||||
bool includeScript = true,
|
||||
bool includeKey = true,
|
||||
bool includeBpm = true,
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeTrackNumber = true)
|
||||
{
|
||||
return new UpdateTrackRequest(
|
||||
includeMetadata ? (metadata ?? _musicTrackMetadataDtoFixture.Create()) : null,
|
||||
includeTrackNumber ? (trackNumber ?? _faker.Random.Int(1, 20)) : null,
|
||||
includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
|
||||
includeScript ? (script ?? _faker.Random.String2(_faker.Random.Number(1, 50))) : null,
|
||||
includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
|
||||
includeBpm ? (bpm ?? _faker.Random.Int(40, 240)) : null,
|
||||
includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null,
|
||||
includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
|
||||
includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateTrackRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdateTrackRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AddLibraryRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddLibraryRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="AddLibraryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="title">Optional. The title of the media library.</param>
|
||||
/// <param name="libraryType">Optional. The type of the media library.</param>
|
||||
/// <param name="contentLocations">Optional. The file system paths of the media library content directories.</param>
|
||||
/// <param name="coverImage">Optional. The path of the image file used as the cover.</param>
|
||||
/// <param name="isEnabled">Optional. Whether the media library is enabled.</param>
|
||||
/// <param name="isLocked">Optional. Whether the media library is locked.</param>
|
||||
/// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param>
|
||||
/// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param>
|
||||
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param>
|
||||
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Optional. Whether hidden files and directories should be skipped during scan.</param>
|
||||
/// <param name="isContentOnSsd">Optional. Whether the content of the media library is stored on a solid state drive.</param>
|
||||
/// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param>
|
||||
/// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param>
|
||||
/// <param name="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
|
||||
/// <param name="metadataProviders">Optional. The choices made for the metadata providers of the media library.</param>
|
||||
/// <param name="artworkProviders">Optional. The choices made for the artwork providers of the media library.</param>
|
||||
/// <param name="bookReaders">Optional. The choices made for the book readers of the media library.</param>
|
||||
/// <returns>The created <see cref="AddLibraryRequest"/>.</returns>
|
||||
public AddLibraryRequest Create(
|
||||
string? title = null,
|
||||
string? libraryType = null,
|
||||
string[]? contentLocations = null,
|
||||
string? coverImage = null,
|
||||
bool? isEnabled = null,
|
||||
bool? isLocked = null,
|
||||
bool? canDownloadMetadataFromWeb = null,
|
||||
bool? shouldSaveMetadataInMediaDirectories = null,
|
||||
bool? shouldSkipUnchangedDirectoriesDuringScan = null,
|
||||
bool? shouldSkipHiddenFilesAndDirectoriesDuringScan = null,
|
||||
bool? isContentOnSsd = null,
|
||||
bool? shouldTrackConsumptionProgress = null,
|
||||
int? completionThresholdPercentage = null,
|
||||
LibraryPathTemplatePartRequest?[]? pathTemplateParts = null,
|
||||
LibraryProviderSelectionRequest?[]? metadataProviders = null,
|
||||
LibraryProviderSelectionRequest?[]? artworkProviders = null,
|
||||
LibraryProviderSelectionRequest?[]? bookReaders = null)
|
||||
{
|
||||
return new AddLibraryRequest(
|
||||
title ?? _faker.Commerce.Department(),
|
||||
libraryType ?? "EBook",
|
||||
contentLocations ?? [_faker.System.DirectoryPath()],
|
||||
coverImage ?? null,
|
||||
isEnabled ?? _faker.Random.Bool(),
|
||||
isLocked ?? _faker.Random.Bool(),
|
||||
canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
|
||||
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
|
||||
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(),
|
||||
shouldSkipHiddenFilesAndDirectoriesDuringScan ?? _faker.Random.Bool(),
|
||||
isContentOnSsd ?? false,
|
||||
shouldTrackConsumptionProgress,
|
||||
completionThresholdPercentage,
|
||||
pathTemplateParts,
|
||||
metadataProviders,
|
||||
artworkProviders,
|
||||
bookReaders
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="AddLibraryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<AddLibraryRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="CancelLibraryScanRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class CancelLibraryScanRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="CancelLibraryScanRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library whose scan is cancelled.</param>
|
||||
/// <param name="scanId">Optional. The Id of the scan to cancel.</param>
|
||||
/// <returns>The created <see cref="CancelLibraryScanRequest"/>.</returns>
|
||||
public CancelLibraryScanRequest Create(
|
||||
Guid? libraryId = null,
|
||||
Guid? scanId = null)
|
||||
{
|
||||
return new CancelLibraryScanRequest(
|
||||
libraryId ?? _faker.Random.Guid(),
|
||||
scanId ?? _faker.Random.Guid()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="CancelLibraryScanRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<CancelLibraryScanRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="DeleteLibraryRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class DeleteLibraryRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="DeleteLibraryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the media library to delete.</param>
|
||||
/// <returns>The created <see cref="DeleteLibraryRequest"/>.</returns>
|
||||
public DeleteLibraryRequest Create(Guid? id = null)
|
||||
{
|
||||
return new DeleteLibraryRequest(
|
||||
id ?? _faker.Random.Guid()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="DeleteLibraryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<DeleteLibraryRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetLibraryPathTemplatePartsRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetLibraryPathTemplatePartsRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetLibraryPathTemplatePartsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryType">Optional. The media library type whose available path parts are retrieved.</param>
|
||||
/// <returns>The created <see cref="GetLibraryPathTemplatePartsRequest"/>.</returns>
|
||||
public GetLibraryPathTemplatePartsRequest Create(string? libraryType = null)
|
||||
{
|
||||
return new GetLibraryPathTemplatePartsRequest(libraryType ?? "Music");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetLibraryPathTemplatePartsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetLibraryPathTemplatePartsRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetLibraryRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetLibraryRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetLibraryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the media library to retrieve.</param>
|
||||
/// <returns>The created <see cref="GetLibraryRequest"/>.</returns>
|
||||
public GetLibraryRequest Create(Guid? id = null)
|
||||
{
|
||||
return new GetLibraryRequest(
|
||||
id ?? _faker.Random.Guid()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetLibraryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetLibraryRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetLibraryScanProgressRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetLibraryScanProgressRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetLibraryScanProgressRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library whose scan progress is requested.</param>
|
||||
/// <param name="scanId">Optional. The Id of the media library scan whose progress is requested.</param>
|
||||
/// <returns>The created <see cref="GetLibraryScanProgressRequest"/>.</returns>
|
||||
public GetLibraryScanProgressRequest Create(
|
||||
Guid? libraryId = null,
|
||||
Guid? scanId = null)
|
||||
{
|
||||
return new GetLibraryScanProgressRequest(
|
||||
libraryId ?? _faker.Random.Guid(),
|
||||
scanId ?? _faker.Random.Guid()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetLibraryScanProgressRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetLibraryScanProgressRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="LibraryPathTemplatePartRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class LibraryPathTemplatePartRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="LibraryPathTemplatePartRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="kind">Optional. The kind of the path part.</param>
|
||||
/// <param name="representation">Optional. The literal text or the value mask of the path part.</param>
|
||||
/// <param name="isOptional">Whether the path part can be absent from the path.</param>
|
||||
/// <returns>The created <see cref="LibraryPathTemplatePartRequest"/>.</returns>
|
||||
public LibraryPathTemplatePartRequest Create(
|
||||
string? kind = null,
|
||||
string? representation = null,
|
||||
bool isOptional = false)
|
||||
{
|
||||
return new LibraryPathTemplatePartRequest(
|
||||
kind ?? "Artist",
|
||||
representation ?? "{0}",
|
||||
isOptional);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="LibraryPathTemplatePartRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<LibraryPathTemplatePartRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="LibraryProviderSelectionRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class LibraryProviderSelectionRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="LibraryProviderSelectionRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="pluginId">Optional. The Id of the plugin providing the provider or reader.</param>
|
||||
/// <param name="isEnabled">Whether the provider or reader is enabled.</param>
|
||||
/// <param name="includeIsEnabled">Whether the choice carries an enabled state. When <see langword="false"/>, the enabled state is <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="LibraryProviderSelectionRequest"/>.</returns>
|
||||
public LibraryProviderSelectionRequest Create(
|
||||
Guid? pluginId = null,
|
||||
bool isEnabled = true,
|
||||
bool includeIsEnabled = true)
|
||||
{
|
||||
return new LibraryProviderSelectionRequest(
|
||||
pluginId ?? Guid.NewGuid(),
|
||||
includeIsEnabled ? isEnabled : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="LibraryProviderSelectionRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<LibraryProviderSelectionRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ScanLibraryRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ScanLibraryRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="ScanLibraryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the media library to scan.</param>
|
||||
/// <returns>The created <see cref="ScanLibraryRequest"/>.</returns>
|
||||
public ScanLibraryRequest Create(Guid? id = null)
|
||||
{
|
||||
return new ScanLibraryRequest(
|
||||
id ?? _faker.Random.Guid()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="ScanLibraryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<ScanLibraryRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.Management;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateLibraryRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateLibraryRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="UpdateLibraryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the media library to update.</param>
|
||||
/// <param name="title">Optional. The title of the media library.</param>
|
||||
/// <param name="libraryType">Optional. The type of the media library.</param>
|
||||
/// <param name="contentLocations">Optional. The file system paths of the media library content directories.</param>
|
||||
/// <param name="coverImage">Optional. The path of the image file used as the cover.</param>
|
||||
/// <param name="isEnabled">Optional. Whether the media library is enabled.</param>
|
||||
/// <param name="isLocked">Optional. Whether the media library is locked.</param>
|
||||
/// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param>
|
||||
/// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param>
|
||||
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param>
|
||||
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Optional. Whether hidden files and directories should be skipped during scan.</param>
|
||||
/// <param name="isContentOnSsd">Optional. Whether the content of the media library is stored on a solid state drive.</param>
|
||||
/// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param>
|
||||
/// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param>
|
||||
/// <param name="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
|
||||
/// <param name="metadataProviders">Optional. The choices made for the metadata providers of the media library.</param>
|
||||
/// <param name="artworkProviders">Optional. The choices made for the artwork providers of the media library.</param>
|
||||
/// <param name="bookReaders">Optional. The choices made for the book readers of the media library.</param>
|
||||
/// <returns>The created <see cref="UpdateLibraryRequest"/>.</returns>
|
||||
public UpdateLibraryRequest Create(
|
||||
Guid? id = null,
|
||||
string? title = null,
|
||||
string? libraryType = null,
|
||||
string[]? contentLocations = null,
|
||||
string? coverImage = null,
|
||||
bool? isEnabled = null,
|
||||
bool? isLocked = null,
|
||||
bool? canDownloadMetadataFromWeb = null,
|
||||
bool? shouldSaveMetadataInMediaDirectories = null,
|
||||
bool? shouldSkipUnchangedDirectoriesDuringScan = null,
|
||||
bool? shouldSkipHiddenFilesAndDirectoriesDuringScan = null,
|
||||
bool? isContentOnSsd = null,
|
||||
bool? shouldTrackConsumptionProgress = null,
|
||||
int? completionThresholdPercentage = null,
|
||||
LibraryPathTemplatePartRequest?[]? pathTemplateParts = null,
|
||||
LibraryProviderSelectionRequest?[]? metadataProviders = null,
|
||||
LibraryProviderSelectionRequest?[]? artworkProviders = null,
|
||||
LibraryProviderSelectionRequest?[]? bookReaders = null)
|
||||
{
|
||||
return new UpdateLibraryRequest(
|
||||
id ?? _faker.Random.Guid(),
|
||||
title ?? _faker.Commerce.Department(),
|
||||
libraryType ?? "EBook",
|
||||
contentLocations ?? [_faker.System.DirectoryPath()],
|
||||
coverImage ?? null,
|
||||
isEnabled ?? _faker.Random.Bool(),
|
||||
isLocked ?? _faker.Random.Bool(),
|
||||
canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
|
||||
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
|
||||
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(),
|
||||
shouldSkipHiddenFilesAndDirectoriesDuringScan ?? _faker.Random.Bool(),
|
||||
isContentOnSsd ?? false,
|
||||
shouldTrackConsumptionProgress,
|
||||
completionThresholdPercentage,
|
||||
pathTemplateParts,
|
||||
metadataProviders,
|
||||
artworkProviders,
|
||||
bookReaders
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateLibraryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdateLibraryRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+210
@@ -0,0 +1,210 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AddBookRequest"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddBookRequestFixture
|
||||
{
|
||||
private readonly IsbnDtoFixture _isbnDtoFixture = new();
|
||||
private readonly BookRatingDtoFixture _bookRatingDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly WrittenContentMetadataDtoFixture _writtenContentMetadataDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to add a book.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The file system path of the book.</param>
|
||||
/// <param name="metadata">Optional. The written content metadata of the book.</param>
|
||||
/// <param name="format">Optional. The format of the book.</param>
|
||||
/// <param name="edition">Optional. The edition of the book.</param>
|
||||
/// <param name="volumeNumber">Optional. The volume or book number in the series.</param>
|
||||
/// <param name="series">Optional. The series the book is part of.</param>
|
||||
/// <param name="asin">Optional. The ASIN of the book.</param>
|
||||
/// <param name="goodreadsId">Optional. The Goodreads Id of the book.</param>
|
||||
/// <param name="lccn">Optional. The LCCN of the book.</param>
|
||||
/// <param name="oclcNumber">Optional. The OCLC number of the book.</param>
|
||||
/// <param name="openLibraryId">Optional. The Open Library Id of the book.</param>
|
||||
/// <param name="libraryThingId">Optional. The LibraryThing Id of the book.</param>
|
||||
/// <param name="googleBooksId">Optional. The Google Books Id of the book.</param>
|
||||
/// <param name="barnesAndNobleId">Optional. The Barnes and Noble Id of the book.</param>
|
||||
/// <param name="appleBooksId">Optional. The Apple Books Id of the book.</param>
|
||||
/// <param name="isbns">Optional. The ISBNs of the book.</param>
|
||||
/// <param name="contributors">Optional. The contributors of the book.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the book.</param>
|
||||
/// <param name="includeFormat">Whether the format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeEdition">Whether the edition should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeVolumeNumber">Whether the volume number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoodreadsId">Whether the Goodreads Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLccn">Whether the LCCN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOclcNumber">Whether the OCLC number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOpenLibraryId">Whether the Open Library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLibraryThingId">Whether the LibraryThing Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoogleBooksId">Whether the Google Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarnesAndNobleId">Whether the Barnes and Noble Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAppleBooksId">Whether the Apple Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsbns">Whether the ISBNs should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to add a book.</returns>
|
||||
public AddBookRequest Create(
|
||||
string? path = null,
|
||||
WrittenContentMetadataDto? metadata = null,
|
||||
BookFormat? format = null,
|
||||
string? edition = null,
|
||||
float? volumeNumber = null,
|
||||
BookSeriesDto? series = null,
|
||||
string? asin = null,
|
||||
string? goodreadsId = null,
|
||||
string? lccn = null,
|
||||
string? oclcNumber = null,
|
||||
string? openLibraryId = null,
|
||||
string? libraryThingId = null,
|
||||
string? googleBooksId = null,
|
||||
string? barnesAndNobleId = null,
|
||||
string? appleBooksId = null,
|
||||
List<IsbnDto>? isbns = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<BookRatingDto>? ratings = null,
|
||||
bool includeFormat = true,
|
||||
bool includeEdition = true,
|
||||
bool includeVolumeNumber = true,
|
||||
bool includeAsin = true,
|
||||
bool includeGoodreadsId = true,
|
||||
bool includeLccn = true,
|
||||
bool includeOclcNumber = true,
|
||||
bool includeOpenLibraryId = true,
|
||||
bool includeLibraryThingId = true,
|
||||
bool includeGoogleBooksId = true,
|
||||
bool includeBarnesAndNobleId = true,
|
||||
bool includeAppleBooksId = true,
|
||||
bool includeIsbns = true,
|
||||
bool includeRatings = true,
|
||||
bool includeContributors = true)
|
||||
{
|
||||
return new Faker<AddBookRequest>()
|
||||
.CustomInstantiator(f => new AddBookRequest(
|
||||
default!,
|
||||
default!,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!
|
||||
))
|
||||
.RuleFor(x => x.Path, f => path ?? Path.Combine(Path.GetTempPath(), "lumina-books", f.System.FileName()))
|
||||
.RuleFor(x => x.Metadata, metadata ?? _writtenContentMetadataDtoFixture.Create())
|
||||
.RuleFor(x => x.Format, f => format ?? (includeFormat ? f.PickRandom<BookFormat>() : null))
|
||||
.RuleFor(x => x.Edition, f => edition ?? (includeEdition ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.VolumeNumber, f => volumeNumber ?? (includeVolumeNumber ? (float?)f.Random.Number(1, 3) : null))
|
||||
.RuleFor(x => x.Series, series)
|
||||
.RuleFor(x => x.ASIN, f => asin ?? (includeAsin ? f.Random.String2(10) : null))
|
||||
.RuleFor(x => x.GoodreadsId, f => goodreadsId ?? (includeGoodreadsId ? f.Random.Number(100000, 500000).ToString() : null))
|
||||
.RuleFor(x => x.LCCN, f => lccn ?? (includeLccn ? CreateLccn(f) : null))
|
||||
.RuleFor(x => x.OCLCNumber, f => oclcNumber ?? (includeOclcNumber ? CreateOclcNumber(f) : null))
|
||||
.RuleFor(x => x.OpenLibraryId, f => openLibraryId ?? (includeOpenLibraryId ? CreateOpenLibraryId(f) : null))
|
||||
.RuleFor(x => x.LibraryThingId, f => libraryThingId ?? (includeLibraryThingId ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.GoogleBooksId, f => googleBooksId ?? (includeGoogleBooksId ? CreateGoogleBooksId(f) : null))
|
||||
.RuleFor(x => x.BarnesAndNobleId, f => barnesAndNobleId ?? (includeBarnesAndNobleId ? f.Random.String2(10, "0123456789") : null))
|
||||
.RuleFor(x => x.AppleBooksId, f => appleBooksId ?? (includeAppleBooksId ? $"id{f.Random.Number(1, 999999)}" : null))
|
||||
.RuleFor(p => p.ISBNs, f => isbns ?? (includeIsbns ? [.. _isbnDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
|
||||
.RuleFor(p => p.Ratings, f => ratings ?? (includeRatings ? [.. _bookRatingDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
|
||||
.RuleFor(x => x.Contributors, f => contributors ?? (includeContributors ? [.. _mediaContributorReferenceDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random LCCN (Library of Congress Control Number).
|
||||
/// </summary>
|
||||
/// <param name="faker">The faker used to generate the value.</param>
|
||||
/// <returns>The generated LCCN.</returns>
|
||||
private static string CreateLccn(Faker faker)
|
||||
{
|
||||
string letters = new([.. Enumerable.Range(0, faker.Random.Number(0, 3)).Select(_ => faker.Random.Char('a', 'z'))]);
|
||||
string digits = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
|
||||
return letters + digits;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random OCLC number (WorldCat identifier).
|
||||
/// </summary>
|
||||
/// <param name="faker">The faker used to generate the value.</param>
|
||||
/// <returns>The generated OCLC number.</returns>
|
||||
private static string CreateOclcNumber(Faker faker)
|
||||
{
|
||||
string[] prefixes = ["ocm", "ocn", "on", "(OCoLC)"];
|
||||
string prefix = faker.Random.ArrayElement(prefixes);
|
||||
string number;
|
||||
switch (prefix)
|
||||
{
|
||||
case "ocm":
|
||||
number = faker.Random.String2(8, "0123456789");
|
||||
break;
|
||||
case "ocn":
|
||||
number = faker.Random.String2(faker.Random.Number(9, 11), "0123456789");
|
||||
break;
|
||||
case "on":
|
||||
number = faker.Random.String2(10, "0123456789");
|
||||
break;
|
||||
case "(OCoLC)":
|
||||
number = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
|
||||
break;
|
||||
default:
|
||||
number = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
|
||||
return number;
|
||||
}
|
||||
return prefix + number;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random Open Library Id.
|
||||
/// </summary>
|
||||
/// <param name="faker">The faker used to generate the value.</param>
|
||||
/// <returns>The generated Open Library Id.</returns>
|
||||
private static string CreateOpenLibraryId(Faker faker)
|
||||
{
|
||||
int firstDigit = faker.Random.Number(1, 9);
|
||||
string remainingDigits = faker.Random.String2(faker.Random.Number(0, 6), "0123456789");
|
||||
char suffix = faker.Random.ArrayElement(['A', 'M', 'W']);
|
||||
return $"OL{firstDigit}{remainingDigits}{suffix}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random Google Books Id.
|
||||
/// </summary>
|
||||
/// <param name="faker">The faker used to generate the value.</param>
|
||||
/// <returns>The generated Google Books Id.</returns>
|
||||
private static string CreateGoogleBooksId(Faker faker)
|
||||
{
|
||||
const string VALID_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
||||
return new string([.. Enumerable.Repeat(VALID_CHARS, 12).Select(s => s[faker.Random.Number(VALID_CHARS.Length - 1)])]);
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetBooksLiteRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetBooksLiteRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="GetBooksLiteRequest"/> with default or random values.
|
||||
/// </summary>
|
||||
/// <param name="currentPage">Optional. The page of results to retrieve.</param>
|
||||
/// <param name="perPage">Optional. The maximum number of books to retrieve per page.</param>
|
||||
/// <param name="searchTerm">Optional. The search term used to filter results.</param>
|
||||
/// <param name="filterAlphaKey">Optional. The alpha key used to filter the results by the first character of their title, for the alpha picker.</param>
|
||||
/// <param name="shouldIgnoreThePrefixForAlphaPicker">Optional. Whether the leading "The " prefix of a title should be ignored when computing the alpha key, or not.</param>
|
||||
/// <param name="sortBy">Optional. The name of the field by which to sort the results.</param>
|
||||
/// <param name="sortOrder">Optional. The direction in which to sort the results.</param>
|
||||
/// <param name="includeCurrentPage">Whether the current page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePerPage">Whether the per page count should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetBooksLiteRequest"/>.</returns>
|
||||
public GetBooksLiteRequest Create(
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
string? searchTerm = null,
|
||||
string? filterAlphaKey = null,
|
||||
bool shouldIgnoreThePrefixForAlphaPicker = false,
|
||||
string? sortBy = null,
|
||||
SortOrder? sortOrder = null,
|
||||
bool includeCurrentPage = true,
|
||||
bool includePerPage = true)
|
||||
{
|
||||
return new GetBooksLiteRequest(
|
||||
CurrentPage: includeCurrentPage ? (currentPage ?? _faker.Random.Number(1, 100)) : null,
|
||||
PerPage: includePerPage ? (perPage ?? _faker.Random.Number(1, 200)) : null,
|
||||
SearchTerm: searchTerm ?? _faker.Lorem.Word(),
|
||||
FilterAlphaKey: filterAlphaKey,
|
||||
ShouldIgnoreThePrefixForAlphaPicker: shouldIgnoreThePrefixForAlphaPicker,
|
||||
SortBy: sortBy ?? _faker.Lorem.Word(),
|
||||
SortOrder: sortOrder ?? _faker.PickRandom<SortOrder>()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetBooksLiteRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetBooksLiteRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetBooksRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetBooksRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="GetBooksRequest"/> with default or random values.
|
||||
/// </summary>
|
||||
/// <param name="currentPage">Optional. The page of results to retrieve.</param>
|
||||
/// <param name="perPage">Optional. The maximum number of books to retrieve per page.</param>
|
||||
/// <param name="searchTerm">Optional. The search term used to filter results.</param>
|
||||
/// <param name="sortBy">Optional. The name of the field by which to sort the results.</param>
|
||||
/// <param name="sortOrder">Optional. The direction in which to sort the results.</param>
|
||||
/// <param name="includeCurrentPage">Whether the current page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePerPage">Whether the per page count should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetBooksRequest"/>.</returns>
|
||||
public GetBooksRequest Create(
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
string? searchTerm = null,
|
||||
string? sortBy = null,
|
||||
SortOrder? sortOrder = null,
|
||||
bool includeCurrentPage = true,
|
||||
bool includePerPage = true)
|
||||
{
|
||||
return new GetBooksRequest(
|
||||
CurrentPage: includeCurrentPage ? (currentPage ?? _faker.Random.Number(1, 100)) : null,
|
||||
PerPage: includePerPage ? (perPage ?? _faker.Random.Number(1, 200)) : null,
|
||||
SearchTerm: searchTerm ?? _faker.Lorem.Word(),
|
||||
SortBy: sortBy ?? _faker.Lorem.Word(),
|
||||
SortOrder: sortOrder ?? _faker.PickRandom<SortOrder>()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetBooksRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetBooksRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateBookRequest"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateBookRequestFixture
|
||||
{
|
||||
private readonly IsbnDtoFixture _isbnDtoFixture = new();
|
||||
private readonly BookRatingDtoFixture _bookRatingDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly WrittenContentMetadataDtoFixture _writtenContentMetadataDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid request to update a book.
|
||||
/// </summary>
|
||||
/// <param name="metadata">Optional. The written content metadata of the book.</param>
|
||||
/// <param name="format">Optional. The format of the book.</param>
|
||||
/// <param name="edition">Optional. The edition of the book.</param>
|
||||
/// <param name="volumeNumber">Optional. The volume or book number in the series.</param>
|
||||
/// <param name="series">Optional. The series the book is part of.</param>
|
||||
/// <param name="asin">Optional. The ASIN of the book.</param>
|
||||
/// <param name="goodreadsId">Optional. The Goodreads Id of the book.</param>
|
||||
/// <param name="lccn">Optional. The LCCN of the book.</param>
|
||||
/// <param name="oclcNumber">Optional. The OCLC number of the book.</param>
|
||||
/// <param name="openLibraryId">Optional. The Open Library Id of the book.</param>
|
||||
/// <param name="libraryThingId">Optional. The LibraryThing Id of the book.</param>
|
||||
/// <param name="googleBooksId">Optional. The Google Books Id of the book.</param>
|
||||
/// <param name="barnesAndNobleId">Optional. The Barnes and Noble Id of the book.</param>
|
||||
/// <param name="appleBooksId">Optional. The Apple Books Id of the book.</param>
|
||||
/// <param name="isbns">Optional. The ISBNs of the book.</param>
|
||||
/// <param name="contributors">Optional. The contributors of the book.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the book.</param>
|
||||
/// <param name="includeFormat">Whether the format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeEdition">Whether the edition should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeVolumeNumber">Whether the volume number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoodreadsId">Whether the Goodreads Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLccn">Whether the LCCN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOclcNumber">Whether the OCLC number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOpenLibraryId">Whether the Open Library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLibraryThingId">Whether the LibraryThing Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeGoogleBooksId">Whether the Google Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarnesAndNobleId">Whether the Barnes and Noble Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAppleBooksId">Whether the Apple Books Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsbns">Whether the ISBNs should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created request to update a book.</returns>
|
||||
public UpdateBookRequest Create(
|
||||
WrittenContentMetadataDto? metadata = null,
|
||||
BookFormat? format = null,
|
||||
string? edition = null,
|
||||
float? volumeNumber = null,
|
||||
BookSeriesDto? series = null,
|
||||
string? asin = null,
|
||||
string? goodreadsId = null,
|
||||
string? lccn = null,
|
||||
string? oclcNumber = null,
|
||||
string? openLibraryId = null,
|
||||
string? libraryThingId = null,
|
||||
string? googleBooksId = null,
|
||||
string? barnesAndNobleId = null,
|
||||
string? appleBooksId = null,
|
||||
List<IsbnDto>? isbns = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<BookRatingDto>? ratings = null,
|
||||
bool includeFormat = true,
|
||||
bool includeEdition = true,
|
||||
bool includeVolumeNumber = true,
|
||||
bool includeAsin = true,
|
||||
bool includeGoodreadsId = true,
|
||||
bool includeLccn = true,
|
||||
bool includeOclcNumber = true,
|
||||
bool includeOpenLibraryId = true,
|
||||
bool includeLibraryThingId = true,
|
||||
bool includeGoogleBooksId = true,
|
||||
bool includeBarnesAndNobleId = true,
|
||||
bool includeAppleBooksId = true,
|
||||
bool includeIsbns = true,
|
||||
bool includeRatings = true,
|
||||
bool includeContributors = true)
|
||||
{
|
||||
return new Faker<UpdateBookRequest>()
|
||||
.CustomInstantiator(f => new UpdateBookRequest(
|
||||
default!,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default,
|
||||
default!,
|
||||
default!,
|
||||
default!
|
||||
))
|
||||
.RuleFor(x => x.Metadata, metadata ?? _writtenContentMetadataDtoFixture.Create())
|
||||
.RuleFor(x => x.Format, f => format ?? (includeFormat ? f.PickRandom<BookFormat>() : null))
|
||||
.RuleFor(x => x.Edition, f => edition ?? (includeEdition ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.VolumeNumber, f => volumeNumber ?? (includeVolumeNumber ? (float?)f.Random.Number(1, 3) : null))
|
||||
.RuleFor(x => x.Series, series)
|
||||
.RuleFor(x => x.ASIN, f => asin ?? (includeAsin ? f.Random.String2(10) : null))
|
||||
.RuleFor(x => x.GoodreadsId, f => goodreadsId ?? (includeGoodreadsId ? f.Random.Number(100000, 500000).ToString() : null))
|
||||
.RuleFor(x => x.LCCN, f => lccn ?? (includeLccn ? CreateLccn(f) : null))
|
||||
.RuleFor(x => x.OCLCNumber, f => oclcNumber ?? (includeOclcNumber ? CreateOclcNumber(f) : null))
|
||||
.RuleFor(x => x.OpenLibraryId, f => openLibraryId ?? (includeOpenLibraryId ? CreateOpenLibraryId(f) : null))
|
||||
.RuleFor(x => x.LibraryThingId, f => libraryThingId ?? (includeLibraryThingId ? f.Random.String2(f.Random.Number(1, 50)) : null))
|
||||
.RuleFor(x => x.GoogleBooksId, f => googleBooksId ?? (includeGoogleBooksId ? CreateGoogleBooksId(f) : null))
|
||||
.RuleFor(x => x.BarnesAndNobleId, f => barnesAndNobleId ?? (includeBarnesAndNobleId ? f.Random.String2(10, "0123456789") : null))
|
||||
.RuleFor(x => x.AppleBooksId, f => appleBooksId ?? (includeAppleBooksId ? $"id{f.Random.Number(1, 999999)}" : null))
|
||||
.RuleFor(p => p.ISBNs, f => isbns ?? (includeIsbns ? [.. _isbnDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
|
||||
.RuleFor(p => p.Ratings, f => ratings ?? (includeRatings ? [.. _bookRatingDtoFixture.CreateMany(f.Random.Number(1, 3))] : null))
|
||||
.RuleFor(x => x.Contributors, f => contributors ?? (includeContributors ? [.. _mediaContributorReferenceDtoFixture.CreateMany(f.Random.Number(1, 3))] : null));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random LCCN (Library of Congress Control Number).
|
||||
/// </summary>
|
||||
/// <param name="faker">The faker used to generate the value.</param>
|
||||
/// <returns>The generated LCCN.</returns>
|
||||
private static string CreateLccn(Faker faker)
|
||||
{
|
||||
string letters = new([.. Enumerable.Range(0, faker.Random.Number(0, 3)).Select(_ => faker.Random.Char('a', 'z'))]);
|
||||
string digits = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
|
||||
return letters + digits;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random OCLC number (WorldCat identifier).
|
||||
/// </summary>
|
||||
/// <param name="faker">The faker used to generate the value.</param>
|
||||
/// <returns>The generated OCLC number.</returns>
|
||||
private static string CreateOclcNumber(Faker faker)
|
||||
{
|
||||
string[] prefixes = ["ocm", "ocn", "on", "(OCoLC)"];
|
||||
string prefix = faker.Random.ArrayElement(prefixes);
|
||||
string number;
|
||||
switch (prefix)
|
||||
{
|
||||
case "ocm":
|
||||
number = faker.Random.String2(8, "0123456789");
|
||||
break;
|
||||
case "ocn":
|
||||
number = faker.Random.String2(faker.Random.Number(9, 11), "0123456789");
|
||||
break;
|
||||
case "on":
|
||||
number = faker.Random.String2(10, "0123456789");
|
||||
break;
|
||||
case "(OCoLC)":
|
||||
number = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
|
||||
break;
|
||||
default:
|
||||
number = faker.Random.String2(faker.Random.Number(8, 10), "0123456789");
|
||||
return number;
|
||||
}
|
||||
return prefix + number;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random Open Library Id.
|
||||
/// </summary>
|
||||
/// <param name="faker">The faker used to generate the value.</param>
|
||||
/// <returns>The generated Open Library Id.</returns>
|
||||
private static string CreateOpenLibraryId(Faker faker)
|
||||
{
|
||||
int firstDigit = faker.Random.Number(1, 9);
|
||||
string remainingDigits = faker.Random.String2(faker.Random.Number(0, 6), "0123456789");
|
||||
char suffix = faker.Random.ArrayElement(['A', 'M', 'W']);
|
||||
return $"OL{firstDigit}{remainingDigits}{suffix}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random Google Books Id.
|
||||
/// </summary>
|
||||
/// <param name="faker">The faker used to generate the value.</param>
|
||||
/// <returns>The generated Google Books Id.</returns>
|
||||
private static string CreateGoogleBooksId(Faker faker)
|
||||
{
|
||||
const string VALID_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
||||
return new string([.. Enumerable.Repeat(VALID_CHARS, 12).Select(s => s[faker.Random.Number(VALID_CHARS.Length - 1)])]);
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.Playlists;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Playlists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AddPlaylistEntriesRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddPlaylistEntriesRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="AddPlaylistEntriesRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="trackIds">Optional. The Ids of the tracks to add, in order.</param>
|
||||
/// <param name="trackCount">Optional. The number of random track Ids to generate when <paramref name="trackIds"/> is not supplied.</param>
|
||||
/// <param name="includeTrackIds">Whether the track Ids should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="AddPlaylistEntriesRequest"/>.</returns>
|
||||
public AddPlaylistEntriesRequest Create(
|
||||
List<Guid>? trackIds = null,
|
||||
int trackCount = 3,
|
||||
bool includeTrackIds = true)
|
||||
{
|
||||
return new AddPlaylistEntriesRequest(
|
||||
includeTrackIds ? (trackIds ?? CreateRandomTrackIds(trackCount)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="AddPlaylistEntriesRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="AddPlaylistEntriesRequest"/> instances.</returns>
|
||||
public List<AddPlaylistEntriesRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the requested number of distinct random track Ids.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of track Ids to create.</param>
|
||||
/// <returns>The created track Ids.</returns>
|
||||
private static List<Guid> CreateRandomTrackIds(int count)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Guid.NewGuid())];
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.Playlists;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Playlists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AddPlaylistEntryRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddPlaylistEntryRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="AddPlaylistEntryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="trackId">Optional. The Id of the track to add.</param>
|
||||
/// <param name="includeTrackId">Whether the track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="AddPlaylistEntryRequest"/>.</returns>
|
||||
public AddPlaylistEntryRequest Create(
|
||||
Guid? trackId = null,
|
||||
bool includeTrackId = true)
|
||||
{
|
||||
return new AddPlaylistEntryRequest(
|
||||
includeTrackId ? (trackId ?? Guid.NewGuid()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="AddPlaylistEntryRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="AddPlaylistEntryRequest"/> instances.</returns>
|
||||
public List<AddPlaylistEntryRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.Playlists;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Playlists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AddPlaylistScopeEntriesRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddPlaylistScopeEntriesRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="AddPlaylistScopeEntriesRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the music library the scope belongs to.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist the scope is limited to.</param>
|
||||
/// <param name="albumId">Optional. The Id of the album the scope is limited to.</param>
|
||||
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAlbumId">Whether the album Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="AddPlaylistScopeEntriesRequest"/>.</returns>
|
||||
public AddPlaylistScopeEntriesRequest Create(
|
||||
Guid? libraryId = null,
|
||||
Guid? artistId = null,
|
||||
Guid? albumId = null,
|
||||
bool includeArtistId = false,
|
||||
bool includeAlbumId = false)
|
||||
{
|
||||
return new AddPlaylistScopeEntriesRequest(
|
||||
libraryId ?? Guid.NewGuid(),
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid()) : null,
|
||||
includeAlbumId ? (albumId ?? Guid.NewGuid()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="AddPlaylistScopeEntriesRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="AddPlaylistScopeEntriesRequest"/> instances.</returns>
|
||||
public List<AddPlaylistScopeEntriesRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Playlists;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Playlists;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Playlists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="CreatePlaylistRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class CreatePlaylistRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="CreatePlaylistRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">Optional. The name of the playlist.</param>
|
||||
/// <param name="description">Optional. The description of the playlist.</param>
|
||||
/// <param name="type">Optional. The kind of media the playlist holds. Defaults to the only supported kind.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDescription">Whether the description should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeType">Whether the media type should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="CreatePlaylistRequest"/>.</returns>
|
||||
public CreatePlaylistRequest Create(
|
||||
string? name = null,
|
||||
string? description = null,
|
||||
PlaylistType? type = null,
|
||||
bool includeName = true,
|
||||
bool includeDescription = true,
|
||||
bool includeType = true)
|
||||
{
|
||||
return new CreatePlaylistRequest(
|
||||
includeName ? (name ?? _faker.Lorem.Sentence(3)) : null,
|
||||
includeDescription ? (description ?? _faker.Lorem.Sentence()) : null,
|
||||
includeType ? (type ?? PlaylistType.Music) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="CreatePlaylistRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="CreatePlaylistRequest"/> instances.</returns>
|
||||
public List<CreatePlaylistRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Playlists;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Playlists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetPlaylistRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetPlaylistRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetPlaylistRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="currentPage">Optional. The one based page of entries to return. Defaults to a bounded random page.</param>
|
||||
/// <param name="perPage">Optional. The number of entries per page. Defaults to a bounded random page size.</param>
|
||||
/// <param name="includeCurrentPage">Whether the current page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePerPage">Whether the per page count should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetPlaylistRequest"/>.</returns>
|
||||
public GetPlaylistRequest Create(
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
bool includeCurrentPage = true,
|
||||
bool includePerPage = true)
|
||||
{
|
||||
return new GetPlaylistRequest(
|
||||
includeCurrentPage ? (currentPage ?? _faker.Random.Int(1, 100)) : null,
|
||||
includePerPage ? (perPage ?? _faker.Random.Int(1, 200)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetPlaylistRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetPlaylistRequest"/> instances.</returns>
|
||||
public List<GetPlaylistRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Playlists;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Playlists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MovePlaylistEntryRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MovePlaylistEntryRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="MovePlaylistEntryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="targetPosition">Optional. The new zero based position of the entry. Defaults to a bounded random position.</param>
|
||||
/// <param name="includeTargetPosition">Whether the target position should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="MovePlaylistEntryRequest"/>.</returns>
|
||||
public MovePlaylistEntryRequest Create(
|
||||
int? targetPosition = null,
|
||||
bool includeTargetPosition = true)
|
||||
{
|
||||
return new MovePlaylistEntryRequest(
|
||||
includeTargetPosition ? (targetPosition ?? _faker.Random.Int(0, 1_000)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="MovePlaylistEntryRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MovePlaylistEntryRequest"/> instances.</returns>
|
||||
public List<MovePlaylistEntryRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Playlists;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Playlists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdatePlaylistRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdatePlaylistRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="UpdatePlaylistRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">Optional. The name of the playlist.</param>
|
||||
/// <param name="description">Optional. The description of the playlist.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDescription">Whether the description should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="UpdatePlaylistRequest"/>.</returns>
|
||||
public UpdatePlaylistRequest Create(
|
||||
string? name = null,
|
||||
string? description = null,
|
||||
bool includeName = true,
|
||||
bool includeDescription = true)
|
||||
{
|
||||
return new UpdatePlaylistRequest(
|
||||
includeName ? (name ?? _faker.Lorem.Sentence(3)) : null,
|
||||
includeDescription ? (description ?? _faker.Lorem.Sentence()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdatePlaylistRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="UpdatePlaylistRequest"/> instances.</returns>
|
||||
public List<UpdatePlaylistRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetLibraryArtworkProvidersRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetLibraryArtworkProvidersRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetLibraryArtworkProvidersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library whose artwork providers are retrieved.</param>
|
||||
/// <returns>The created <see cref="GetLibraryArtworkProvidersRequest"/>.</returns>
|
||||
public GetLibraryArtworkProvidersRequest Create(
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new GetLibraryArtworkProvidersRequest(
|
||||
libraryId ?? _faker.Random.Guid()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetLibraryArtworkProvidersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetLibraryArtworkProvidersRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetLibraryBookReadersRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetLibraryBookReadersRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetLibraryBookReadersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library whose book readers are retrieved.</param>
|
||||
/// <returns>The created <see cref="GetLibraryBookReadersRequest"/>.</returns>
|
||||
public GetLibraryBookReadersRequest Create(
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new GetLibraryBookReadersRequest(libraryId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetLibraryBookReadersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetLibraryBookReadersRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetLibraryMetadataProvidersRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetLibraryMetadataProvidersRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetLibraryMetadataProvidersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library whose metadata providers are retrieved.</param>
|
||||
/// <returns>The created <see cref="GetLibraryMetadataProvidersRequest"/>.</returns>
|
||||
public GetLibraryMetadataProvidersRequest Create(Guid? libraryId = null)
|
||||
{
|
||||
return new GetLibraryMetadataProvidersRequest(
|
||||
libraryId ?? _faker.Random.Guid()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetLibraryMetadataProvidersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetLibraryMetadataProvidersRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetLibraryTypeArtworkProvidersRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetLibraryTypeArtworkProvidersRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetLibraryTypeArtworkProvidersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryType">Optional. The media library type whose available artwork providers are retrieved.</param>
|
||||
/// <returns>The created <see cref="GetLibraryTypeArtworkProvidersRequest"/>.</returns>
|
||||
public GetLibraryTypeArtworkProvidersRequest Create(string? libraryType = null)
|
||||
{
|
||||
return new GetLibraryTypeArtworkProvidersRequest(libraryType ?? "Book");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetLibraryTypeArtworkProvidersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetLibraryTypeArtworkProvidersRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetLibraryTypeBookReadersRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetLibraryTypeBookReadersRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetLibraryTypeBookReadersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryType">Optional. The media library type whose available book readers are retrieved.</param>
|
||||
/// <returns>The created <see cref="GetLibraryTypeBookReadersRequest"/>.</returns>
|
||||
public GetLibraryTypeBookReadersRequest Create(string? libraryType = null)
|
||||
{
|
||||
return new GetLibraryTypeBookReadersRequest(libraryType ?? "Book");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetLibraryTypeBookReadersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetLibraryTypeBookReadersRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetLibraryTypeMetadataProvidersRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetLibraryTypeMetadataProvidersRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetLibraryTypeMetadataProvidersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryType">Optional. The media library type whose available metadata providers are retrieved.</param>
|
||||
/// <returns>The created <see cref="GetLibraryTypeMetadataProvidersRequest"/>.</returns>
|
||||
public GetLibraryTypeMetadataProvidersRequest Create(string? libraryType = null)
|
||||
{
|
||||
return new GetLibraryTypeMetadataProvidersRequest(libraryType ?? "Book");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetLibraryTypeMetadataProvidersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetLibraryTypeMetadataProvidersRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetPluginSettingsRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetPluginSettingsRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetPluginSettingsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="pluginId">Optional. The Id of the plugin whose settings are retrieved.</param>
|
||||
/// <returns>The created <see cref="GetPluginSettingsRequest"/>.</returns>
|
||||
public GetPluginSettingsRequest Create(Guid? pluginId = null)
|
||||
{
|
||||
return new GetPluginSettingsRequest(
|
||||
pluginId ?? _faker.Random.Guid()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetPluginSettingsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetPluginSettingsRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Plugins;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdatePluginSettingsRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdatePluginSettingsRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="UpdatePluginSettingsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="pluginId">Optional. The Id of the plugin whose settings are updated.</param>
|
||||
/// <param name="settings">Optional. The settings to apply to the plugin.</param>
|
||||
/// <param name="includeSettings">Whether the settings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="UpdatePluginSettingsRequest"/>.</returns>
|
||||
public UpdatePluginSettingsRequest Create(
|
||||
Guid? pluginId = null,
|
||||
IReadOnlyDictionary<string, string>? settings = null,
|
||||
bool includeSettings = true)
|
||||
{
|
||||
return new UpdatePluginSettingsRequest(
|
||||
pluginId ?? _faker.Random.Guid(),
|
||||
includeSettings
|
||||
? settings ?? new Dictionary<string, string>
|
||||
{
|
||||
[_faker.Lorem.Word()] = _faker.Lorem.Word()
|
||||
}
|
||||
: null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdatePluginSettingsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdatePluginSettingsRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Scheduling;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Scheduling;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AddScheduledJobRequest"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddScheduledJobRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid request to add a scheduled job.
|
||||
/// </summary>
|
||||
/// <param name="name">Optional. The name of the scheduled job.</param>
|
||||
/// <param name="taskType">Optional. The type of the task executed by the scheduled job.</param>
|
||||
/// <param name="scheduleType">Optional. The type of the schedule of the scheduled job.</param>
|
||||
/// <param name="intervalMinutes">Optional. The interval in minutes of the schedule.</param>
|
||||
/// <param name="hour">Optional. The hour of the schedule.</param>
|
||||
/// <param name="minute">Optional. The minute of the schedule.</param>
|
||||
/// <returns>The created request.</returns>
|
||||
public AddScheduledJobRequest Create(
|
||||
string? name = null,
|
||||
ScheduledTaskType? taskType = null,
|
||||
ScheduleType? scheduleType = null,
|
||||
int? intervalMinutes = null,
|
||||
int? hour = null,
|
||||
int? minute = null)
|
||||
{
|
||||
return new Faker<AddScheduledJobRequest>()
|
||||
.CustomInstantiator(f =>
|
||||
{
|
||||
ScheduleType resolvedScheduleType = scheduleType ?? f.PickRandom<ScheduleType>();
|
||||
if (resolvedScheduleType == ScheduleType.WithIntervalInMinutes)
|
||||
{
|
||||
return new AddScheduledJobRequest(
|
||||
name ?? f.Commerce.ProductName(),
|
||||
taskType ?? f.PickRandom<ScheduledTaskType>(),
|
||||
resolvedScheduleType,
|
||||
intervalMinutes ?? f.Random.Int(1, 1440),
|
||||
null,
|
||||
null);
|
||||
}
|
||||
return new AddScheduledJobRequest(
|
||||
name ?? f.Commerce.ProductName(),
|
||||
taskType ?? f.PickRandom<ScheduledTaskType>(),
|
||||
resolvedScheduleType,
|
||||
null,
|
||||
hour ?? f.Random.Int(0, 23),
|
||||
minute ?? f.Random.Int(0, 59));
|
||||
})
|
||||
.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="AddScheduledJobRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<AddScheduledJobRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Scheduling;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="FireScheduledJobRequest"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class FireScheduledJobRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid request to fire the task of a scheduled job once.
|
||||
/// </summary>
|
||||
/// <param name="scheduledJobId">Optional. The Id of the scheduled job whose task is fired.</param>
|
||||
/// <returns>The created request.</returns>
|
||||
public FireScheduledJobRequest Create(
|
||||
Guid? scheduledJobId = null)
|
||||
{
|
||||
return new Faker<FireScheduledJobRequest>()
|
||||
.CustomInstantiator(f => new FireScheduledJobRequest(scheduledJobId ?? Guid.NewGuid()))
|
||||
.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="FireScheduledJobRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<FireScheduledJobRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Scheduling;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetScheduledJobHistoryRequest"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetScheduledJobHistoryRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid request to get the history of the executions of the tasks of scheduled jobs.
|
||||
/// </summary>
|
||||
/// <param name="from">Optional. The inclusive lower bound of the requested interval.</param>
|
||||
/// <param name="to">Optional. The inclusive upper bound of the requested interval.</param>
|
||||
/// <returns>The created request.</returns>
|
||||
public GetScheduledJobHistoryRequest Create(
|
||||
DateTime? from = null,
|
||||
DateTime? to = null)
|
||||
{
|
||||
return new Faker<GetScheduledJobHistoryRequest>()
|
||||
.CustomInstantiator(f =>
|
||||
{
|
||||
DateTime resolvedFrom = from ?? f.Date.Recent(30);
|
||||
DateTime resolvedTo = to ?? f.Date.Soon(1, resolvedFrom);
|
||||
return new GetScheduledJobHistoryRequest(resolvedFrom, resolvedTo);
|
||||
})
|
||||
.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetScheduledJobHistoryRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetScheduledJobHistoryRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Scheduling;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="RemoveScheduledJobRequest"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RemoveScheduledJobRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid request to remove a scheduled job.
|
||||
/// </summary>
|
||||
/// <param name="scheduledJobId">Optional. The Id of the scheduled job to remove.</param>
|
||||
/// <returns>The created request.</returns>
|
||||
public RemoveScheduledJobRequest Create(
|
||||
Guid? scheduledJobId = null)
|
||||
{
|
||||
return new Faker<RemoveScheduledJobRequest>()
|
||||
.CustomInstantiator(f => new RemoveScheduledJobRequest(scheduledJobId ?? Guid.NewGuid()))
|
||||
.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="RemoveScheduledJobRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<RemoveScheduledJobRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Scheduling;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="StartScheduledJobRequest"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class StartScheduledJobRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid request to start the execution cycle of a scheduled job.
|
||||
/// </summary>
|
||||
/// <param name="scheduledJobId">Optional. The Id of the scheduled job whose execution cycle is started.</param>
|
||||
/// <returns>The created request.</returns>
|
||||
public StartScheduledJobRequest Create(
|
||||
Guid? scheduledJobId = null)
|
||||
{
|
||||
return new Faker<StartScheduledJobRequest>()
|
||||
.CustomInstantiator(f => new StartScheduledJobRequest(scheduledJobId ?? Guid.NewGuid()))
|
||||
.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="StartScheduledJobRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<StartScheduledJobRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Scheduling;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="StopScheduledJobRequest"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class StopScheduledJobRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid request to stop the execution cycle of a scheduled job.
|
||||
/// </summary>
|
||||
/// <param name="scheduledJobId">Optional. The Id of the scheduled job whose execution cycle is stopped.</param>
|
||||
/// <returns>The created request.</returns>
|
||||
public StopScheduledJobRequest Create(
|
||||
Guid? scheduledJobId = null)
|
||||
{
|
||||
return new Faker<StopScheduledJobRequest>()
|
||||
.CustomInstantiator(f => new StopScheduledJobRequest(scheduledJobId ?? Guid.NewGuid()))
|
||||
.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="StopScheduledJobRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<StopScheduledJobRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Scheduling;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Scheduling;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateSchedulerDisplayPreferencesRequest"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateSchedulerDisplayPreferencesRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid request to update the display preferences of the scheduler page of the current user.
|
||||
/// </summary>
|
||||
/// <param name="jobTypeFilter">Optional. The type of the scheduled job tasks whose executions are shown.</param>
|
||||
/// <param name="displayTimeSpan">Optional. The displayed time span.</param>
|
||||
/// <param name="displayTimeUnit">Optional. The unit of the displayed time span.</param>
|
||||
/// <returns>The created request.</returns>
|
||||
public UpdateSchedulerDisplayPreferencesRequest Create(
|
||||
ScheduledTaskType? jobTypeFilter = null,
|
||||
int? displayTimeSpan = null,
|
||||
SchedulerDisplayTimeUnit? displayTimeUnit = null)
|
||||
{
|
||||
return new Faker<UpdateSchedulerDisplayPreferencesRequest>()
|
||||
.CustomInstantiator(f => new UpdateSchedulerDisplayPreferencesRequest(
|
||||
jobTypeFilter ?? (f.Random.Bool() ? f.PickRandom<ScheduledTaskType>() : null),
|
||||
displayTimeSpan ?? f.Random.Int(1, 24 * 60),
|
||||
displayTimeUnit ?? f.PickRandom<SchedulerDisplayTimeUnit>()))
|
||||
.Generate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateSchedulerDisplayPreferencesRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdateSchedulerDisplayPreferencesRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Themes;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Themes;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="DeleteThemeRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class DeleteThemeRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="DeleteThemeRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="themeId">Optional. The manifest id of the theme to delete.</param>
|
||||
/// <param name="includeThemeId">Whether the theme Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="DeleteThemeRequest"/>.</returns>
|
||||
public DeleteThemeRequest Create(string? themeId = null, bool includeThemeId = true)
|
||||
{
|
||||
return new DeleteThemeRequest(includeThemeId ? (themeId ?? _faker.Lorem.Slug(2)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="DeleteThemeRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<DeleteThemeRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Themes;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Themes;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetThemeArchiveRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetThemeArchiveRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetThemeArchiveRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="themeId">Optional. The manifest id of the theme.</param>
|
||||
/// <param name="includeThemeId">Whether the theme Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetThemeArchiveRequest"/>.</returns>
|
||||
public GetThemeArchiveRequest Create(string? themeId = null, bool includeThemeId = true)
|
||||
{
|
||||
return new GetThemeArchiveRequest(includeThemeId ? (themeId ?? _faker.Lorem.Slug(2)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetThemeArchiveRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetThemeArchiveRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Themes;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Themes;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetThemeAssetRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetThemeAssetRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetThemeAssetRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="themeId">Optional. The manifest id of the theme.</param>
|
||||
/// <param name="assetPath">Optional. The asset path relative to the theme pack root.</param>
|
||||
/// <param name="includeThemeId">Whether the theme Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAssetPath">Whether the asset path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetThemeAssetRequest"/>.</returns>
|
||||
public GetThemeAssetRequest Create(
|
||||
string? themeId = null,
|
||||
string? assetPath = null,
|
||||
bool includeThemeId = true,
|
||||
bool includeAssetPath = true)
|
||||
{
|
||||
return new GetThemeAssetRequest(
|
||||
includeThemeId ? (themeId ?? _faker.Lorem.Slug(2)) : null,
|
||||
includeAssetPath ? (assetPath ?? _faker.System.FilePath()) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetThemeAssetRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetThemeAssetRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Themes;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Themes;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetThemeTemplateRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetThemeTemplateRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetThemeTemplateRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="themeId">Optional. The manifest id of the theme.</param>
|
||||
/// <param name="pageKey">Optional. The page key that selects the template.</param>
|
||||
/// <param name="includeThemeId">Whether the theme Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePageKey">Whether the page key should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetThemeTemplateRequest"/>.</returns>
|
||||
public GetThemeTemplateRequest Create(
|
||||
string? themeId = null,
|
||||
string? pageKey = null,
|
||||
bool includeThemeId = true,
|
||||
bool includePageKey = true)
|
||||
{
|
||||
return new GetThemeTemplateRequest(
|
||||
includeThemeId ? (themeId ?? _faker.Lorem.Slug(2)) : null,
|
||||
includePageKey ? (pageKey ?? _faker.Lorem.Word()) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetThemeTemplateRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetThemeTemplateRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Themes;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Themes;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="RestoreThemeRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RestoreThemeRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="RestoreThemeRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="themeId">Optional. The manifest id of the theme to restore.</param>
|
||||
/// <returns>The created <see cref="RestoreThemeRequest"/>.</returns>
|
||||
public RestoreThemeRequest Create(string? themeId = null)
|
||||
{
|
||||
return new RestoreThemeRequest(themeId ?? _faker.Lorem.Slug(2));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="RestoreThemeRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<RestoreThemeRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.Themes;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.Themes;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="SetCurrentThemeRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class SetCurrentThemeRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="SetCurrentThemeRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="themeId">Optional. The manifest id of the theme to activate.</param>
|
||||
/// <param name="includeThemeId">Whether the theme Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="SetCurrentThemeRequest"/>.</returns>
|
||||
public SetCurrentThemeRequest Create(string? themeId = null, bool includeThemeId = true)
|
||||
{
|
||||
return new SetCurrentThemeRequest(includeThemeId ? (themeId ?? _faker.Lorem.Slug(2)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="SetCurrentThemeRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<SetCurrentThemeRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.UsersManagement.Settings;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.UsersManagement.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdatePlaybackStateRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdatePlaybackStateRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="UpdatePlaybackStateRequest"/>.
|
||||
/// </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="UpdatePlaybackStateRequest"/>.</returns>
|
||||
public UpdatePlaybackStateRequest Create(
|
||||
double? volume = null,
|
||||
bool? isMuted = null,
|
||||
bool includeVolume = true,
|
||||
bool includeIsMuted = true)
|
||||
{
|
||||
return new UpdatePlaybackStateRequest(
|
||||
includeVolume ? volume ?? _faker.Random.Double(0, 1) : null,
|
||||
includeIsMuted ? isMuted ?? _faker.Random.Bool() : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdatePlaybackStateRequest"/> instances.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdatePlaybackStateRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.UsersManagement.Settings;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Playback;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Requests.UsersManagement.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateUserSettingsRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateUserSettingsRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="UpdateUserSettingsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="isPaginationEnabled">Whether pagination is enabled for the user.</param>
|
||||
/// <param name="itemsPerPage">The number of library items displayed per page when pagination is enabled.</param>
|
||||
/// <param name="shouldIgnoreThePrefixForAlphaPicker">Whether the "The" prefix is ignored by the alpha picker.</param>
|
||||
/// <param name="isThemeCachingEnabled">Whether the theme data served to this user is cached.</param>
|
||||
/// <param name="shouldAggregateMetadataWhenMissing">Whether the metadata of the media library items is aggregated from multiple providers, when fields are missing.</param>
|
||||
/// <param name="shouldAggregateArtworkWhenMissing">Whether the artwork of the media library items is aggregated from multiple providers, when it is missing.</param>
|
||||
/// <param name="shouldRenderPdfAsImages">Whether PDF books are rendered as page images for the user.</param>
|
||||
/// <param name="shouldPreserveBookStyles">Whether the styles of the book content are preserved when it is rendered for the user.</param>
|
||||
/// <param name="shouldKeepDownloadingWhilePaused">Whether the player keeps downloading a track while playback is paused.</param>
|
||||
/// <param name="shouldAutoplay">Whether the player continues playback at the end of an album or artist.</param>
|
||||
/// <param name="isGaplessPlaybackEnabled">Whether the player transitions between consecutive tracks without a gap.</param>
|
||||
/// <param name="replayGainMode">The way ReplayGain normalization is applied to the tracks the user plays.</param>
|
||||
/// <param name="streamingQuality">The quality cap applied to the audio the server normalizes for the user.</param>
|
||||
/// <param name="vuMeterOrientation">The direction in which each channel of the VU meter of the audio player grows.</param>
|
||||
/// <param name="vuMeterSegmentCount">The number of segments each channel of the VU meter is divided into.</param>
|
||||
/// <param name="vuMeterSegmentGap">The gap, in pixels, between the segments and the channels of the VU meter.</param>
|
||||
/// <param name="vuMeterMediumThreshold">The level above which a segment of the VU meter is drawn with its medium state.</param>
|
||||
/// <param name="vuMeterHighThreshold">The level above which a segment of the VU meter is drawn with its high state.</param>
|
||||
/// <param name="vuMeterShowPeak">Whether the VU meter holds the peak level of each channel after it falls.</param>
|
||||
/// <param name="vuMeterPeakHoldDurationInMilliseconds">The time a peak of the VU meter is held before it starts falling.</param>
|
||||
/// <param name="vuMeterReleasePerSecond">The number of level units the display of the VU meter falls per second when the input level drops.</param>
|
||||
/// <param name="vuMeterPeakReleasePerSecond">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 <see cref="UpdateUserSettingsRequest"/>.</returns>
|
||||
public UpdateUserSettingsRequest 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 request always describes a valid meter.
|
||||
double? mediumThreshold = includeVuMeterMediumThreshold
|
||||
? vuMeterMediumThreshold ?? _faker.Random.Double(0, 1)
|
||||
: null;
|
||||
double? highThreshold = includeVuMeterHighThreshold
|
||||
? vuMeterHighThreshold ?? (mediumThreshold is null ? _faker.Random.Double(0, 1) : _faker.Random.Double(mediumThreshold.Value, 1))
|
||||
: null;
|
||||
return new UpdateUserSettingsRequest(
|
||||
isPaginationEnabled ?? _faker.Random.Bool(),
|
||||
itemsPerPage ?? _faker.Random.Int(1, 100),
|
||||
shouldIgnoreThePrefixForAlphaPicker ?? _faker.Random.Bool(),
|
||||
isThemeCachingEnabled ?? _faker.Random.Bool(),
|
||||
shouldAggregateMetadataWhenMissing ?? _faker.Random.Bool(),
|
||||
shouldAggregateArtworkWhenMissing ?? _faker.Random.Bool(),
|
||||
shouldRenderPdfAsImages ?? _faker.Random.Bool(),
|
||||
shouldPreserveBookStyles ?? _faker.Random.Bool(),
|
||||
shouldKeepDownloadingWhilePaused ?? _faker.Random.Bool(),
|
||||
shouldAutoplay ?? _faker.Random.Bool(),
|
||||
isGaplessPlaybackEnabled ?? _faker.Random.Bool(),
|
||||
replayGainMode ?? _faker.PickRandom<ReplayGainMode>(),
|
||||
streamingQuality ?? _faker.PickRandom<PlaybackStreamingQuality>(),
|
||||
includeVuMeterOrientation ? vuMeterOrientation ?? _faker.PickRandom<VuMeterOrientation>() : null,
|
||||
includeVuMeterSegmentCount ? vuMeterSegmentCount ?? _faker.Random.Int(1, 128) : null,
|
||||
includeVuMeterSegmentGap ? vuMeterSegmentGap ?? _faker.Random.Int(0, 32) : null,
|
||||
mediumThreshold,
|
||||
highThreshold,
|
||||
includeVuMeterShowPeak ? vuMeterShowPeak ?? _faker.Random.Bool() : null,
|
||||
includeVuMeterPeakHoldDurationInMilliseconds ? vuMeterPeakHoldDurationInMilliseconds ?? _faker.Random.Int(0, 10000) : null,
|
||||
includeVuMeterReleasePerSecond ? vuMeterReleasePerSecond ?? _faker.Random.Double(0, 100) : null,
|
||||
includeVuMeterPeakReleasePerSecond ? vuMeterPeakReleasePerSecond ?? _faker.Random.Double(0, 100) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateUserSettingsRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdateUserSettingsRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user