Adds authentication support for integration testing

This commit is contained in:
BinaryAlley committed 2024-11-16 15:49:24 +02:00
1 parent f2703b86c5
commit 5aa7a5f672
33 files changed
+671 -227

No files matched your search

@@ -1,4 +1,5 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using Mediator;
using System.Diagnostics;
@@ -13,6 +14,6 @@ namespace Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathEx
/// <param name="IncludeHiddenElements">Whether to include hidden file system elements or not.</param>
[DebuggerDisplay("Path: {Path}, IncludeHiddenElements: {IncludeHiddenElements}")]
public record CheckPathExistsQuery(
string? Path,
string? Path,
bool IncludeHiddenElements
) : IRequest<PathExistsResponse>;
) : IRequest<ErrorOr<PathExistsResponse>>;
@@ -1,4 +1,5 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
using Mediator;
@@ -11,7 +12,7 @@ namespace Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathEx
/// <summary>
/// Handler for the query to check the existence a file system path.
/// </summary>
public class CheckPathExistsQueryHandler : IRequestHandler<CheckPathExistsQuery, PathExistsResponse>
public class CheckPathExistsQueryHandler : IRequestHandler<CheckPathExistsQuery, ErrorOr<PathExistsResponse>>
{
private readonly IPathService _pathService;
@@ -30,10 +31,10 @@ public class CheckPathExistsQueryHandler : IRequestHandler<CheckPathExistsQuery,
/// <param name="request">The query containing the request.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>
/// <see langword="true"/> if the specified path exists, <see langword="false"/> otherwise.
/// An <see cref="ErrorOr{TValue}"/> containing either <see langword="true"/> if the specified path exists, <see langword="false"/> if it doesn't, or an error message.
/// </returns>
public ValueTask<PathExistsResponse> Handle(CheckPathExistsQuery request, CancellationToken cancellationToken)
public ValueTask<ErrorOr<PathExistsResponse>> Handle(CheckPathExistsQuery request, CancellationToken cancellationToken)
{
return ValueTask.FromResult(new PathExistsResponse(_pathService.Exists(request.Path!, request.IncludeHiddenElements)));
return ValueTask.FromResult(ErrorOrFactory.From(new PathExistsResponse(_pathService.Exists(request.Path!, request.IncludeHiddenElements))));
}
}