mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 04:11:10 +00:00
Standardizes the remaining boolean names across the stack
This commit is contained in:
1 parent
3e0c3b624f
commit
39f4a04459
40 files changed
+1062
-448
No files matched your search
+4
-4
@@ -76,11 +76,11 @@ public class GetDirectoriesQueryValidatorTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenIncludeHiddenElementsIsTrue_ShouldNotHaveValidationError()
|
||||
public void Validate_WhenShouldIncludeHiddenElementsIsTrue_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetDirectoriesQuery query = _getDirectoriesQueryFixture.Create();
|
||||
query = query with { IncludeHiddenElements = true };
|
||||
query = query with { ShouldIncludeHiddenElements = true };
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
@@ -90,11 +90,11 @@ public class GetDirectoriesQueryValidatorTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenIncludeHiddenElementsIsFalse_ShouldNotHaveValidationError()
|
||||
public void Validate_WhenShouldIncludeHiddenElementsIsFalse_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetDirectoriesQuery query = _getDirectoriesQueryFixture.Create();
|
||||
query = query with { IncludeHiddenElements = false };
|
||||
query = query with { ShouldIncludeHiddenElements = false };
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
|
||||
+4
-4
@@ -76,11 +76,11 @@ public class GetFilesQueryValidatorTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenIncludeHiddenElementsIsTrue_ShouldNotHaveValidationError()
|
||||
public void Validate_WhenShouldIncludeHiddenElementsIsTrue_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetFilesQuery query = _getFilesQueryFixture.Create();
|
||||
query = query with { IncludeHiddenElements = true };
|
||||
query = query with { ShouldIncludeHiddenElements = true };
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
@@ -90,11 +90,11 @@ public class GetFilesQueryValidatorTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenIncludeHiddenElementsIsFalse_ShouldNotHaveValidationError()
|
||||
public void Validate_WhenShouldIncludeHiddenElementsIsFalse_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetFilesQuery query = _getFilesQueryFixture.Create();
|
||||
query = query with { IncludeHiddenElements = false };
|
||||
query = query with { ShouldIncludeHiddenElements = false };
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
|
||||
+4
-4
@@ -76,11 +76,11 @@ public class GetTreeFilesQueryValidatorTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenIncludeHiddenElementsIsTrue_ShouldNotHaveValidationError()
|
||||
public void Validate_WhenShouldIncludeHiddenElementsIsTrue_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetTreeFilesQuery query = _getTreeFilesQueryFixture.Create();
|
||||
query = query with { IncludeHiddenElements = true };
|
||||
query = query with { ShouldIncludeHiddenElements = true };
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
@@ -90,11 +90,11 @@ public class GetTreeFilesQueryValidatorTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenIncludeHiddenElementsIsFalse_ShouldNotHaveValidationError()
|
||||
public void Validate_WhenShouldIncludeHiddenElementsIsFalse_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetTreeFilesQuery query = _getTreeFilesQueryFixture.Create();
|
||||
query = query with { IncludeHiddenElements = false };
|
||||
query = query with { ShouldIncludeHiddenElements = false };
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
|
||||
+4
-4
@@ -52,10 +52,10 @@ public class CheckPathExistsQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HandleAsync_WhenPathExistsAndIsHiddenAndIncludeHiddenElementsIsTrue_ShouldReturnTrueResponse()
|
||||
public async Task HandleAsync_WhenPathExistsAndIsHiddenAndShouldIncludeHiddenElementsIsTrue_ShouldReturnTrueResponse()
|
||||
{
|
||||
// Arrange
|
||||
CheckPathExistsQuery query = _checkPathExistsQueryFixture.Create(includeHiddenElements: true);
|
||||
CheckPathExistsQuery query = _checkPathExistsQueryFixture.Create(shouldIncludeHiddenElements: true);
|
||||
_mockPathService.Exists(query.Path!).Returns(true);
|
||||
|
||||
// Act
|
||||
@@ -68,10 +68,10 @@ public class CheckPathExistsQueryHandlerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HandleAsync_WhenPathExistsAndIsHiddenAndIncludeHiddenElementsIsFalse_ShouldReturnFalseResponse()
|
||||
public async Task HandleAsync_WhenPathExistsAndIsHiddenAndShouldIncludeHiddenElementsIsFalse_ShouldReturnFalseResponse()
|
||||
{
|
||||
// Arrange
|
||||
CheckPathExistsQuery query = _checkPathExistsQueryFixture.Create(includeHiddenElements: false);
|
||||
CheckPathExistsQuery query = _checkPathExistsQueryFixture.Create(shouldIncludeHiddenElements: false);
|
||||
_mockPathService.Exists(query.Path!, false).Returns(false);
|
||||
|
||||
// Act
|
||||
|
||||
+2
-2
@@ -105,7 +105,7 @@ public class DirectoryProviderServiceTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetSubdirectoryPaths_WhenIncludeHiddenElementsIsFalse_ShouldExcludeHiddenDirectories()
|
||||
public void GetSubdirectoryPaths_WhenShouldIncludeHiddenElementsIsFalse_ShouldExcludeHiddenDirectories()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemPathId path = _fileSystemPathIdFixture.Create();
|
||||
@@ -126,7 +126,7 @@ public class DirectoryProviderServiceTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetSubdirectoryPaths_WhenIncludeHiddenElementsIsTrue_ShouldIncludeHiddenDirectories()
|
||||
public void GetSubdirectoryPaths_WhenShouldIncludeHiddenElementsIsTrue_ShouldIncludeHiddenDirectories()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemPathId path = _fileSystemPathIdFixture.Create();
|
||||
|
||||
+2
-2
@@ -89,7 +89,7 @@ public class FileProviderServiceTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetFilePaths_WhenIncludeHiddenElementsIsFalse_ShouldExcludeHiddenFiles()
|
||||
public void GetFilePaths_WhenShouldIncludeHiddenElementsIsFalse_ShouldExcludeHiddenFiles()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemPathId path = _fileSystemPathIdFixture.Create();
|
||||
@@ -109,7 +109,7 @@ public class FileProviderServiceTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetFilePaths_WhenIncludeHiddenElementsIsTrue_ShouldIncludeHiddenFiles()
|
||||
public void GetFilePaths_WhenShouldIncludeHiddenElementsIsTrue_ShouldIncludeHiddenFiles()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemPathId path = _fileSystemPathIdFixture.Create();
|
||||
|
||||
+48
-2
@@ -131,7 +131,7 @@ public class PathServiceTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Exists_WhenPathIsHiddenAndIncludeHiddenElementsIsTrue_ShouldReturnTrue()
|
||||
public void Exists_WhenPathIsHiddenAndShouldIncludeHiddenElementsIsTrue_ShouldReturnTrue()
|
||||
{
|
||||
// Arrange
|
||||
string existingPath = @"C:\ExistingPath";
|
||||
@@ -147,7 +147,7 @@ public class PathServiceTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Exists_WhenPathIsHiddenAndIncludeHiddenElementsIsFalse_ShouldReturnFalse()
|
||||
public void Exists_WhenPathIsHiddenAndShouldIncludeHiddenElementsIsFalse_ShouldReturnFalse()
|
||||
{
|
||||
// Arrange
|
||||
string existingPath = @"C:\ExistingPath";
|
||||
@@ -771,4 +771,50 @@ public class PathServiceTests
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.Equal(100, result.Value.Name.Length);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsPathWithin_WhenBothPathsAreValid_ShouldCreatePathIdsAndDelegateToTheStrategy()
|
||||
{
|
||||
// Arrange
|
||||
string path = @"C:\Media\Books\book.epub";
|
||||
string parentPath = @"C:\Media\Books";
|
||||
_mockPathStrategy.IsPathWithin(Arg.Any<FileSystemPathId>(), Arg.Any<FileSystemPathId>()).Returns(true);
|
||||
|
||||
// Act
|
||||
bool result = _sut.IsPathWithin(path, parentPath);
|
||||
|
||||
// Assert
|
||||
Assert.True(result);
|
||||
_mockPathStrategy.Received(1).IsPathWithin(
|
||||
Arg.Is<FileSystemPathId>(pathId => pathId.Path == path),
|
||||
Arg.Is<FileSystemPathId>(pathId => pathId.Path == parentPath));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
public void IsPathWithin_WhenPathIsNotValid_ShouldReturnFalseWithoutCallingTheStrategy(string? invalidPath)
|
||||
{
|
||||
// Act
|
||||
bool result = _sut.IsPathWithin(invalidPath!, @"C:\Media");
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
_mockPathStrategy.DidNotReceive().IsPathWithin(Arg.Any<FileSystemPathId>(), Arg.Any<FileSystemPathId>());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
public void IsPathWithin_WhenParentPathIsNotValid_ShouldReturnFalseWithoutCallingTheStrategy(string? invalidParentPath)
|
||||
{
|
||||
// Act
|
||||
bool result = _sut.IsPathWithin(@"C:\Media\Books\book.epub", invalidParentPath!);
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
_mockPathStrategy.DidNotReceive().IsPathWithin(Arg.Any<FileSystemPathId>(), Arg.Any<FileSystemPathId>());
|
||||
}
|
||||
}
|
||||
+40
-2
@@ -120,7 +120,7 @@ public class UnixPathStrategyTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Exists_WhenPathExistsAndIsHiddenAndIncludeHiddenElementsIsTrue_ShouldReturnTrue()
|
||||
public void Exists_WhenPathExistsAndIsHiddenAndShouldIncludeHiddenElementsIsTrue_ShouldReturnTrue()
|
||||
{
|
||||
// Arrange
|
||||
string existingPath = "/home/user/existing_file.txt";
|
||||
@@ -138,7 +138,7 @@ public class UnixPathStrategyTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Exists_WhenPathExistsAndIsHiddenAndIncludeHiddenElementsIsFalse_ShouldReturnFalse()
|
||||
public void Exists_WhenPathExistsAndIsHiddenAndShouldIncludeHiddenElementsIsFalse_ShouldReturnFalse()
|
||||
{
|
||||
// Arrange
|
||||
string existingPath = "/home/user/existing_file.txt";
|
||||
@@ -596,4 +596,42 @@ public class UnixPathStrategyTests
|
||||
Assert.True(result.IsFailure);
|
||||
Assert.Equal(Errors.FileSystemManagement.InvalidPath, result.FirstError);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("/media/books", "/media/books/book.epub")] // direct child
|
||||
[InlineData("/media", "/media/books/book.epub")] // nested descendant
|
||||
[InlineData("/media/books/", "/media/books/book.epub")] // trailing separator on the parent
|
||||
[InlineData("/media/books", "/media/books/sub/../book.epub")] // relative segments that stay inside
|
||||
public void IsPathWithin_WithContainedPaths_ShouldReturnTrue(string parentPath, string path)
|
||||
{
|
||||
// Arrange
|
||||
FileSystemPathId parentPathId = _fileSystemPathIdFixture.Create(parentPath);
|
||||
FileSystemPathId pathId = _fileSystemPathIdFixture.Create(path);
|
||||
|
||||
// Act
|
||||
bool result = _sut.IsPathWithin(pathId, parentPathId);
|
||||
|
||||
// Assert
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("/media/books", "/media/book.epub")] // sibling directory
|
||||
[InlineData("/media/books", "/Media/Books/book.epub")] // Unix paths are case-sensitive
|
||||
[InlineData("/media/books", "/media/other/book.epub")] // sibling directory
|
||||
[InlineData("/media/books", "/media/books/../other/book.epub")] // relative segment that escapes the parent
|
||||
[InlineData("/media/books", "/etc/passwd")] // unrelated location
|
||||
[InlineData("/media", "/media")] // the parent itself is not inside itself
|
||||
public void IsPathWithin_WithPathsOutsideTheParent_ShouldReturnFalse(string parentPath, string path)
|
||||
{
|
||||
// Arrange
|
||||
FileSystemPathId parentPathId = _fileSystemPathIdFixture.Create(parentPath);
|
||||
FileSystemPathId pathId = _fileSystemPathIdFixture.Create(path);
|
||||
|
||||
// Act
|
||||
bool result = _sut.IsPathWithin(pathId, parentPathId);
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
}
|
||||
}
|
||||
+42
-2
@@ -148,7 +148,7 @@ public class WindowsPathStrategyTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Exists_WhenPathExistsAndIsHiddenAndIncludeHiddenElementsIsTrue_ShouldReturnTrue()
|
||||
public void Exists_WhenPathExistsAndIsHiddenAndShouldIncludeHiddenElementsIsTrue_ShouldReturnTrue()
|
||||
{
|
||||
// Arrange
|
||||
string existingPath = @"C:\Users\User\existing_file.txt";
|
||||
@@ -165,7 +165,7 @@ public class WindowsPathStrategyTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Exists_WhenPathExistsAndIsHiddenAndIncludeHiddenElementsIsFalse_ShouldReturnFalse()
|
||||
public void Exists_WhenPathExistsAndIsHiddenAndShouldIncludeHiddenElementsIsFalse_ShouldReturnFalse()
|
||||
{
|
||||
// Arrange
|
||||
string existingPath = @"C:\Users\User\existing_file.txt";
|
||||
@@ -811,4 +811,44 @@ public class WindowsPathStrategyTests
|
||||
Assert.True(result.IsFailure);
|
||||
Assert.Equal(Errors.FileSystemManagement.InvalidPath, result.FirstError);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(@"C:\Media\Books", @"C:\Media\Books\book.epub")] // direct child
|
||||
[InlineData(@"C:\Media", @"C:\Media\Books\book.epub")] // nested descendant
|
||||
[InlineData(@"C:\Media\Books\", @"C:\Media\Books\book.epub")] // trailing separator on the parent
|
||||
[InlineData(@"C:\Media\Books", @"c:\media\books\book.epub")] // Windows paths are case-insensitive
|
||||
[InlineData(@"C:\Media\Books", @"C:\Media\Books\Sub\..\book.epub")] // relative segments that stay inside
|
||||
public void IsPathWithin_WithContainedPaths_ShouldReturnTrue(string parentPath, string path)
|
||||
{
|
||||
// Arrange
|
||||
FileSystemPathId parentPathId = _fileSystemPathIdFixture.Create(parentPath);
|
||||
FileSystemPathId pathId = _fileSystemPathIdFixture.Create(path);
|
||||
|
||||
// Act
|
||||
bool result = _sut.IsPathWithin(pathId, parentPathId);
|
||||
|
||||
// Assert
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(@"C:\Media\Books", @"C:\Media\book.epub")] // sibling directory
|
||||
[InlineData(@"C:\Media\Books", @"D:\Media\Books\book.epub")] // different drive
|
||||
[InlineData(@"C:\Media\Books", @"C:\Media\BookShelf\book.epub")] // a sibling whose name shares the prefix
|
||||
[InlineData(@"C:\Media\Books", @"C:\Media\Other\book.epub")] // sibling directory
|
||||
[InlineData(@"C:\Media\Books", @"C:\Media\Books\..\Other\book.epub")] // relative segment that escapes the parent
|
||||
[InlineData(@"C:\Media\Books", @"C:\Windows\System32\config\SAM")] // unrelated location
|
||||
[InlineData(@"C:\Media", @"C:\Media")] // the parent itself is not inside itself
|
||||
public void IsPathWithin_WithPathsOutsideTheParent_ShouldReturnFalse(string parentPath, string path)
|
||||
{
|
||||
// Arrange
|
||||
FileSystemPathId parentPathId = _fileSystemPathIdFixture.Create(parentPath);
|
||||
FileSystemPathId pathId = _fileSystemPathIdFixture.Create(path);
|
||||
|
||||
// Act
|
||||
bool result = _sut.IsPathWithin(pathId, parentPathId);
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -60,7 +60,7 @@ public class GetDirectoriesEndpointTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsError_ShouldReturnProblemResult()
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsNotFoundError_ShouldReturnProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
GetDirectoriesRequest request = _getDirectoriesRequestFixture.Create();
|
||||
@@ -86,7 +86,7 @@ public class GetDirectoriesEndpointTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsValidationError_ShouldReturnValidationProblemResult()
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsValidationErrors_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
GetDirectoriesRequest request = _getDirectoriesRequestFixture.Create();
|
||||
@@ -112,7 +112,7 @@ public class GetDirectoriesEndpointTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalled_ShouldSendGetDirectoriesQueryToHandler()
|
||||
public async Task ExecuteAsync_WhenCalled_ShouldSendGetDirectoriesQueryToSender()
|
||||
{
|
||||
// Arrange
|
||||
GetDirectoriesRequest request = _getDirectoriesRequestFixture.Create();
|
||||
@@ -125,7 +125,7 @@ public class GetDirectoriesEndpointTests
|
||||
|
||||
// Assert
|
||||
await _mockHandler.Received(1).HandleAsync(
|
||||
Arg.Is<GetDirectoriesQuery>(q => q.Path == request.Path && q.IncludeHiddenElements == request.IncludeHiddenElements),
|
||||
Arg.Is<GetDirectoriesQuery>(q => q.Path == request.Path && q.ShouldIncludeHiddenElements == request.ShouldIncludeHiddenElements),
|
||||
Arg.Is(cancellationToken));
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -60,7 +60,7 @@ public class GetFilesEndpointTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsError_ShouldReturnProblemResult()
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsNotFoundError_ShouldReturnProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
GetFilesRequest request = _getFilesRequestFixture.Create();
|
||||
@@ -86,7 +86,7 @@ public class GetFilesEndpointTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsValidationError_ShouldReturnValidationProblemResult()
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsValidationErrors_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
GetFilesRequest request = _getFilesRequestFixture.Create();
|
||||
@@ -126,7 +126,7 @@ public class GetFilesEndpointTests
|
||||
// Assert
|
||||
await _mockHandler.Received(1).HandleAsync(Arg.Is<GetFilesQuery>(q =>
|
||||
q.Path == request.Path &&
|
||||
q.IncludeHiddenElements == request.IncludeHiddenElements),
|
||||
q.ShouldIncludeHiddenElements == request.ShouldIncludeHiddenElements),
|
||||
Arg.Is(cancellationToken));
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -60,7 +60,7 @@ public class GetTreeFilesEndpointTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsError_ShouldReturnProblemResult()
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsNotFoundError_ShouldReturnProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
GetTreeFilesRequest request = _getTreeFilesRequestFixture.Create();
|
||||
@@ -86,7 +86,7 @@ public class GetTreeFilesEndpointTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsValidationError_ShouldReturnValidationProblemResult()
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsValidationErrors_ShouldReturnValidationProblemResult()
|
||||
{
|
||||
// Arrange
|
||||
GetTreeFilesRequest request = _getTreeFilesRequestFixture.Create();
|
||||
@@ -126,7 +126,7 @@ public class GetTreeFilesEndpointTests
|
||||
// Assert
|
||||
await _mockHandler.Received(1).HandleAsync(Arg.Is<GetTreeFilesQuery>(q =>
|
||||
q.Path == request.Path &&
|
||||
q.IncludeHiddenElements == request.IncludeHiddenElements),
|
||||
q.ShouldIncludeHiddenElements == request.ShouldIncludeHiddenElements),
|
||||
Arg.Is(cancellationToken));
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -43,7 +43,7 @@ public class CheckPathExistsEndpointTests
|
||||
public async Task ExecuteAsync_WhenCalled_ShouldReturnOkResultWithPathExistsResponse()
|
||||
{
|
||||
// Arrange
|
||||
CheckPathExistsRequest request = _checkPathExistsRequestFixture.Create(path: @"C:\Users\TestUser\Documents", includeHiddenElements: true);
|
||||
CheckPathExistsRequest request = _checkPathExistsRequestFixture.Create(path: @"C:\Users\TestUser\Documents", shouldIncludeHiddenElements: true);
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
PathExistsResponse expectedResponse = _pathExistsResponseFixture.Create(exists: true);
|
||||
_mockHandler.HandleAsync(Arg.Any<CheckPathExistsQuery>(), Arg.Any<CancellationToken>())
|
||||
@@ -58,10 +58,10 @@ public class CheckPathExistsEndpointTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenCalled_ShouldSendCheckPathExistsQueryToHandler()
|
||||
public async Task ExecuteAsync_WhenCalled_ShouldSendCheckPathExistsQueryToSender()
|
||||
{
|
||||
// Arrange
|
||||
CheckPathExistsRequest request = _checkPathExistsRequestFixture.Create(path: @"C:\Users\TestUser\Documents", includeHiddenElements: true);
|
||||
CheckPathExistsRequest request = _checkPathExistsRequestFixture.Create(path: @"C:\Users\TestUser\Documents", shouldIncludeHiddenElements: true);
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
_mockHandler.HandleAsync(Arg.Any<CheckPathExistsQuery>(), Arg.Any<CancellationToken>())
|
||||
.Returns(_pathExistsResponseFixture.Create(exists: true));
|
||||
@@ -71,7 +71,7 @@ public class CheckPathExistsEndpointTests
|
||||
|
||||
// Assert
|
||||
await _mockHandler.Received(1).HandleAsync(
|
||||
Arg.Is<CheckPathExistsQuery>(q => q.Path == request.Path && q.IncludeHiddenElements == request.IncludeHiddenElements),
|
||||
Arg.Is<CheckPathExistsQuery>(q => q.Path == request.Path && q.ShouldIncludeHiddenElements == request.ShouldIncludeHiddenElements),
|
||||
Arg.Is(cancellationToken));
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class CheckPathExistsEndpointTests
|
||||
public async Task ExecuteAsync_WhenCancellationRequested_ShouldCancelOperation()
|
||||
{
|
||||
// Arrange
|
||||
CheckPathExistsRequest request = _checkPathExistsRequestFixture.Create(path: @"C:\Users\TestUser\Documents", includeHiddenElements: true);
|
||||
CheckPathExistsRequest request = _checkPathExistsRequestFixture.Create(path: @"C:\Users\TestUser\Documents", shouldIncludeHiddenElements: true);
|
||||
CancellationTokenSource cts = new();
|
||||
TaskCompletionSource<bool> operationStarted = new();
|
||||
TaskCompletionSource<bool> cancellationRequested = new();
|
||||
|
||||
Reference in new issue
Block a user