mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
Refactors the test fixtures and their consumers to compose other fixtures instead of instantiating models inline
This commit is contained in:
1 parent
0abda472c6
commit
3aadd6de84
157 files changed
+1312
-597
No files matched your search
+3
-2
@@ -20,10 +20,11 @@ public class DeleteThemeRequestFixture
|
||||
/// 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)
|
||||
public DeleteThemeRequest Create(string? themeId = null, bool includeThemeId = true)
|
||||
{
|
||||
return new DeleteThemeRequest(themeId ?? _faker.Lorem.Slug(2));
|
||||
return new DeleteThemeRequest(includeThemeId ? (themeId ?? _faker.Lorem.Slug(2)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+3
-2
@@ -20,10 +20,11 @@ public class GetThemeArchiveRequestFixture
|
||||
/// 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)
|
||||
public GetThemeArchiveRequest Create(string? themeId = null, bool includeThemeId = true)
|
||||
{
|
||||
return new GetThemeArchiveRequest(themeId ?? _faker.Lorem.Slug(2));
|
||||
return new GetThemeArchiveRequest(includeThemeId ? (themeId ?? _faker.Lorem.Slug(2)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+10
-3
@@ -21,12 +21,19 @@ public class GetThemeAssetRequestFixture
|
||||
/// </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)
|
||||
public GetThemeAssetRequest Create(
|
||||
string? themeId = null,
|
||||
string? assetPath = null,
|
||||
bool includeThemeId = true,
|
||||
bool includeAssetPath = true)
|
||||
{
|
||||
return new GetThemeAssetRequest(
|
||||
themeId ?? _faker.Lorem.Slug(2),
|
||||
assetPath ?? _faker.System.FilePath());
|
||||
includeThemeId ? (themeId ?? _faker.Lorem.Slug(2)) : null,
|
||||
includeAssetPath ? (assetPath ?? _faker.System.FilePath()) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+10
-3
@@ -21,12 +21,19 @@ public class GetThemeTemplateRequestFixture
|
||||
/// </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)
|
||||
public GetThemeTemplateRequest Create(
|
||||
string? themeId = null,
|
||||
string? pageKey = null,
|
||||
bool includeThemeId = true,
|
||||
bool includePageKey = true)
|
||||
{
|
||||
return new GetThemeTemplateRequest(
|
||||
themeId ?? _faker.Lorem.Slug(2),
|
||||
pageKey ?? _faker.Lorem.Word());
|
||||
includeThemeId ? (themeId ?? _faker.Lorem.Slug(2)) : null,
|
||||
includePageKey ? (pageKey ?? _faker.Lorem.Word()) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+3
-2
@@ -20,10 +20,11 @@ public class SetCurrentThemeRequestFixture
|
||||
/// 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)
|
||||
public SetCurrentThemeRequest Create(string? themeId = null, bool includeThemeId = true)
|
||||
{
|
||||
return new SetCurrentThemeRequest(themeId ?? _faker.Lorem.Slug(2));
|
||||
return new SetCurrentThemeRequest(includeThemeId ? (themeId ?? _faker.Lorem.Slug(2)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user