mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
Persists and surfaces plugin load failures
This commit is contained in:
1 parent
18361d5da7
commit
b32cc764a7
11 files changed
+279
-13
No files matched your search
+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