mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
Adds a restore action for soft deleted bundled themes
This commit is contained in:
1 parent
15945c2e56
commit
7e54c990ad
49 files changed
+1666
-26
No files matched your search
+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())];
|
||||
}
|
||||
}
|
||||
+5
-2
@@ -33,6 +33,7 @@ public class ThemeResponseFixture
|
||||
/// <param name="isCurrent">Optional. Whether the theme is the currently active one.</param>
|
||||
/// <param name="includeIsCurrent">Whether to set <paramref name="isCurrent"/>, or <see langword="null"/> when <see langword="false"/>.</param>
|
||||
/// <param name="installedAtUtc">Optional. The UTC timestamp when the theme was installed.</param>
|
||||
/// <param name="isDeleted">Optional. Whether the theme was deleted by the user.</param>
|
||||
/// <returns>The created <see cref="ThemeResponse"/>.</returns>
|
||||
public ThemeResponse Create(
|
||||
Guid? id = null,
|
||||
@@ -46,7 +47,8 @@ public class ThemeResponseFixture
|
||||
ThemeInstallSource? installSource = null,
|
||||
bool? isCurrent = null,
|
||||
bool includeIsCurrent = false,
|
||||
DateTime? installedAtUtc = null)
|
||||
DateTime? installedAtUtc = null,
|
||||
bool? isDeleted = null)
|
||||
{
|
||||
return new ThemeResponse(
|
||||
id ?? Guid.NewGuid(),
|
||||
@@ -58,7 +60,8 @@ public class ThemeResponseFixture
|
||||
includePreviewPath ? (previewPath ?? (_faker.Random.Bool() ? _faker.System.FilePath() : null)) : null,
|
||||
installSource ?? _faker.PickRandom<ThemeInstallSource>(),
|
||||
includeIsCurrent ? (isCurrent ?? (_faker.Random.Bool() ? true : null)) : null,
|
||||
installedAtUtc ?? _faker.Date.Recent().ToUniversalTime());
|
||||
installedAtUtc ?? _faker.Date.Recent().ToUniversalTime(),
|
||||
isDeleted ?? _faker.Random.Bool());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user