mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 09: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
+4
-6
@@ -1,8 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using AutoFixture;
|
||||
using AutoFixture.AutoNSubstitute;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathExists;
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -17,21 +16,20 @@ namespace Lumina.Application.UnitTests.Common.Mapping.FileSystemManagement.Paths
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class CheckPathExistsRequestMappingTests
|
||||
{
|
||||
private readonly IFixture _fixture;
|
||||
private readonly CheckPathExistsRequestFixture _checkPathExistsRequestFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CheckPathExistsRequestMappingTests"/> class.
|
||||
/// </summary>
|
||||
public CheckPathExistsRequestMappingTests()
|
||||
{
|
||||
_fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToQuery_WhenMappingCheckPathExistsRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
CheckPathExistsRequest request = _fixture.Create<CheckPathExistsRequest>();
|
||||
CheckPathExistsRequest request = _checkPathExistsRequestFixture.Create();
|
||||
|
||||
// Act
|
||||
CheckPathExistsQuery result = request.ToQuery();
|
||||
@@ -64,7 +62,7 @@ public class CheckPathExistsRequestMappingTests
|
||||
public void ToQuery_WhenMappingMultipleRequests_ShouldMapAllCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<CheckPathExistsRequest> requests = _fixture.CreateMany<CheckPathExistsRequest>().ToList();
|
||||
List<CheckPathExistsRequest> requests = _checkPathExistsRequestFixture.CreateMany();
|
||||
|
||||
// Act
|
||||
List<CheckPathExistsQuery> results = requests.Select(r => r.ToQuery()).ToList();
|
||||
|
||||
+5
-7
@@ -1,8 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using AutoFixture;
|
||||
using AutoFixture.AutoNSubstitute;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.CombinePath;
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -17,21 +16,20 @@ namespace Lumina.Application.UnitTests.Common.Mapping.FileSystemManagement.Paths
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class CombinePathRequestMappingTests
|
||||
{
|
||||
private readonly IFixture _fixture;
|
||||
private readonly CombinePathRequestFixture _combinePathRequestFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CombinePathRequestMappingTests"/> class.
|
||||
/// </summary>
|
||||
public CombinePathRequestMappingTests()
|
||||
{
|
||||
_fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToCommand_WhenMappingCombinePathRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
CombinePathRequest request = _fixture.Create<CombinePathRequest>();
|
||||
CombinePathRequest request = _combinePathRequestFixture.Create();
|
||||
|
||||
// Act
|
||||
CombinePathCommand result = request.ToCommand();
|
||||
@@ -64,10 +62,10 @@ public class CombinePathRequestMappingTests
|
||||
public void ToCommand_WhenMappingMultipleRequests_ShouldMapAllCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<CombinePathRequest> requests = _fixture.CreateMany<CombinePathRequest>().ToList();
|
||||
List<CombinePathRequest> requests = _combinePathRequestFixture.CreateMany();
|
||||
|
||||
// Act
|
||||
List<CombinePathCommand> results = requests.Select(r => r.ToCommand()).ToList();
|
||||
List<CombinePathCommand> results = [.. requests.Select(r => r.ToCommand())];
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
|
||||
+5
-7
@@ -1,8 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using AutoFixture;
|
||||
using AutoFixture.AutoNSubstitute;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathParent;
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -17,21 +16,20 @@ namespace Lumina.Application.UnitTests.Common.Mapping.FileSystemManagement.Paths
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetPathParentRequestMappingTests
|
||||
{
|
||||
private readonly IFixture _fixture;
|
||||
private readonly GetPathParentRequestFixture _getPathParentRequestFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPathParentRequestMappingTests"/> class.
|
||||
/// </summary>
|
||||
public GetPathParentRequestMappingTests()
|
||||
{
|
||||
_fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToQuery_WhenMappingGetPathParentRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
GetPathParentRequest request = _fixture.Create<GetPathParentRequest>();
|
||||
GetPathParentRequest request = _getPathParentRequestFixture.Create();
|
||||
|
||||
// Act
|
||||
GetPathParentQuery result = request.ToQuery();
|
||||
@@ -62,10 +60,10 @@ public class GetPathParentRequestMappingTests
|
||||
public void ToQuery_WhenMappingMultipleRequests_ShouldMapAllCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<GetPathParentRequest> requests = _fixture.CreateMany<GetPathParentRequest>().ToList();
|
||||
List<GetPathParentRequest> requests = _getPathParentRequestFixture.CreateMany();
|
||||
|
||||
// Act
|
||||
List<GetPathParentQuery> results = requests.Select(r => r.ToQuery()).ToList();
|
||||
List<GetPathParentQuery> results = [.. requests.Select(r => r.ToQuery())];
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
|
||||
+5
-7
@@ -1,8 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using AutoFixture;
|
||||
using AutoFixture.AutoNSubstitute;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathRoot;
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -17,21 +16,20 @@ namespace Lumina.Application.UnitTests.Common.Mapping.FileSystemManagement.Paths
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetPathRootRequestMappingTests
|
||||
{
|
||||
private readonly IFixture _fixture;
|
||||
private readonly GetPathRootRequestFixture _getPathRootRequestFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetPathRootRequestMappingTests"/> class.
|
||||
/// </summary>
|
||||
public GetPathRootRequestMappingTests()
|
||||
{
|
||||
_fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToQuery_WhenMappingGetPathRootRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
GetPathRootRequest request = _fixture.Create<GetPathRootRequest>();
|
||||
GetPathRootRequest request = _getPathRootRequestFixture.Create();
|
||||
|
||||
// Act
|
||||
GetPathRootQuery result = request.ToQuery();
|
||||
@@ -63,10 +61,10 @@ public class GetPathRootRequestMappingTests
|
||||
public void ToQuery_WhenMappingMultipleRequests_ShouldMapAllCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<GetPathRootRequest> requests = _fixture.CreateMany<GetPathRootRequest>().ToList();
|
||||
List<GetPathRootRequest> requests = _getPathRootRequestFixture.CreateMany();
|
||||
|
||||
// Act
|
||||
List<GetPathRootQuery> results = requests.Select(r => r.ToQuery()).ToList();
|
||||
List<GetPathRootQuery> results = [.. requests.Select(r => r.ToQuery())];
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
|
||||
+5
-7
@@ -1,8 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using AutoFixture;
|
||||
using AutoFixture.AutoNSubstitute;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.SplitPath;
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -17,21 +16,20 @@ namespace Lumina.Application.UnitTests.Common.Mapping.FileSystemManagement.Paths
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class SplitPathRequestMappingTests
|
||||
{
|
||||
private readonly IFixture _fixture;
|
||||
private readonly SplitPathRequestFixture _splitPathRequestFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SplitPathRequestMappingTests"/> class.
|
||||
/// </summary>
|
||||
public SplitPathRequestMappingTests()
|
||||
{
|
||||
_fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToCommand_WhenMappingSplitPathRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
SplitPathRequest request = _fixture.Create<SplitPathRequest>();
|
||||
SplitPathRequest request = _splitPathRequestFixture.Create();
|
||||
|
||||
// Act
|
||||
SplitPathCommand result = request.ToCommand();
|
||||
@@ -63,10 +61,10 @@ public class SplitPathRequestMappingTests
|
||||
public void ToCommand_WhenMappingMultipleRequests_ShouldMapAllCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<SplitPathRequest> requests = _fixture.CreateMany<SplitPathRequest>().ToList();
|
||||
List<SplitPathRequest> requests = _splitPathRequestFixture.CreateMany();
|
||||
|
||||
// Act
|
||||
List<SplitPathCommand> results = requests.Select(r => r.ToCommand()).ToList();
|
||||
List<SplitPathCommand> results = [.. requests.Select(r => r.ToCommand())];
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
|
||||
+5
-7
@@ -1,8 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using AutoFixture;
|
||||
using AutoFixture.AutoNSubstitute;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.ValidatePath;
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -17,21 +16,20 @@ namespace Lumina.Application.UnitTests.Common.Mapping.FileSystemManagement.Paths
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ValidatePathRequestMappingTests
|
||||
{
|
||||
private readonly IFixture _fixture;
|
||||
private readonly ValidatePathRequestFixture _validatePathRequestFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ValidatePathRequestMappingTests"/> class.
|
||||
/// </summary>
|
||||
public ValidatePathRequestMappingTests()
|
||||
{
|
||||
_fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToQuery_WhenMappingValidatePathRequest_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
ValidatePathRequest request = _fixture.Create<ValidatePathRequest>();
|
||||
ValidatePathRequest request = _validatePathRequestFixture.Create();
|
||||
|
||||
// Act
|
||||
ValidatePathQuery result = request.ToQuery();
|
||||
@@ -65,10 +63,10 @@ public class ValidatePathRequestMappingTests
|
||||
public void ToQuery_WhenMappingMultipleRequests_ShouldMapAllCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<ValidatePathRequest> requests = _fixture.CreateMany<ValidatePathRequest>().ToList();
|
||||
List<ValidatePathRequest> requests = _validatePathRequestFixture.CreateMany();
|
||||
|
||||
// Act
|
||||
List<ValidatePathQuery> results = requests.Select(r => r.ToQuery()).ToList();
|
||||
List<ValidatePathQuery> results = [.. requests.Select(r => r.ToQuery())];
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
|
||||
Reference in new issue
Block a user