mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 23:11:10 +00:00
Merge branch 'master' into feature/improve-openapi-documentation
This commit is contained in:
31 files changed
+661
-219
No files matched your search
+19
-12
@@ -1,4 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathExists;
|
||||
using Lumina.Application.UnitTests.Core.FileSystemManagement.Pahs.Queries.CheckPathExists.Fixtures;
|
||||
@@ -38,10 +39,11 @@ public class CheckPathExistsQueryHandlerTests
|
||||
_mockPathService.Exists(query.Path!).Returns(true);
|
||||
|
||||
// Act
|
||||
PathExistsResponse result = await _sut.Handle(query, CancellationToken.None);
|
||||
ErrorOr<PathExistsResponse> result = await _sut.Handle(query, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
result.Exists.Should().BeTrue();
|
||||
result.IsError.Should().BeFalse();
|
||||
result.Value.Exists.Should().BeTrue();
|
||||
_mockPathService.Received(1).Exists(query.Path!);
|
||||
}
|
||||
|
||||
@@ -53,10 +55,11 @@ public class CheckPathExistsQueryHandlerTests
|
||||
_mockPathService.Exists(query.Path!).Returns(true);
|
||||
|
||||
// Act
|
||||
PathExistsResponse result = await _sut.Handle(query, CancellationToken.None);
|
||||
ErrorOr<PathExistsResponse> result = await _sut.Handle(query, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
result.Exists.Should().BeTrue();
|
||||
result.IsError.Should().BeFalse();
|
||||
result.Value.Exists.Should().BeTrue();
|
||||
_mockPathService.Received(1).Exists(query.Path!);
|
||||
}
|
||||
|
||||
@@ -68,10 +71,11 @@ public class CheckPathExistsQueryHandlerTests
|
||||
_mockPathService.Exists(query.Path!, false).Returns(false);
|
||||
|
||||
// Act
|
||||
PathExistsResponse result = await _sut.Handle(query, CancellationToken.None);
|
||||
ErrorOr<PathExistsResponse> result = await _sut.Handle(query, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
result.Exists.Should().BeFalse();
|
||||
result.IsError.Should().BeFalse();
|
||||
result.Value.Exists.Should().BeFalse();
|
||||
_mockPathService.Received(1).Exists(query.Path!, false);
|
||||
}
|
||||
|
||||
@@ -83,10 +87,11 @@ public class CheckPathExistsQueryHandlerTests
|
||||
_mockPathService.Exists(query.Path!).Returns(false);
|
||||
|
||||
// Act
|
||||
PathExistsResponse result = await _sut.Handle(query, CancellationToken.None);
|
||||
ErrorOr<PathExistsResponse> result = await _sut.Handle(query, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
result.Exists.Should().BeFalse();
|
||||
result.IsError.Should().BeFalse();
|
||||
result.Value.Exists.Should().BeFalse();
|
||||
_mockPathService.Received(1).Exists(query.Path!);
|
||||
}
|
||||
|
||||
@@ -98,10 +103,11 @@ public class CheckPathExistsQueryHandlerTests
|
||||
_mockPathService.Exists(Arg.Any<string>(), Arg.Any<bool>()).Returns(false);
|
||||
|
||||
// Act
|
||||
PathExistsResponse result = await _sut.Handle(query, CancellationToken.None);
|
||||
ErrorOr<PathExistsResponse> result = await _sut.Handle(query, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
result.Exists.Should().BeFalse();
|
||||
result.IsError.Should().BeFalse();
|
||||
result.Value.Exists.Should().BeFalse();
|
||||
_mockPathService.Received(1).Exists(Arg.Any<string>(), Arg.Any<bool>());
|
||||
}
|
||||
|
||||
@@ -114,10 +120,11 @@ public class CheckPathExistsQueryHandlerTests
|
||||
CancellationToken cancellationToken = new(true);
|
||||
|
||||
// Act
|
||||
PathExistsResponse result = await _sut.Handle(query, cancellationToken);
|
||||
ErrorOr<PathExistsResponse> result = await _sut.Handle(query, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
result.Exists.Should().BeTrue();
|
||||
result.IsError.Should().BeFalse();
|
||||
result.Value.Exists.Should().BeTrue();
|
||||
_mockPathService.Received(1).Exists(query.Path!);
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -1,4 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathExists;
|
||||
@@ -84,12 +85,12 @@ public class CheckPathExistsEndpointTests
|
||||
TaskCompletionSource<bool> cancellationRequested = new();
|
||||
|
||||
_mockSender.Send(Arg.Any<CheckPathExistsQuery>(), Arg.Any<CancellationToken>())
|
||||
.Returns(callInfo => new ValueTask<PathExistsResponse>(Task.Run(async () =>
|
||||
.Returns(callInfo => new ValueTask<ErrorOr<PathExistsResponse>>(Task.Run(async () =>
|
||||
{
|
||||
operationStarted.SetResult(true);
|
||||
await cancellationRequested.Task;
|
||||
callInfo.Arg<CancellationToken>().ThrowIfCancellationRequested();
|
||||
return new PathExistsResponse(true);
|
||||
return ErrorOrFactory.From(new PathExistsResponse(true));
|
||||
}, callInfo.Arg<CancellationToken>())));
|
||||
|
||||
// Act
|
||||
|
||||
Reference in new issue
Block a user