mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 14:11:10 +00:00
Standardizes test conventions and documentation
This commit is contained in:
1 parent
7aeed04255
commit
f42dc709de
190 files changed
+2180
-2814
No files matched your search
+7
-5
@@ -2,8 +2,9 @@
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.FileSystemManagement.FileSystem.Queries.GetFileSystem;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.FileSystem;
|
||||
using Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.FileSystem;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.FileSystem;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.FileSystem;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.FileSystem.GetType;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
@@ -24,6 +25,7 @@ public class GetTypeEndpointTests
|
||||
{
|
||||
private readonly IQueryHandler<GetFileSystemQuery, FileSystemTypeResponse> _mockHandler;
|
||||
private readonly GetTypeEndpoint _sut;
|
||||
private readonly FileSystemTypeResponseFixture _fileSystemTypeResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetTypeEndpointTests"/> class.
|
||||
@@ -39,7 +41,7 @@ public class GetTypeEndpointTests
|
||||
{
|
||||
// Arrange
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
FileSystemTypeResponse expectedResponse = new(PlatformType.Windows);
|
||||
FileSystemTypeResponse expectedResponse = _fileSystemTypeResponseFixture.Create(platformType: PlatformType.Windows);
|
||||
_mockHandler.HandleAsync(Arg.Any<GetFileSystemQuery>(), Arg.Any<CancellationToken>())
|
||||
.Returns(expectedResponse);
|
||||
|
||||
@@ -58,7 +60,7 @@ public class GetTypeEndpointTests
|
||||
{
|
||||
// Arrange
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
FileSystemTypeResponse expectedResponse = new(platformType);
|
||||
FileSystemTypeResponse expectedResponse = _fileSystemTypeResponseFixture.Create(platformType: platformType);
|
||||
_mockHandler.HandleAsync(Arg.Any<GetFileSystemQuery>(), Arg.Any<CancellationToken>())
|
||||
.Returns(expectedResponse);
|
||||
|
||||
@@ -76,7 +78,7 @@ public class GetTypeEndpointTests
|
||||
// Arrange
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
_mockHandler.HandleAsync(Arg.Any<GetFileSystemQuery>(), Arg.Any<CancellationToken>())
|
||||
.Returns(new FileSystemTypeResponse(PlatformType.Windows));
|
||||
.Returns(_fileSystemTypeResponseFixture.Create(platformType: PlatformType.Windows));
|
||||
|
||||
// Act
|
||||
await _sut.ExecuteAsync(EmptyRequest.Instance, cancellationToken);
|
||||
@@ -99,7 +101,7 @@ public class GetTypeEndpointTests
|
||||
operationStarted.SetResult(true);
|
||||
await cancellationRequested.Task;
|
||||
callInfo.Arg<CancellationToken>().ThrowIfCancellationRequested();
|
||||
return new FileSystemTypeResponse(PlatformType.Windows);
|
||||
return _fileSystemTypeResponseFixture.Create(platformType: PlatformType.Windows);
|
||||
}, callInfo.Arg<CancellationToken>()));
|
||||
|
||||
// Act
|
||||
|
||||
+5
-3
@@ -3,6 +3,7 @@ using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathExists;
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
@@ -27,6 +28,7 @@ public class CheckPathExistsEndpointTests
|
||||
private readonly IQueryHandler<CheckPathExistsQuery, Result<PathExistsResponse>> _mockHandler;
|
||||
private readonly CheckPathExistsEndpoint _sut;
|
||||
private readonly CheckPathExistsRequestFixture _checkPathExistsRequestFixture = new();
|
||||
private readonly PathExistsResponseFixture _pathExistsResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CheckPathExistsEndpointTests"/> class.
|
||||
@@ -43,7 +45,7 @@ public class CheckPathExistsEndpointTests
|
||||
// Arrange
|
||||
CheckPathExistsRequest request = _checkPathExistsRequestFixture.Create(path: @"C:\Users\TestUser\Documents", includeHiddenElements: true);
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
PathExistsResponse expectedResponse = new(true);
|
||||
PathExistsResponse expectedResponse = _pathExistsResponseFixture.Create(exists: true);
|
||||
_mockHandler.HandleAsync(Arg.Any<CheckPathExistsQuery>(), Arg.Any<CancellationToken>())
|
||||
.Returns(expectedResponse);
|
||||
|
||||
@@ -62,7 +64,7 @@ public class CheckPathExistsEndpointTests
|
||||
CheckPathExistsRequest request = _checkPathExistsRequestFixture.Create(path: @"C:\Users\TestUser\Documents", includeHiddenElements: true);
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
_mockHandler.HandleAsync(Arg.Any<CheckPathExistsQuery>(), Arg.Any<CancellationToken>())
|
||||
.Returns(new PathExistsResponse(true));
|
||||
.Returns(_pathExistsResponseFixture.Create(exists: true));
|
||||
|
||||
// Act
|
||||
await _sut.ExecuteAsync(request, cancellationToken);
|
||||
@@ -88,7 +90,7 @@ public class CheckPathExistsEndpointTests
|
||||
operationStarted.SetResult(true);
|
||||
await cancellationRequested.Task;
|
||||
callInfo.Arg<CancellationToken>().ThrowIfCancellationRequested();
|
||||
return Result.From(new PathExistsResponse(true));
|
||||
return Result.From(_pathExistsResponseFixture.Create(exists: true));
|
||||
}, callInfo.Arg<CancellationToken>()));
|
||||
|
||||
// Act
|
||||
|
||||
+5
-3
@@ -3,6 +3,7 @@ using FastEndpoints;
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.ValidatePath;
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
@@ -27,6 +28,7 @@ public class ValidatePathEndpointTests
|
||||
private readonly IQueryHandler<ValidatePathQuery, Result<PathValidResponse>> _mockHandler;
|
||||
private readonly ValidatePathEndpoint _sut;
|
||||
private readonly ValidatePathRequestFixture _validatePathRequestFixture = new();
|
||||
private readonly PathValidResponseFixture _pathValidResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ValidatePathEndpointTests"/> class.
|
||||
@@ -43,7 +45,7 @@ public class ValidatePathEndpointTests
|
||||
// Arrange
|
||||
ValidatePathRequest request = _validatePathRequestFixture.Create(@"C:\Users\TestUser\Documents");
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
PathValidResponse expectedResponse = new(true);
|
||||
PathValidResponse expectedResponse = _pathValidResponseFixture.Create(isValid: true);
|
||||
_mockHandler.HandleAsync(Arg.Any<ValidatePathQuery>(), Arg.Any<CancellationToken>())
|
||||
.Returns(expectedResponse);
|
||||
|
||||
@@ -62,7 +64,7 @@ public class ValidatePathEndpointTests
|
||||
ValidatePathRequest request = _validatePathRequestFixture.Create(@"C:\Users\TestUser\Documents");
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
_mockHandler.HandleAsync(Arg.Any<ValidatePathQuery>(), Arg.Any<CancellationToken>())
|
||||
.Returns(new PathValidResponse(true));
|
||||
.Returns(_pathValidResponseFixture.Create(isValid: true));
|
||||
|
||||
// Act
|
||||
await _sut.ExecuteAsync(request, cancellationToken);
|
||||
@@ -114,7 +116,7 @@ public class ValidatePathEndpointTests
|
||||
operationStarted.SetResult(true);
|
||||
await cancellationRequested.Task;
|
||||
callInfo.Arg<CancellationToken>().ThrowIfCancellationRequested();
|
||||
return Result.From(new PathValidResponse(true));
|
||||
return Result.From(_pathValidResponseFixture.Create(isValid: true));
|
||||
}, callInfo.Arg<CancellationToken>()));
|
||||
|
||||
// Act
|
||||
|
||||
Reference in new issue
Block a user