Refactors the test fixtures and their consumers to compose other fixtures instead of instantiating models inline

This commit is contained in:
BinaryAlley committed 2026-10-02 14:37:23 +03:00
1 parent 0abda472c6
commit 3aadd6de84
157 files changed
+1312 -597

No files matched your search

@@ -19,15 +19,16 @@ public class CheckPathExistsQueryFixture
/// </summary>
/// <param name="path">Optional. The file system path.</param>
/// <param name="shouldIncludeHiddenElements">Whether to include hidden file system elements or not.</param>
/// <param name="includePath">Whether the path should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created query.</returns>
public CheckPathExistsQuery Create(string? path = null, bool shouldIncludeHiddenElements = true)
public CheckPathExistsQuery Create(string? path = null, bool shouldIncludeHiddenElements = true, bool includePath = true)
{
return new Faker<CheckPathExistsQuery>()
.CustomInstantiator(f => new CheckPathExistsQuery(
default!,
default
))
.RuleFor(x => x.Path, f => path ?? f.System.FilePath())
.RuleFor(x => x.Path, f => includePath ? (path ?? f.System.FilePath()) : null)
.RuleFor(x => x.ShouldIncludeHiddenElements, shouldIncludeHiddenElements);
}
@@ -18,13 +18,14 @@ public class ValidatePathQueryFixture
/// Creates a random valid query to validate a path.
/// </summary>
/// <param name="path">Optional. The file system path.</param>
/// <param name="includePath">Whether the path should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created query.</returns>
public ValidatePathQuery Create(string? path = null)
public ValidatePathQuery Create(string? path = null, bool includePath = true)
{
return new Faker<ValidatePathQuery>()
.CustomInstantiator(f => new ValidatePathQuery(
default!))
.RuleFor(x => x.Path, f => path ?? f.System.FilePath());
.RuleFor(x => x.Path, f => includePath ? (path ?? f.System.FilePath()) : null);
}
/// <summary>