mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Centralizes and standardizes test fixtures.
This commit is contained in:
1 parent
dfc513da4f
commit
b648e2f054
294 files changed
+3807
-4437
No files matched your search
+43
@@ -0,0 +1,43 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.FileSystemManagement.Directories.Queries.GetDirectories;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.FileSystemManagement.Directories.Queries.GetDirectories;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetDirectoriesQuery"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetDirectoriesQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get directories.
|
||||
/// </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 to get directories.</returns>
|
||||
public GetDirectoriesQuery Create(string? path = null, bool includeHiddenElements = false)
|
||||
{
|
||||
return new Faker<GetDirectoriesQuery>()
|
||||
.CustomInstantiator(f => new GetDirectoriesQuery(
|
||||
default!,
|
||||
default
|
||||
))
|
||||
.RuleFor(x => x.Path, f => path ?? f.System.DirectoryPath())
|
||||
.RuleFor(x => x.IncludeHiddenElements, f => includeHiddenElements);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetDirectoriesQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetDirectoriesQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Drives.Queries.GetDrives;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.FileSystemManagement.Drives.Queries.GetDrives;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetDrivesQuery"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetDrivesQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get drives.
|
||||
/// </summary>
|
||||
/// <returns>The created query.</returns>
|
||||
public GetDrivesQuery Create()
|
||||
{
|
||||
return new GetDrivesQuery();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetDrivesQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetDrivesQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.FileSystem.Queries.GetFileSystem;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.FileSystemManagement.FileSystem.Queries.GetFileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetFileSystemQuery"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetFileSystemQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get the file system.
|
||||
/// </summary>
|
||||
/// <returns>The created query.</returns>
|
||||
public GetFileSystemQuery Create()
|
||||
{
|
||||
return new GetFileSystemQuery();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetFileSystemQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetFileSystemQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.FileSystemManagement.Files.Queries.GetFiles;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.FileSystemManagement.Files.Queries.GetFiles;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetFilesQuery"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetFilesQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get files.
|
||||
/// </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 to get files.</returns>
|
||||
public GetFilesQuery Create(string? path = null, bool includeHiddenElements = false)
|
||||
{
|
||||
return new Faker<GetFilesQuery>()
|
||||
.CustomInstantiator(f => new GetFilesQuery(
|
||||
default!,
|
||||
default
|
||||
))
|
||||
.RuleFor(x => x.Path, f => path ?? f.System.FilePath())
|
||||
.RuleFor(x => x.IncludeHiddenElements, f => includeHiddenElements);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetFilesQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetFilesQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.FileSystemManagement.Files.Queries.GetTreeFiles;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.FileSystemManagement.Files.Queries.GetTreeFiles;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetTreeFilesQuery"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetTreeFilesQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get tree files.
|
||||
/// </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 to get tree files.</returns>
|
||||
public GetTreeFilesQuery Create(string? path = null, bool includeHiddenElements = false)
|
||||
{
|
||||
return new Faker<GetTreeFilesQuery>()
|
||||
.CustomInstantiator(f => new GetTreeFilesQuery(
|
||||
default!,
|
||||
default
|
||||
))
|
||||
.RuleFor(x => x.Path, f => path ?? f.System.FilePath())
|
||||
.RuleFor(x => x.IncludeHiddenElements, f => includeHiddenElements);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetTreeFilesQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetTreeFilesQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+42
@@ -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())];
|
||||
}
|
||||
}
|
||||
+39
@@ -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())];
|
||||
}
|
||||
}
|
||||
+43
@@ -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())];
|
||||
}
|
||||
}
|
||||
+39
@@ -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())];
|
||||
}
|
||||
}
|
||||
+39
@@ -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())];
|
||||
}
|
||||
}
|
||||
+39
@@ -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())];
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.FileSystemManagement.Thumbnails.Queries.GetThumbnail;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.FileSystemManagement.Thumbnails.Queries.GetThumbnail;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetThumbnailQuery"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetThumbnailQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get a thumbnail.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The file system path.</param>
|
||||
/// <param name="quality">Optional. The thumbnail quality.</param>
|
||||
/// <returns>The created query.</returns>
|
||||
public GetThumbnailQuery Create(string? path = null, int? quality = null)
|
||||
{
|
||||
return new Faker<GetThumbnailQuery>()
|
||||
.CustomInstantiator(f => new GetThumbnailQuery(
|
||||
default!,
|
||||
default
|
||||
))
|
||||
.RuleFor(x => x.Path, f => path ?? f.System.FilePath())
|
||||
.RuleFor(x => x.Quality, f => quality ?? f.Random.Int());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetThumbnailQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetThumbnailQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user