Centralizes and standardizes test fixtures.

This commit is contained in:
BinaryAlley committed 2026-08-15 02:58:17 -07:00
1 parent dfc513da4f
commit b648e2f054
294 files changed
+3807 -4437

No files matched your search

@@ -0,0 +1,42 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.CombinePath;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.FileSystemManagement.Paths.Commands.CombinePath;
/// <summary>
/// Fixture class for the <see cref="CombinePathCommand"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class CombinePathCommandFixture
{
/// <summary>
/// Creates a random valid command to combine paths.
/// </summary>
/// <param name="originalPath">Optional. The original path.</param>
/// <param name="newPath">Optional. The new path to combine.</param>
/// <returns>The created command.</returns>
public CombinePathCommand Create(string? originalPath = null, string? newPath = null)
{
return new Faker<CombinePathCommand>()
.CustomInstantiator(f => new CombinePathCommand(
default!,
default!))
.RuleFor(x => x.OriginalPath, f => originalPath ?? f.System.FilePath())
.RuleFor(x => x.NewPath, f => newPath ?? f.System.FilePath());
}
/// <summary>
/// Creates a list of <see cref="CombinePathCommand"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<CombinePathCommand> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,39 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.SplitPath;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.FileSystemManagement.Paths.Commands.SplitPath;
/// <summary>
/// Fixture class for the <see cref="SplitPathCommand"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class SplitPathCommandFixture
{
/// <summary>
/// Creates a random valid command for splitting paths.
/// </summary>
/// <param name="path">Optional. The file system path.</param>
/// <returns>The created command.</returns>
public SplitPathCommand Create(string? path = null)
{
return new Faker<SplitPathCommand>()
.CustomInstantiator(f => new SplitPathCommand(
default!))
.RuleFor(x => x.Path, f => path ?? f.System.FilePath());
}
/// <summary>
/// Creates a list of <see cref="SplitPathCommand"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<SplitPathCommand> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,43 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathExists;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.FileSystemManagement.Paths.Queries.CheckPathExists;
/// <summary>
/// Fixture class for the <see cref="CheckPathExistsQuery"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class CheckPathExistsQueryFixture
{
/// <summary>
/// Creates a random valid query to check if paths exist.
/// </summary>
/// <param name="path">Optional. The file system path.</param>
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
/// <returns>The created query.</returns>
public CheckPathExistsQuery Create(string? path = null, bool includeHiddenElements = true)
{
return new Faker<CheckPathExistsQuery>()
.CustomInstantiator(f => new CheckPathExistsQuery(
default!,
default
))
.RuleFor(x => x.Path, f => path ?? f.System.FilePath())
.RuleFor(x => x.IncludeHiddenElements, includeHiddenElements);
}
/// <summary>
/// Creates a list of <see cref="CheckPathExistsQuery"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<CheckPathExistsQuery> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,39 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathParent;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.FileSystemManagement.Paths.Queries.GetPathParent;
/// <summary>
/// Fixture class for the <see cref="GetPathParentQuery"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetPathParentQueryFixture
{
/// <summary>
/// Creates a random valid query to get the parent of a path.
/// </summary>
/// <param name="path">Optional. The file system path.</param>
/// <returns>The created query.</returns>
public GetPathParentQuery Create(string? path = null)
{
return new Faker<GetPathParentQuery>()
.CustomInstantiator(f => new GetPathParentQuery(
default!))
.RuleFor(x => x.Path, f => path ?? f.System.FilePath());
}
/// <summary>
/// Creates a list of <see cref="GetPathParentQuery"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetPathParentQuery> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,39 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathRoot;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.FileSystemManagement.Paths.Queries.GetPathRoot;
/// <summary>
/// Fixture class for the <see cref="GetPathRootQuery"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetPathRootQueryFixture
{
/// <summary>
/// Creates a random valid query to get the root of a path.
/// </summary>
/// <param name="path">Optional. The file system path.</param>
/// <returns>The created query.</returns>
public GetPathRootQuery Create(string? path = null)
{
return new Faker<GetPathRootQuery>()
.CustomInstantiator(f => new GetPathRootQuery(
default!))
.RuleFor(x => x.Path, f => path ?? f.System.FilePath());
}
/// <summary>
/// Creates a list of <see cref="GetPathRootQuery"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<GetPathRootQuery> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,39 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.ValidatePath;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.FileSystemManagement.Paths.Queries.ValidatePath;
/// <summary>
/// Fixture class for the <see cref="ValidatePathQuery"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class ValidatePathQueryFixture
{
/// <summary>
/// Creates a random valid query to validate a path.
/// </summary>
/// <param name="path">Optional. The file system path.</param>
/// <returns>The created query.</returns>
public ValidatePathQuery Create(string? path = null)
{
return new Faker<ValidatePathQuery>()
.CustomInstantiator(f => new ValidatePathQuery(
default!))
.RuleFor(x => x.Path, f => path ?? f.System.FilePath());
}
/// <summary>
/// Creates a list of <see cref="ValidatePathQuery"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<ValidatePathQuery> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}