mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 13: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
+42
@@ -0,0 +1,42 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Infrastructure.Common.Models.DTO.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Infrastructure.Fixtures.Common.Models.DTO.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="CorsSettingsDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class CorsSettingsDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a valid <see cref="CorsSettingsDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="allowedOrigins">Optional. The allowed origins, or <see langword="null"/> to generate valid origins.</param>
|
||||
/// <returns>The created <see cref="CorsSettingsDto"/>.</returns>
|
||||
public CorsSettingsDto Create(string[]? allowedOrigins = null)
|
||||
{
|
||||
return new CorsSettingsDto
|
||||
{
|
||||
AllowedOrigins = allowedOrigins ?? [$"https://{_faker.Internet.DomainName()}", $"http://{_faker.Internet.DomainName()}"]
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="CorsSettingsDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="CorsSettingsDto"/> instances.</returns>
|
||||
public List<CorsSettingsDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Infrastructure.Common.Models.DTO.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Infrastructure.Fixtures.Common.Models.DTO.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="EncryptionSettingsDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class EncryptionSettingsDtoFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a valid <see cref="EncryptionSettingsDto"/> with a random 256-bit key.
|
||||
/// </summary>
|
||||
/// <param name="secretKey">Optional. The secret key. If not provided, a valid 256-bit (32 byte) key for AES-256 is generated.</param>
|
||||
/// <returns>The created <see cref="EncryptionSettingsDto"/>.</returns>
|
||||
public EncryptionSettingsDto Create(string? secretKey = null)
|
||||
{
|
||||
byte[] key = new byte[32];
|
||||
RandomNumberGenerator.Fill(key);
|
||||
|
||||
return new EncryptionSettingsDto
|
||||
{
|
||||
SecretKey = secretKey ?? Convert.ToBase64String(key)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="EncryptionSettingsDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="EncryptionSettingsDto"/> instances.</returns>
|
||||
public List<EncryptionSettingsDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Infrastructure.Common.Models.DTO.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Infrastructure.Fixtures.Common.Models.DTO.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="JwtSettingsDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class JwtSettingsDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a valid <see cref="JwtSettingsDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="secretKey">Optional. The secret key used to sign the JWT.</param>
|
||||
/// <param name="expiryMinutes">Optional. The duration (in minutes) for which the JWT is valid.</param>
|
||||
/// <param name="issuer">Optional. The issuer of the JWT.</param>
|
||||
/// <param name="audience">Optional. The intended audience for the JWT.</param>
|
||||
/// <returns>The created <see cref="JwtSettingsDto"/>.</returns>
|
||||
public JwtSettingsDto Create(
|
||||
string? secretKey = null,
|
||||
int? expiryMinutes = null,
|
||||
string? issuer = null,
|
||||
string? audience = null)
|
||||
{
|
||||
byte[] key = new byte[32];
|
||||
RandomNumberGenerator.Fill(key);
|
||||
|
||||
return new JwtSettingsDto
|
||||
{
|
||||
SecretKey = secretKey ?? Convert.ToBase64String(key),
|
||||
ExpiryMinutes = expiryMinutes ?? _faker.Random.Int(1, 120),
|
||||
Issuer = issuer ?? _faker.Company.CompanyName(),
|
||||
Audience = audience ?? _faker.Company.CompanyName()
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="JwtSettingsDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="JwtSettingsDto"/> instances.</returns>
|
||||
public List<JwtSettingsDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.Infrastructure.Models.DTO.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Infrastructure.Fixtures.Common.Models.DTO.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="PluginsSettingsDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PluginsSettingsDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a valid <see cref="PluginsSettingsDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="directory">Optional. The directory where the plugin assemblies are located.</param>
|
||||
/// <returns>The created <see cref="PluginsSettingsDto"/>.</returns>
|
||||
public PluginsSettingsDto Create(string? directory = null)
|
||||
{
|
||||
return new PluginsSettingsDto
|
||||
{
|
||||
Directory = directory ?? _faker.System.DirectoryPath()
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="PluginsSettingsDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="PluginsSettingsDto"/> instances.</returns>
|
||||
public List<PluginsSettingsDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Infrastructure.Common.Models.DTO.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Infrastructure.Fixtures.Common.Models.DTO.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ThemeEngineOptionsDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ThemeEngineOptionsDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="ThemeEngineOptionsDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="storagePath">Optional directory where installed theme packs are stored.</param>
|
||||
/// <param name="bundledThemesPath">Optional directory where the shipped theme pack archives are located.</param>
|
||||
/// <param name="defaultThemeId">Optional identifier of the default theme.</param>
|
||||
/// <param name="maxArchiveBytes">Optional maximum size of an uploaded theme archive, in bytes.</param>
|
||||
/// <param name="maxExpandedBytes">Optional maximum total size of an extracted theme pack, in bytes.</param>
|
||||
/// <param name="maxSingleFileBytes">Optional maximum size of a single file within a theme pack, in bytes.</param>
|
||||
/// <param name="maxEntries">Optional maximum number of entries in a theme pack archive.</param>
|
||||
/// <returns>A configured <see cref="ThemeEngineOptionsDto"/> instance.</returns>
|
||||
public ThemeEngineOptionsDto Create(
|
||||
string? storagePath = null,
|
||||
string? bundledThemesPath = null,
|
||||
string? defaultThemeId = null,
|
||||
long? maxArchiveBytes = null,
|
||||
long? maxExpandedBytes = null,
|
||||
long? maxSingleFileBytes = null,
|
||||
int? maxEntries = null)
|
||||
{
|
||||
return new ThemeEngineOptionsDto
|
||||
{
|
||||
StoragePath = storagePath ?? _faker.System.DirectoryPath(),
|
||||
BundledThemesPath = bundledThemesPath ?? _faker.System.DirectoryPath(),
|
||||
DefaultThemeId = defaultThemeId ?? _faker.Lorem.Word(),
|
||||
MaxArchiveBytes = maxArchiveBytes ?? _faker.Random.Long(1_000_000, 100_000_000),
|
||||
MaxExpandedBytes = maxExpandedBytes ?? _faker.Random.Long(10_000_000, 500_000_000),
|
||||
MaxSingleFileBytes = maxSingleFileBytes ?? _faker.Random.Long(1_000_000, 50_000_000),
|
||||
MaxEntries = maxEntries ?? _faker.Random.Int(1, 1000)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="ThemeEngineOptionsDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="ThemeEngineOptionsDto"/> instances.</returns>
|
||||
public List<ThemeEngineOptionsDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Infrastructure.Common.Models.DTO.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Infrastructure.Fixtures.Common.Models.DTO.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="TranscodingSettingsDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class TranscodingSettingsDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="TranscodingSettingsDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="ffmpegPath">Optional file name or path of the ffmpeg binary.</param>
|
||||
/// <param name="maxConcurrentJobs">Optional maximum number of normalization jobs that may run at the same time.</param>
|
||||
/// <param name="maxConcurrentJobsPerUser">Optional maximum number of normalization jobs a single user may have running at the same time.</param>
|
||||
/// <param name="maxCacheBytes">Optional maximum total size of the normalized audio cache, in bytes.</param>
|
||||
/// <param name="jobTimeoutSeconds">Optional maximum duration of a single normalization job, in seconds.</param>
|
||||
/// <param name="evictionGraceSeconds">Optional period during which a cache entry is protected from eviction, in seconds.</param>
|
||||
/// <param name="cacheDirectory">
|
||||
/// Optional directory where normalized audio is cached. When it is not supplied, a generated directory is used. When
|
||||
/// <paramref name="includeCacheDirectory"/> is <see langword="false"/>, the property stays <see langword="null"/>, which makes the pipeline use the
|
||||
/// default temporary directory.
|
||||
/// </param>
|
||||
/// <param name="includeCacheDirectory">Whether to generate the optional cache directory, defaulting to <see langword="true"/>.</param>
|
||||
/// <param name="includeFfmpegPath">Whether the ffmpeg path should be included, or forced to <see langword="null"/>, defaulting to <see langword="true"/>.</param>
|
||||
/// <returns>A configured <see cref="TranscodingSettingsDto"/> instance.</returns>
|
||||
public TranscodingSettingsDto Create(
|
||||
string? ffmpegPath = null,
|
||||
int? maxConcurrentJobs = null,
|
||||
int? maxConcurrentJobsPerUser = null,
|
||||
long? maxCacheBytes = null,
|
||||
int? jobTimeoutSeconds = null,
|
||||
int? evictionGraceSeconds = null,
|
||||
string? cacheDirectory = null,
|
||||
bool includeCacheDirectory = true,
|
||||
bool includeFfmpegPath = true)
|
||||
{
|
||||
int resolvedMaxConcurrentJobs = maxConcurrentJobs ?? _faker.Random.Int(1, 16);
|
||||
return new TranscodingSettingsDto
|
||||
{
|
||||
FfmpegPath = includeFfmpegPath ? (ffmpegPath ?? _faker.System.FileName("exe")) : null!,
|
||||
MaxConcurrentJobs = resolvedMaxConcurrentJobs,
|
||||
// A per-user limit above the global one is rejected by the validator, so the generated value never exceeds the global limit.
|
||||
MaxConcurrentJobsPerUser = maxConcurrentJobsPerUser ?? _faker.Random.Int(1, Math.Max(1, resolvedMaxConcurrentJobs)),
|
||||
MaxCacheBytes = maxCacheBytes ?? _faker.Random.Long(1_000_000_000, 8_589_934_592),
|
||||
JobTimeoutSeconds = jobTimeoutSeconds ?? _faker.Random.Int(60, 3600),
|
||||
EvictionGraceSeconds = evictionGraceSeconds ?? _faker.Random.Int(1, 600),
|
||||
CacheDirectory = includeCacheDirectory ? cacheDirectory ?? _faker.System.DirectoryPath() : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="TranscodingSettingsDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="TranscodingSettingsDto"/> instances.</returns>
|
||||
public List<TranscodingSettingsDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Playback;
|
||||
using Lumina.Infrastructure.Common.Models.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Infrastructure.Fixtures.Common.Models.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="NormalizedTrackIndexDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal class NormalizedTrackIndexDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly NormalizedTrackSegmentIndexDtoFixture _normalizedTrackSegmentIndexDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="NormalizedTrackIndexDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="version">Optional version of the index layout.</param>
|
||||
/// <param name="trackId">Optional Id of the track the cached audio belongs to.</param>
|
||||
/// <param name="mode">Optional way the audio is delivered.</param>
|
||||
/// <param name="container">Optional container of the delivered audio.</param>
|
||||
/// <param name="codec">Optional codec of the delivered audio.</param>
|
||||
/// <param name="segmentDurationSeconds">Optional duration of each segment, in seconds.</param>
|
||||
/// <param name="durationInSeconds">Optional duration of the produced and cached audio, in seconds.</param>
|
||||
/// <param name="segments">
|
||||
/// Optional segments that make up the delivered audio, in playback order. A caller can supply an explicit list, including an empty one; when it is not
|
||||
/// supplied a random bounded list is generated.
|
||||
/// </param>
|
||||
/// <returns>The created <see cref="NormalizedTrackIndexDto"/>.</returns>
|
||||
public NormalizedTrackIndexDto Create(
|
||||
int? version = null,
|
||||
Guid? trackId = null,
|
||||
PlaybackDeliveryMode? mode = null,
|
||||
string? container = null,
|
||||
string? codec = null,
|
||||
int? segmentDurationSeconds = null,
|
||||
int? durationInSeconds = null,
|
||||
IReadOnlyList<NormalizedTrackSegmentIndexDto>? segments = null)
|
||||
{
|
||||
return new NormalizedTrackIndexDto(
|
||||
version ?? _faker.Random.Int(1, 10),
|
||||
trackId ?? _faker.Random.Guid(),
|
||||
mode ?? _faker.PickRandom(PlaybackDeliveryMode.DirectPlay, PlaybackDeliveryMode.Remux, PlaybackDeliveryMode.Transcode),
|
||||
container ?? _faker.PickRandom("MP4", "OGG", "WAV", "FLAC"),
|
||||
codec ?? _faker.PickRandom("AAC", "VORBIS", "PCM", "FLAC"),
|
||||
segmentDurationSeconds ?? _faker.Random.Int(1, 60),
|
||||
durationInSeconds ?? _faker.Random.Int(1, 100_000),
|
||||
segments ?? [.. _normalizedTrackSegmentIndexDtoFixture.CreateMany(_faker.Random.Int(1, 5))]
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="NormalizedTrackIndexDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="NormalizedTrackIndexDto"/> instances.</returns>
|
||||
public List<NormalizedTrackIndexDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Infrastructure.Common.Models.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Infrastructure.Fixtures.Common.Models.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="NormalizedTrackSegmentIndexDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal class NormalizedTrackSegmentIndexDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="NormalizedTrackSegmentIndexDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="index">Optional zero based position of the segment in the delivered audio.</param>
|
||||
/// <param name="startSeconds">Optional time, in seconds from the start of the track, at which the segment starts.</param>
|
||||
/// <param name="durationSeconds">Optional duration of the segment, in seconds.</param>
|
||||
/// <param name="fileName">Optional file name of the segment inside the cache entry.</param>
|
||||
/// <param name="length">Optional length of the segment, in bytes.</param>
|
||||
/// <returns>The created <see cref="NormalizedTrackSegmentIndexDto"/>.</returns>
|
||||
public NormalizedTrackSegmentIndexDto Create(
|
||||
int? index = null,
|
||||
decimal? startSeconds = null,
|
||||
decimal? durationSeconds = null,
|
||||
string? fileName = null,
|
||||
long? length = null)
|
||||
{
|
||||
return new NormalizedTrackSegmentIndexDto(
|
||||
index ?? _faker.Random.Int(0, 10_000),
|
||||
startSeconds ?? _faker.Random.Decimal(0m, 100_000m),
|
||||
durationSeconds ?? _faker.Random.Decimal(1m, 600m),
|
||||
fileName ?? $"segment{_faker.Random.Int(0, 10_000):D6}{_faker.PickRandom(".m4s", ".mp4", ".ts")}",
|
||||
length ?? _faker.Random.Long(1, 100_000_000)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="NormalizedTrackSegmentIndexDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="NormalizedTrackSegmentIndexDto"/> instances.</returns>
|
||||
public List<NormalizedTrackSegmentIndexDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(segmentIndex => Create(index: segmentIndex))];
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Infrastructure.Common.Models.DTO.Plugins;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Infrastructure.Fixtures.Common.Models.DTO.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="PluginLoadErrorDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal class PluginLoadErrorDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a valid <see cref="PluginLoadErrorDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="assemblyName">Optional. The file name of the plugin assembly that failed to load, without its extension.</param>
|
||||
/// <param name="errorMessage">Optional. The error message describing the load failure.</param>
|
||||
/// <returns>The created <see cref="PluginLoadErrorDto"/>.</returns>
|
||||
public PluginLoadErrorDto Create(string? assemblyName = null, string? errorMessage = null)
|
||||
{
|
||||
return new PluginLoadErrorDto(
|
||||
assemblyName ?? _faker.Hacker.Noun(),
|
||||
errorMessage ?? $"Failed to load plugin assembly '{_faker.Hacker.Noun()}.dll': {_faker.Lorem.Sentence()}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="PluginLoadErrorDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="PluginLoadErrorDto"/> instances.</returns>
|
||||
public List<PluginLoadErrorDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user