From 8c8c96c6dbed3c931f36b9a6ccfa7907c46e2638 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Thu, 13 Aug 2026 10:12:32 -0700 Subject: [PATCH] Fixes ValidatePath query handler to call its validator and updates consuming web client --- .../ValidatePath/ValidatePathQueryHandler.cs | 20 ++- .../Path/ValidatePath/ValidatePathEndpoint.cs | 9 +- .../wwwroot/js/file-system-browser-dialog.js | 33 ++-- .../Path/ValidatePathEndpointTests.cs | 24 ++- .../CQRS/HandlersCallTheirValidatorsTests.cs | 149 ++++++++++++++++++ .../ValidatePathQueryHandlerTests.cs | 47 ++++-- .../Path/ValidatePathEndpointTests.cs | 34 +++- 7 files changed, 276 insertions(+), 40 deletions(-) create mode 100644 tests/UnitTests/Lumina.Application.UnitTests/Common/CQRS/HandlersCallTheirValidatorsTests.cs diff --git a/src/Lumina.Application/Core/FileSystemManagement/Paths/Queries/ValidatePath/ValidatePathQueryHandler.cs b/src/Lumina.Application/Core/FileSystemManagement/Paths/Queries/ValidatePath/ValidatePathQueryHandler.cs index 88e68f0e..b53f1aa3 100644 --- a/src/Lumina.Application/Core/FileSystemManagement/Paths/Queries/ValidatePath/ValidatePathQueryHandler.cs +++ b/src/Lumina.Application/Core/FileSystemManagement/Paths/Queries/ValidatePath/ValidatePathQueryHandler.cs @@ -1,7 +1,10 @@ #region ========================================================================= USING ===================================================================================== +using ErrorOr; using Lumina.Application.Common.CQRS; +using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Contracts.Responses.FileSystemManagement.Path; using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; #endregion @@ -11,17 +14,20 @@ namespace Lumina.Application.Core.FileSystemManagement.Paths.Queries.ValidatePat /// /// Handler for the query to validate a file system path. /// -public class ValidatePathQueryHandler : IQueryHandler +public class ValidatePathQueryHandler : IQueryHandler> { private readonly IPathService _pathService; + private readonly IValidator _validator; /// /// Initializes a new instance of the class. /// /// Injected service for managing file system paths. - public ValidatePathQueryHandler(IPathService pathService) + /// Injected validator for application validation rules. + public ValidatePathQueryHandler(IPathService pathService, IValidator validator) { _pathService = pathService; + _validator = validator; } /// @@ -30,10 +36,14 @@ public class ValidatePathQueryHandler : IQueryHandlerThe query containing the request. /// Cancellation token that can be used to stop the execution. /// - /// if the specified path is valid, otherwise. + /// An containing either if the specified path is valid, if it isn't, or an error message. /// - public Task HandleAsync(ValidatePathQuery query, CancellationToken cancellationToken) + public Task> HandleAsync(ValidatePathQuery query, CancellationToken cancellationToken) { - return Task.FromResult(new PathValidResponse(_pathService.IsValidPath(query.Path!))); + List validationResult = _validator.Validate(query); + if (validationResult.Count > 0) + return Task.FromResult>(validationResult); + + return Task.FromResult(ErrorOrFactory.From(new PathValidResponse(_pathService.IsValidPath(query.Path!)))); } } diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/FileSystemManagement/Path/ValidatePath/ValidatePathEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/FileSystemManagement/Path/ValidatePath/ValidatePathEndpoint.cs index 986aed6a..eded7fa9 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/FileSystemManagement/Path/ValidatePath/ValidatePathEndpoint.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/FileSystemManagement/Path/ValidatePath/ValidatePathEndpoint.cs @@ -1,4 +1,5 @@ #region ========================================================================= USING ===================================================================================== +using ErrorOr; using Lumina.Application.Common.CQRS; using Lumina.Application.Common.Mapping.FileSystemManagement.Paths; using Lumina.Application.Core.FileSystemManagement.Paths.Queries.ValidatePath; @@ -18,13 +19,13 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.Valid /// public class ValidatePathEndpoint : BaseEndpoint { - private readonly IQueryHandler _validatePathQueryHandler; + private readonly IQueryHandler> _validatePathQueryHandler; /// /// Initializes a new instance of the class. /// /// Injected service for handling validate path queries. - public ValidatePathEndpoint(IQueryHandler validatePathQueryHandler) + public ValidatePathEndpoint(IQueryHandler> validatePathQueryHandler) { _validatePathQueryHandler = validatePathQueryHandler; } @@ -47,7 +48,7 @@ public class ValidatePathEndpoint : BaseEndpoint /// Cancellation token that can be used to stop the execution. public override async Task ExecuteAsync(ValidatePathRequest request, CancellationToken cancellationToken) { - PathValidResponse result = await _validatePathQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false); - return TypedResults.Ok(result); + ErrorOr result = await _validatePathQueryHandler.HandleAsync(request.ToQuery(), cancellationToken).ConfigureAwait(false); + return result.Match(success => TypedResults.Ok(success), Problem); } } diff --git a/src/Lumina.Presentation.Web/wwwroot/js/file-system-browser-dialog.js b/src/Lumina.Presentation.Web/wwwroot/js/file-system-browser-dialog.js index a3e87f67..566d9279 100644 --- a/src/Lumina.Presentation.Web/wwwroot/js/file-system-browser-dialog.js +++ b/src/Lumina.Presentation.Web/wwwroot/js/file-system-browser-dialog.js @@ -249,21 +249,26 @@ */ async function checkPathAsync(path) { const pathValidResponse = await callApiGetAsync(`${clientBasePath}path/api-validate?path=${encodeURIComponent(path)}`); - if (pathValidResponse !== undefined) { - if (!pathValidResponse.isValid) { - notificationService.show("Specified path is not valid!", NotificationType.ERROR); // TODO: should ask error message from server when translation is implemented - addressBarInput.value = _path; - if (addressBarInput.value !== null && !addressBarInput.value.endsWith(pathSeparator)) - addressBarInput.value += pathSeparator; - } else { - const pathExistsResponse = await callApiGetAsync(`${clientBasePath}path/api-check-path-exists?path=${encodeURIComponent(path)}&includeHiddenElements=${showHiddenElements}`); - if (pathExistsResponse !== undefined && !pathExistsResponse.exists) { - notificationService.show("Specified path does not exist!", NotificationType.ERROR); // TODO: should ask error message from server when translation is implemented - return false; - } - } - return pathValidResponse.isValid; + if (pathValidResponse === undefined) { + // the API rejected the path with a validation error (e.g. it is empty), treat it as invalid and restore the address bar + addressBarInput.value = _path; + if (addressBarInput.value !== null && !addressBarInput.value.endsWith(pathSeparator)) + addressBarInput.value += pathSeparator; + return false; } + if (!pathValidResponse.isValid) { + notificationService.show("Specified path is not valid!", NotificationType.ERROR); // TODO: should ask error message from server when translation is implemented + addressBarInput.value = _path; + if (addressBarInput.value !== null && !addressBarInput.value.endsWith(pathSeparator)) + addressBarInput.value += pathSeparator; + } else { + const pathExistsResponse = await callApiGetAsync(`${clientBasePath}path/api-check-path-exists?path=${encodeURIComponent(path)}&includeHiddenElements=${showHiddenElements}`); + if (pathExistsResponse !== undefined && !pathExistsResponse.exists) { + notificationService.show("Specified path does not exist!", NotificationType.ERROR); // TODO: should ask error message from server when translation is implemented + return false; + } + } + return pathValidResponse.isValid; } /** diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/ValidatePathEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/ValidatePathEndpointTests.cs index 86a0d98b..219e0c99 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/ValidatePathEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/FileSystemManagement/Path/ValidatePathEndpointTests.cs @@ -1,7 +1,9 @@ #region ========================================================================= USING ===================================================================================== using Lumina.Contracts.Responses.FileSystemManagement.Path; using Lumina.Presentation.Api.IntegrationTests.Common.Setup; +using Microsoft.AspNetCore.Http; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Net; using System.Net.Http; @@ -82,7 +84,7 @@ public class ValidatePathEndpointTests : IClassFixture(content, _jsonOptions); - Assert.NotNull(result); - Assert.False(result!.IsValid); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal(StatusCodes.Status422UnprocessableEntity, problemDetails!["status"].GetInt32()); + Assert.Equal("General.Validation", problemDetails["title"].GetString()); + Assert.Equal("/api/v1/path/validate", problemDetails["instance"].GetString()); + Assert.Equal("OneOrMoreValidationErrorsOccurred", problemDetails["detail"].GetString()); + Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", problemDetails["type"].GetString()); + Assert.NotNull(problemDetails["traceId"].GetString()); + Assert.NotEmpty(problemDetails["traceId"].GetString()); + + Dictionary? errors = problemDetails["errors"].Deserialize>(_jsonOptions); + Assert.NotNull(errors); + Assert.Contains("General.Validation", errors.Keys); + Assert.Contains("PathCannotBeEmpty", errors["General.Validation"]); } [Fact] diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/CQRS/HandlersCallTheirValidatorsTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/CQRS/HandlersCallTheirValidatorsTests.cs new file mode 100644 index 00000000..72fb5b9f --- /dev/null +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/CQRS/HandlersCallTheirValidatorsTests.cs @@ -0,0 +1,149 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +using Lumina.Application.Common.Infrastructure.Validation; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Reflection; +#endregion + +namespace Lumina.Application.UnitTests.Common.CQRS; + +/// +/// Contains tests that enforce the convention that command and query handlers always call the validator defined for their command or query. +/// +[ExcludeFromCodeCoverage] +public class HandlersCallTheirValidatorsTests +{ + private static readonly Assembly s_applicationAssembly = typeof(ICommand).Assembly; + + /// + /// Ensures every command or query that has a validator has a handler that calls that validator. + /// + [Fact] + public void AllCommandAndQueryHandlers_WhenTheirRequestHasAValidator_ShouldCallIt() + { + // Arrange + List violations = []; + + // Act + foreach (Type type in s_applicationAssembly.GetTypes().Where(IsConcreteClass)) + { + foreach (Type implementedInterface in type.GetInterfaces().Where(IsValidatorInterface)) + { + Type requestType = implementedInterface.GetGenericArguments()[0]; + if (!IsCommandOrQuery(requestType)) + continue; + + Type? handlerType = FindHandlerFor(requestType); + if (handlerType is null) + { + violations.Add($"Validator '{type.FullName}' targets '{requestType.FullName}', which has no command or query handler."); + continue; + } + + if (!CallsValidator(handlerType, requestType)) + violations.Add($"Handler '{handlerType.FullName}' does not call 'IValidator<{requestType.Name}>.Validate'."); + } + } + + // Assert + Assert.True(violations.Count == 0, string.Join(Environment.NewLine, violations)); + } + + private static bool IsConcreteClass(Type type) + { + return !type.IsInterface && !type.IsAbstract && !type.IsGenericTypeDefinition; + } + + private static bool IsValidatorInterface(Type type) + { + return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IValidator<>); + } + + private static bool IsCommandOrQueryHandlerInterface(Type type) + { + if (!type.IsGenericType) + return false; + Type genericTypeDefinition = type.GetGenericTypeDefinition(); + return genericTypeDefinition == typeof(ICommandHandler<,>) || genericTypeDefinition == typeof(IQueryHandler<,>); + } + + private static bool IsCommandOrQuery(Type type) + { + return typeof(ICommand).IsAssignableFrom(type) || typeof(IQuery).IsAssignableFrom(type); + } + + private static Type? FindHandlerFor(Type requestType) + { + return s_applicationAssembly.GetTypes() + .Where(IsConcreteClass) + .FirstOrDefault(type => type.GetInterfaces().Any(@interface => + IsCommandOrQueryHandlerInterface(@interface) && @interface.GetGenericArguments()[0].Equals(requestType))); + } + + private static bool CallsValidator(Type handlerType, Type requestType) + { + Type validatorInterface = typeof(IValidator<>).MakeGenericType(requestType); + foreach (Type type in EnumerateTypeHierarchy(handlerType)) + foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly)) + if (CallsValidatorMethod(method, validatorInterface)) + return true; + return false; + } + + private static IEnumerable EnumerateTypeHierarchy(Type type) + { + yield return type; + foreach (Type nestedType in type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic)) + foreach (Type nestedDescendant in EnumerateTypeHierarchy(nestedType)) + yield return nestedDescendant; + } + + private static bool CallsValidatorMethod(MethodInfo method, Type validatorInterface) + { + MethodBody? body = method.GetMethodBody(); + if (body is null) + return false; + + byte[]? il = body.GetILAsByteArray(); + if (il is null) + return false; + + Module module = method.Module; + for (int i = 0; i < il.Length; i++) + { + // 0x28 is the call opcode and 0x6F is the callvirt opcode, both followed by a 4-byte metadata token + if (il[i] != 0x28 && il[i] != 0x6F) + continue; + + if (i + 4 >= il.Length) + break; + + int token = il[i + 1] | (il[i + 2] << 8) | (il[i + 3] << 16) | (il[i + 4] << 24); + try + { + if (module.ResolveMethod(token) is MethodInfo resolvedMethod && + resolvedMethod.Name == nameof(IValidator.Validate) && + resolvedMethod.DeclaringType != null && + resolvedMethod.DeclaringType.Equals(validatorInterface)) + return true; + } + catch (ArgumentException) + { + // the token is not a valid method token, skip it + } + catch (BadImageFormatException) + { + // the token references corrupt metadata, skip it + } + catch (InvalidOperationException) + { + // the token cannot be resolved as a method, skip it + } + i += 4; + } + return false; + } +} diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/FileSystemManagement/Pahs/Queries/ValidatePath/ValidatePathQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/FileSystemManagement/Pahs/Queries/ValidatePath/ValidatePathQueryHandlerTests.cs index 1865970f..dd62b385 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/FileSystemManagement/Pahs/Queries/ValidatePath/ValidatePathQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/FileSystemManagement/Pahs/Queries/ValidatePath/ValidatePathQueryHandlerTests.cs @@ -1,9 +1,13 @@ #region ========================================================================= USING ===================================================================================== +using ErrorOr; +using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Core.FileSystemManagement.Paths.Queries.ValidatePath; using Lumina.Application.UnitTests.Core.FileSystemManagement.Pahs.Queries.ValidatePath.Fixtures; using Lumina.Contracts.Responses.FileSystemManagement.Path; using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services; +using Lumina.Domain.SharedKernel.Common.Errors; using NSubstitute; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +22,7 @@ namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Pahs.Queries.Va public class ValidatePathQueryHandlerTests { private readonly IPathService _mockPathService; + private readonly IValidator _mockValidator; private readonly ValidatePathQueryHandler _sut; /// @@ -26,7 +31,10 @@ public class ValidatePathQueryHandlerTests public ValidatePathQueryHandlerTests() { _mockPathService = Substitute.For(); - _sut = new ValidatePathQueryHandler(_mockPathService); + _mockValidator = Substitute.For>(); + _mockValidator.Validate(Arg.Any()) + .Returns([]); + _sut = new ValidatePathQueryHandler(_mockPathService, _mockValidator); } [Fact] @@ -37,10 +45,11 @@ public class ValidatePathQueryHandlerTests _mockPathService.IsValidPath(query.Path!).Returns(true); // Act - PathValidResponse result = await _sut.HandleAsync(query, CancellationToken.None); + ErrorOr result = await _sut.HandleAsync(query, CancellationToken.None); // Assert - Assert.True(result.IsValid); + Assert.False(result.IsError); + Assert.True(result.Value.IsValid); _mockPathService.Received(1).IsValidPath(query.Path!); } @@ -52,10 +61,11 @@ public class ValidatePathQueryHandlerTests _mockPathService.IsValidPath(query.Path!).Returns(false); // Act - PathValidResponse result = await _sut.HandleAsync(query, CancellationToken.None); + ErrorOr result = await _sut.HandleAsync(query, CancellationToken.None); // Assert - Assert.False(result.IsValid); + Assert.False(result.IsError); + Assert.False(result.Value.IsValid); _mockPathService.Received(1).IsValidPath(query.Path!); } @@ -67,10 +77,11 @@ public class ValidatePathQueryHandlerTests _mockPathService.IsValidPath(Arg.Any()).Returns(false); // Act - PathValidResponse result = await _sut.HandleAsync(query, CancellationToken.None); + ErrorOr result = await _sut.HandleAsync(query, CancellationToken.None); // Assert - Assert.False(result.IsValid); + Assert.False(result.IsError); + Assert.False(result.Value.IsValid); _mockPathService.Received(1).IsValidPath(Arg.Any()); } @@ -82,10 +93,28 @@ public class ValidatePathQueryHandlerTests _mockPathService.IsValidPath(Arg.Any()).Returns(false); // Act - PathValidResponse result = await _sut.HandleAsync(query, CancellationToken.None); + ErrorOr result = await _sut.HandleAsync(query, CancellationToken.None); // Assert - Assert.False(result.IsValid); + Assert.False(result.IsError); + Assert.False(result.Value.IsValid); _mockPathService.Received(1).IsValidPath(Arg.Any()); } + + [Fact] + public async Task HandleAsync_WhenValidatorReturnsErrors_ShouldReturnValidationErrorsWithoutCallingPathService() + { + // Arrange + ValidatePathQuery query = ValidatePathQueryFixure.CreateValidatePathQuery(); + _mockValidator.Validate(query) + .Returns([Errors.FileSystemManagement.PathCannotBeEmpty]); + + // Act + ErrorOr result = await _sut.HandleAsync(query, CancellationToken.None); + + // Assert + Assert.True(result.IsError); + Assert.Equal(Errors.FileSystemManagement.PathCannotBeEmpty, result.FirstError); + _mockPathService.DidNotReceive().IsValidPath(Arg.Any()); + } } diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/FileSystemManagement/Path/ValidatePathEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/FileSystemManagement/Path/ValidatePathEndpointTests.cs index 327f7109..0eb9062f 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/FileSystemManagement/Path/ValidatePathEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/FileSystemManagement/Path/ValidatePathEndpointTests.cs @@ -1,4 +1,5 @@ #region ========================================================================= USING ===================================================================================== +using ErrorOr; using FastEndpoints; using Lumina.Application.Common.CQRS; using Lumina.Application.Core.FileSystemManagement.Paths.Queries.ValidatePath; @@ -8,6 +9,7 @@ using Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.ValidateP using Lumina.Presentation.Api.UnitTests.Core.Endpoints.FileSystemManagement.Fixtures; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.HttpResults; +using Microsoft.AspNetCore.Mvc; using NSubstitute; using System; using System.Diagnostics.CodeAnalysis; @@ -23,7 +25,7 @@ namespace Lumina.Presentation.Api.UnitTests.Core.Endpoints.FileSystemManagement. [ExcludeFromCodeCoverage] public class ValidatePathEndpointTests { - private readonly IQueryHandler _mockHandler; + private readonly IQueryHandler> _mockHandler; private readonly ValidatePathEndpoint _sut; private readonly ValidatePathRequestFixture _validatePathRequestFixture; @@ -32,7 +34,7 @@ public class ValidatePathEndpointTests /// public ValidatePathEndpointTests() { - _mockHandler = Substitute.For>(); + _mockHandler = Substitute.For>>(); _sut = Factory.Create(_mockHandler); _validatePathRequestFixture = new ValidatePathRequestFixture(); } @@ -73,6 +75,32 @@ public class ValidatePathEndpointTests Arg.Is(cancellationToken)); } + [Fact] + public async Task ExecuteAsync_WhenMediatorReturnsValidationError_ShouldReturnValidationProblemResult() + { + // Arrange + ValidatePathRequest request = _validatePathRequestFixture.Create(@"C:\Users\TestUser\Documents"); + CancellationToken cancellationToken = CancellationToken.None; + Error expectedError = Error.Validation("Path.Invalid", "The provided path is invalid."); + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(expectedError); + + // Act + IResult result = await _sut.ExecuteAsync(request, cancellationToken); + + // Assert + ProblemHttpResult problemDetails = Assert.IsType(result); + Assert.Equal(StatusCodes.Status422UnprocessableEntity, problemDetails.StatusCode); + Assert.Equal("application/problem+json", problemDetails.ContentType); + HttpValidationProblemDetails validationProblemDetails = Assert.IsType(problemDetails.ProblemDetails); + Assert.Equal(StatusCodes.Status422UnprocessableEntity, validationProblemDetails.Status); + Assert.Equal("General.Validation", validationProblemDetails.Title); + Assert.Equal("OneOrMoreValidationErrorsOccurred", validationProblemDetails.Detail); + Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", validationProblemDetails.Type); + Assert.Single(validationProblemDetails.Errors); + Assert.Equal(new[] { "The provided path is invalid." }, validationProblemDetails.Errors["Path.Invalid"]); + } + [Fact] public async Task ExecuteAsync_WhenCancellationRequested_ShouldCancelOperation() { @@ -88,7 +116,7 @@ public class ValidatePathEndpointTests operationStarted.SetResult(true); await cancellationRequested.Task; callInfo.Arg().ThrowIfCancellationRequested(); - return new PathValidResponse(true); + return ErrorOrFactory.From(new PathValidResponse(true)); }, callInfo.Arg())); // Act