mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 09:11:10 +00:00
Merge pull request #21 from BinaryAlley/feature/add-hidden-elements-option-to-file-system-browser
Adds hidden elements option to file system browser directories and paths
This commit is contained in:
18 files changed
+217
-59
No files matched your search
+18
-14
@@ -67,7 +67,7 @@ public class GetDirectoryTreeQueryHandler : IRequestHandler<GetDirectoryTreeQuer
|
|||||||
|
|
||||||
List<PathSegment> pathParts = pathPartsResults.Value.ToList();
|
List<PathSegment> pathParts = pathPartsResults.Value.ToList();
|
||||||
|
|
||||||
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> buildDirectoryTreeResult = BuildDirectoryTree(result, pathParts, out FileSystemTreeNodeResponse? currentNode);
|
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> buildDirectoryTreeResult = BuildDirectoryTree(result, pathParts, out FileSystemTreeNodeResponse? currentNode, request.IncludeHiddenElements);
|
||||||
if (buildDirectoryTreeResult.IsError)
|
if (buildDirectoryTreeResult.IsError)
|
||||||
return buildDirectoryTreeResult.Errors;
|
return buildDirectoryTreeResult.Errors;
|
||||||
|
|
||||||
@@ -97,10 +97,11 @@ public class GetDirectoryTreeQueryHandler : IRequestHandler<GetDirectoryTreeQuer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="drives">The list of available drives.</param>
|
/// <param name="drives">The list of available drives.</param>
|
||||||
/// <param name="pathParts">The list of parsed path segments (directories).</param>
|
/// <param name="pathParts">The list of parsed path segments (directories).</param>
|
||||||
|
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// An <see cref="ErrorOr{TValue}"/> containing a list of <see cref="FileSystemTreeNodeResponse"/> representing the directory tree, or an error message.
|
/// An <see cref="ErrorOr{TValue}"/> containing a list of <see cref="FileSystemTreeNodeResponse"/> representing the directory tree, or an error message.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
private ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> BuildDirectoryTree(List<FileSystemTreeNodeResponse> drives, List<PathSegment> pathParts, out FileSystemTreeNodeResponse currentNode)
|
private ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> BuildDirectoryTree(List<FileSystemTreeNodeResponse> drives, List<PathSegment> pathParts, out FileSystemTreeNodeResponse currentNode, bool includeHiddenElements = true)
|
||||||
{
|
{
|
||||||
// find the root drive that matches the first part of the path
|
// find the root drive that matches the first part of the path
|
||||||
FileSystemTreeNodeResponse drive = drives.First(drive => drive.Name.Contains(pathParts[0].Name));
|
FileSystemTreeNodeResponse drive = drives.First(drive => drive.Name.Contains(pathParts[0].Name));
|
||||||
@@ -114,18 +115,21 @@ public class GetDirectoryTreeQueryHandler : IRequestHandler<GetDirectoryTreeQuer
|
|||||||
ErrorOr<string> combinedPathResult = _pathService.CombinePath(currentPath, pathParts[i].Name);
|
ErrorOr<string> combinedPathResult = _pathService.CombinePath(currentPath, pathParts[i].Name);
|
||||||
if (combinedPathResult.IsError)
|
if (combinedPathResult.IsError)
|
||||||
return combinedPathResult.Errors;
|
return combinedPathResult.Errors;
|
||||||
|
if (_pathService.Exists(combinedPathResult.Value, includeHiddenElements))
|
||||||
currentPath = combinedPathResult.Value;
|
|
||||||
// create a new node for the directory and add it as a child of the current node
|
|
||||||
FileSystemTreeNodeResponse newNode = new()
|
|
||||||
{
|
{
|
||||||
Path = currentPath,
|
|
||||||
Name = pathParts[i].Name,
|
currentPath = combinedPathResult.Value;
|
||||||
ItemType = FileSystemItemType.Directory,
|
// create a new node for the directory and add it as a child of the current node
|
||||||
IsExpanded = true
|
FileSystemTreeNodeResponse newNode = new()
|
||||||
};
|
{
|
||||||
currentNode.Children.Add(newNode);
|
Path = currentPath,
|
||||||
currentNode = newNode; // move to the new node
|
Name = pathParts[i].Name,
|
||||||
|
ItemType = FileSystemItemType.Directory,
|
||||||
|
IsExpanded = true
|
||||||
|
};
|
||||||
|
currentNode.Children.Add(newNode);
|
||||||
|
currentNode = newNode; // move to the new node
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return new List<FileSystemTreeNodeResponse> { drive };
|
return new List<FileSystemTreeNodeResponse> { drive };
|
||||||
}
|
}
|
||||||
@@ -143,7 +147,7 @@ public class GetDirectoryTreeQueryHandler : IRequestHandler<GetDirectoryTreeQuer
|
|||||||
if (subDirectoriesResult.IsError)
|
if (subDirectoriesResult.IsError)
|
||||||
return subDirectoriesResult.Errors;
|
return subDirectoriesResult.Errors;
|
||||||
// add each subdirectory as a child node of the current directory
|
// add each subdirectory as a child node of the current directory
|
||||||
foreach (Directory subDirectory in subDirectoriesResult.Value)
|
foreach (Directory subDirectory in subDirectoriesResult.Value ?? [])
|
||||||
{
|
{
|
||||||
FileSystemTreeNodeResponse subDirNode = new()
|
FileSystemTreeNodeResponse subDirNode = new()
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-2
@@ -1,4 +1,4 @@
|
|||||||
#region ========================================================================= USING =====================================================================================
|
#region ========================================================================= USING =====================================================================================
|
||||||
using Lumina.Contracts.Responses.FileManagement;
|
using Lumina.Contracts.Responses.FileManagement;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
#endregion
|
#endregion
|
||||||
@@ -9,4 +9,5 @@ namespace Lumina.Application.Core.FileManagement.Paths.Queries.CheckPathExists;
|
|||||||
/// Query for retrieving the existence of a file system path.
|
/// Query for retrieving the existence of a file system path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Path">The path for which to check the existence.</param>
|
/// <param name="Path">The path for which to check the existence.</param>
|
||||||
public record CheckPathExistsQuery(string Path) : IRequest<PathExistsResponse>;
|
/// <param name="IncludeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||||
|
public record CheckPathExistsQuery(string Path, bool IncludeHiddenElements) : IRequest<PathExistsResponse>;
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
#region ========================================================================= USING =====================================================================================
|
#region ========================================================================= USING =====================================================================================
|
||||||
using Lumina.Contracts.Responses.FileManagement;
|
using Lumina.Contracts.Responses.FileManagement;
|
||||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
@@ -39,7 +39,7 @@ public class CheckPathExistsQueryHandler : IRequestHandler<CheckPathExistsQuery,
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public ValueTask<PathExistsResponse> Handle(CheckPathExistsQuery request, CancellationToken cancellationToken)
|
public ValueTask<PathExistsResponse> Handle(CheckPathExistsQuery request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return ValueTask.FromResult(new PathExistsResponse(_pathService.Exists(request.Path)));
|
return ValueTask.FromResult(new PathExistsResponse(_pathService.Exists(request.Path, request.IncludeHiddenElements)));
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
+4
-3
@@ -1,4 +1,4 @@
|
|||||||
#region ========================================================================= USING =====================================================================================
|
#region ========================================================================= USING =====================================================================================
|
||||||
using ErrorOr;
|
using ErrorOr;
|
||||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -30,8 +30,9 @@ public interface IPathService
|
|||||||
/// Checks if <paramref name="path"/> exists.
|
/// Checks if <paramref name="path"/> exists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path to be checked.</param>
|
/// <param name="path">The path to be checked.</param>
|
||||||
|
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||||
/// <returns><see langword="true"/> if <paramref name="path"/> exists, <see langword="false"/> otherwise.</returns>
|
/// <returns><see langword="true"/> if <paramref name="path"/> exists, <see langword="false"/> otherwise.</returns>
|
||||||
bool Exists(string path);
|
bool Exists(string path, bool includeHiddenElements = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to combine <paramref name="path"/> with <paramref name="name"/>.
|
/// Tries to combine <paramref name="path"/> with <paramref name="name"/>.
|
||||||
@@ -68,4 +69,4 @@ public interface IPathService
|
|||||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing the root of <paramref name="path"/>, or an error.</returns>
|
/// <returns>An <see cref="ErrorOr{TValue}"/> containing the root of <paramref name="path"/>, or an error.</returns>
|
||||||
ErrorOr<PathSegment> GetPathRoot(string path);
|
ErrorOr<PathSegment> GetPathRoot(string path);
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
+3
-2
@@ -53,13 +53,14 @@ public class PathService : IPathService
|
|||||||
/// Checks if <paramref name="path"/> exists.
|
/// Checks if <paramref name="path"/> exists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path to be checked.</param>
|
/// <param name="path">The path to be checked.</param>
|
||||||
|
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||||
/// <returns><see langword="true"/> if <paramref name="path"/> exists, <see langword="false"/> otherwise.</returns>
|
/// <returns><see langword="true"/> if <paramref name="path"/> exists, <see langword="false"/> otherwise.</returns>
|
||||||
public bool Exists(string path)
|
public bool Exists(string path, bool includeHiddenElements = true)
|
||||||
{
|
{
|
||||||
ErrorOr<FileSystemPathId> newPathResult = FileSystemPathId.Create(path);
|
ErrorOr<FileSystemPathId> newPathResult = FileSystemPathId.Create(path);
|
||||||
if (newPathResult.IsError)
|
if (newPathResult.IsError)
|
||||||
return false;
|
return false;
|
||||||
return _platformContext.PathStrategy.Exists(newPathResult.Value);
|
return _platformContext.PathStrategy.Exists(newPathResult.Value, includeHiddenElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+4
-3
@@ -1,4 +1,4 @@
|
|||||||
#region ========================================================================= USING =====================================================================================
|
#region ========================================================================= USING =====================================================================================
|
||||||
using ErrorOr;
|
using ErrorOr;
|
||||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -27,8 +27,9 @@ public interface IPathStrategy
|
|||||||
/// Checks if <paramref name="path"/> exists.
|
/// Checks if <paramref name="path"/> exists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path to be checked.</param>
|
/// <param name="path">The path to be checked.</param>
|
||||||
|
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||||
/// <returns><see langword="true"/> if <paramref name="path"/> exists, <see langword="false"/> otherwise.</returns>
|
/// <returns><see langword="true"/> if <paramref name="path"/> exists, <see langword="false"/> otherwise.</returns>
|
||||||
bool Exists(FileSystemPathId path);
|
bool Exists(FileSystemPathId path, bool includeHiddenElements = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to combine <paramref name="path"/> with <paramref name="name"/>.
|
/// Tries to combine <paramref name="path"/> with <paramref name="name"/>.
|
||||||
@@ -65,4 +66,4 @@ public interface IPathStrategy
|
|||||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing the root of <paramref name="path"/>, or an error.</returns>
|
/// <returns>An <see cref="ErrorOr{TValue}"/> containing the root of <paramref name="path"/>, or an error.</returns>
|
||||||
ErrorOr<PathSegment> GetPathRoot(FileSystemPathId path);
|
ErrorOr<PathSegment> GetPathRoot(FileSystemPathId path);
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
+19
-2
@@ -4,6 +4,7 @@ using Lumina.Domain.Common.Errors;
|
|||||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.IO.Abstractions;
|
using System.IO.Abstractions;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -58,10 +59,26 @@ public class UnixPathStrategy : IUnixPathStrategy
|
|||||||
/// Checks if <paramref name="path"/> exists.
|
/// Checks if <paramref name="path"/> exists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path to be checked.</param>
|
/// <param name="path">The path to be checked.</param>
|
||||||
|
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||||
/// <returns><see langword="true"/> if <paramref name="path"/> exists, <see langword="false"/> otherwise.</returns>
|
/// <returns><see langword="true"/> if <paramref name="path"/> exists, <see langword="false"/> otherwise.</returns>
|
||||||
public bool Exists(FileSystemPathId path)
|
public bool Exists(FileSystemPathId path, bool includeHiddenElements = true)
|
||||||
{
|
{
|
||||||
return _fileSystem.Path.Exists(path.Path);
|
if (!_fileSystem.Path.Exists(path.Path))
|
||||||
|
return false;
|
||||||
|
bool isHidden;
|
||||||
|
if (_fileSystem.Directory.Exists(path.Path))
|
||||||
|
{
|
||||||
|
IDirectoryInfo dirInfo = _fileSystem.DirectoryInfo.New(path.Path);
|
||||||
|
isHidden = (dirInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
|
||||||
|
}
|
||||||
|
else if (_fileSystem.File.Exists(path.Path))
|
||||||
|
{
|
||||||
|
IFileInfo fileInfo = _fileSystem.FileInfo.New(path.Path);
|
||||||
|
isHidden = (fileInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
|
||||||
|
}
|
||||||
|
else // path exists but is neither a file nor a directory (drive, etc)
|
||||||
|
return true;
|
||||||
|
return includeHiddenElements || !isHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+19
-2
@@ -4,6 +4,7 @@ using Lumina.Domain.Common.Errors;
|
|||||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.IO.Abstractions;
|
using System.IO.Abstractions;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -57,10 +58,26 @@ public class WindowsPathStrategy : IWindowsPathStrategy
|
|||||||
/// Checks if <paramref name="path"/> exists.
|
/// Checks if <paramref name="path"/> exists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path to be checked.</param>
|
/// <param name="path">The path to be checked.</param>
|
||||||
|
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||||
/// <returns><see langword="true"/> if <paramref name="path"/> exists, <see langword="false"/> otherwise.</returns>
|
/// <returns><see langword="true"/> if <paramref name="path"/> exists, <see langword="false"/> otherwise.</returns>
|
||||||
public bool Exists(FileSystemPathId path)
|
public bool Exists(FileSystemPathId path, bool includeHiddenElements = true)
|
||||||
{
|
{
|
||||||
return _fileSystem.Path.Exists(path.Path);
|
if (!_fileSystem.Path.Exists(path.Path))
|
||||||
|
return false;
|
||||||
|
bool isHidden;
|
||||||
|
if (_fileSystem.Directory.Exists(path.Path))
|
||||||
|
{
|
||||||
|
IDirectoryInfo dirInfo = _fileSystem.DirectoryInfo.New(path.Path);
|
||||||
|
isHidden = (dirInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
|
||||||
|
}
|
||||||
|
else if (_fileSystem.File.Exists(path.Path))
|
||||||
|
{
|
||||||
|
IFileInfo fileInfo = _fileSystem.FileInfo.New(path.Path);
|
||||||
|
isHidden = (fileInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
|
||||||
|
}
|
||||||
|
else // path exists but is neither a file nor a directory (drive, etc)
|
||||||
|
return true;
|
||||||
|
return includeHiddenElements || !isHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -118,11 +118,12 @@ public class PathController : ApiController
|
|||||||
/// Checks whether <paramref name="path"/> exists or not.
|
/// Checks whether <paramref name="path"/> exists or not.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path to be checked.</param>
|
/// <param name="path">The path to be checked.</param>
|
||||||
|
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||||
[HttpGet("check-path-exists")]
|
[HttpGet("check-path-exists")]
|
||||||
public async Task<IActionResult> CheckPathExists([FromQuery, ModelBinder(typeof(UrlStringBinder))] string path, CancellationToken cancellationToken)
|
public async Task<IActionResult> CheckPathExists([FromQuery, ModelBinder(typeof(UrlStringBinder))] string path, [FromQuery] bool includeHiddenElements, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
PathExistsResponse result = await _mediator.Send(new CheckPathExistsQuery(path), cancellationToken).ConfigureAwait(false);
|
PathExistsResponse result = await _mediator.Send(new CheckPathExistsQuery(path, includeHiddenElements), cancellationToken).ConfigureAwait(false);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -94,11 +94,12 @@ public class PathController : Controller
|
|||||||
/// Checks whether <paramref name="path"/> exists or not.
|
/// Checks whether <paramref name="path"/> exists or not.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path to be checked.</param>
|
/// <param name="path">The path to be checked.</param>
|
||||||
|
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||||
[HttpGet("check-path-exists")]
|
[HttpGet("check-path-exists")]
|
||||||
public async Task<IActionResult> CheckPathExists([FromQuery] string path, CancellationToken cancellationToken)
|
public async Task<IActionResult> CheckPathExists([FromQuery] string path, [FromQuery] bool includeHiddenElements, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
PathExistsModel response = await _apiHttpClient.GetAsync<PathExistsModel>($"path/check-path-exists?path={Uri.EscapeDataString(path)}", cancellationToken: cancellationToken);
|
PathExistsModel response = await _apiHttpClient.GetAsync<PathExistsModel>($"path/check-path-exists?path={Uri.EscapeDataString(path)}&includeHiddenElements={includeHiddenElements}", cancellationToken: cancellationToken);
|
||||||
return Json(new { success = true, data = new { exists = response.Exists } });
|
return Json(new { success = true, data = new { exists = response.Exists } });
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ async function checkPathAsync(path) {
|
|||||||
if (addressBarInput.value !== null && !addressBarInput.value.endsWith(pathSeparator))
|
if (addressBarInput.value !== null && !addressBarInput.value.endsWith(pathSeparator))
|
||||||
addressBarInput.value += pathSeparator;
|
addressBarInput.value += pathSeparator;
|
||||||
} else {
|
} else {
|
||||||
const pathExistsResponse = await callApiGetAsync(`${clientBasePath}path/check-path-exists?path=${encodeURIComponent(path)}`);
|
const pathExistsResponse = await callApiGetAsync(`${clientBasePath}path/check-path-exists?path=${encodeURIComponent(path)}&includeHiddenElements=${showHiddenElements}`);
|
||||||
if (pathExistsResponse !== undefined && !pathExistsResponse.exists) {
|
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
|
notificationService.show("Specified path does not exist!", NotificationType.ERROR); // TODO: should ask error message from server when translation is implemented
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+4
-2
@@ -196,10 +196,10 @@ public class GetDirectoryTreeQueryHandlerTests
|
|||||||
IEnumerable<PathSegment> pathSegments = new[] { firstPathSegment }.Concat(_pathSegmentFixture.CreateMany(2));
|
IEnumerable<PathSegment> pathSegments = new[] { firstPathSegment }.Concat(_pathSegmentFixture.CreateMany(2));
|
||||||
Error error = Error.Failure("PathService.Error", "An error occurred");
|
Error error = Error.Failure("PathService.Error", "An error occurred");
|
||||||
|
|
||||||
_mockDriveService.GetDrives().Returns(ErrorOrFactory.From(drives));
|
_mockDriveService.GetDrives().Returns(ErrorOrFactory.From(drives));
|
||||||
_mockPathService.ParsePath(query.Path).Returns(ErrorOrFactory.From(pathSegments));
|
_mockPathService.ParsePath(query.Path).Returns(ErrorOrFactory.From(pathSegments));
|
||||||
_mockPathService.CombinePath(Arg.Any<string>(), Arg.Any<string>()).Returns(error);
|
_mockPathService.CombinePath(Arg.Any<string>(), Arg.Any<string>()).Returns(error);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> result = await _sut.Handle(query, CancellationToken.None);
|
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> result = await _sut.Handle(query, CancellationToken.None);
|
||||||
|
|
||||||
@@ -313,6 +313,7 @@ public class GetDirectoryTreeQueryHandlerTests
|
|||||||
|
|
||||||
_mockDriveService.GetDrives().Returns(ErrorOrFactory.From(drives));
|
_mockDriveService.GetDrives().Returns(ErrorOrFactory.From(drives));
|
||||||
_mockPathService.ParsePath(query.Path).Returns(ErrorOrFactory.From((IEnumerable<PathSegment>)pathSegments));
|
_mockPathService.ParsePath(query.Path).Returns(ErrorOrFactory.From((IEnumerable<PathSegment>)pathSegments));
|
||||||
|
_mockPathService.Exists(Arg.Any<string>(), Arg.Any<bool>()).Returns(true);
|
||||||
_mockPathService.CombinePath(Arg.Any<string>(), Arg.Any<string>())
|
_mockPathService.CombinePath(Arg.Any<string>(), Arg.Any<string>())
|
||||||
.Returns(callInfo => $"{callInfo.ArgAt<string>(0)}\\{callInfo.ArgAt<string>(1)}");
|
.Returns(callInfo => $"{callInfo.ArgAt<string>(0)}\\{callInfo.ArgAt<string>(1)}");
|
||||||
|
|
||||||
@@ -350,6 +351,7 @@ public class GetDirectoryTreeQueryHandlerTests
|
|||||||
];
|
];
|
||||||
|
|
||||||
_mockDriveService.GetDrives().Returns(ErrorOrFactory.From(drives));
|
_mockDriveService.GetDrives().Returns(ErrorOrFactory.From(drives));
|
||||||
|
_mockPathService.Exists(Arg.Any<string>(), Arg.Any<bool>()).Returns(true);
|
||||||
_mockPathService.ParsePath(query.Path).Returns(ErrorOrFactory.From((IEnumerable<PathSegment>)pathSegments));
|
_mockPathService.ParsePath(query.Path).Returns(ErrorOrFactory.From((IEnumerable<PathSegment>)pathSegments));
|
||||||
_mockPathService.CombinePath(Arg.Any<string>(), Arg.Any<string>())
|
_mockPathService.CombinePath(Arg.Any<string>(), Arg.Any<string>())
|
||||||
.Returns(callInfo => $"{callInfo.ArgAt<string>(0)}\\{callInfo.ArgAt<string>(1)}");
|
.Returns(callInfo => $"{callInfo.ArgAt<string>(0)}\\{callInfo.ArgAt<string>(1)}");
|
||||||
|
|||||||
+34
-4
@@ -36,7 +36,7 @@ public class CheckPathExistsQueryHandlerTests
|
|||||||
|
|
||||||
#region ===================================================================== METHODS ===================================================================================
|
#region ===================================================================== METHODS ===================================================================================
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Handle_WhenPathExists_ShouldReturnTrueResponse()
|
public async Task Handle_WhenPathExistsAndIsNotHidden_ShouldReturnTrueResponse()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
CheckPathExistsQuery query = CheckPathExistsQueryFixture.CreateCheckPathExistsQuery();
|
CheckPathExistsQuery query = CheckPathExistsQueryFixture.CreateCheckPathExistsQuery();
|
||||||
@@ -50,6 +50,36 @@ public class CheckPathExistsQueryHandlerTests
|
|||||||
_mockPathService.Received(1).Exists(query.Path);
|
_mockPathService.Received(1).Exists(query.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Handle_WhenPathExistsAndIsHiddenAndIncludeHiddenElementsIsTrue_ShouldReturnTrueResponse()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
CheckPathExistsQuery query = CheckPathExistsQueryFixture.CreateCheckPathExistsQuery(true);
|
||||||
|
_mockPathService.Exists(query.Path).Returns(true);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
PathExistsResponse result = await _sut.Handle(query, CancellationToken.None);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
result.Exists.Should().BeTrue();
|
||||||
|
_mockPathService.Received(1).Exists(query.Path);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Handle_WhenPathExistsAndIsHiddenAndIncludeHiddenElementsIsFalse_ShouldReturnFalseResponse()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
CheckPathExistsQuery query = CheckPathExistsQueryFixture.CreateCheckPathExistsQuery(false);
|
||||||
|
_mockPathService.Exists(query.Path, false).Returns(false);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
PathExistsResponse result = await _sut.Handle(query, CancellationToken.None);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
result.Exists.Should().BeFalse();
|
||||||
|
_mockPathService.Received(1).Exists(query.Path, false);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Handle_WhenPathDoesNotExist_ShouldReturnFalseResponse()
|
public async Task Handle_WhenPathDoesNotExist_ShouldReturnFalseResponse()
|
||||||
{
|
{
|
||||||
@@ -69,15 +99,15 @@ public class CheckPathExistsQueryHandlerTests
|
|||||||
public async Task Handle_WhenCalledWithNullPath_ShouldStillCallPathService()
|
public async Task Handle_WhenCalledWithNullPath_ShouldStillCallPathService()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
CheckPathExistsQuery query = new(null!);
|
CheckPathExistsQuery query = new(null!, false);
|
||||||
_mockPathService.Exists(Arg.Any<string>()).Returns(false);
|
_mockPathService.Exists(Arg.Any<string>(), Arg.Any<bool>()).Returns(false);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
PathExistsResponse result = await _sut.Handle(query, CancellationToken.None);
|
PathExistsResponse result = await _sut.Handle(query, CancellationToken.None);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Exists.Should().BeFalse();
|
result.Exists.Should().BeFalse();
|
||||||
_mockPathService.Received(1).Exists(Arg.Any<string>());
|
_mockPathService.Received(1).Exists(Arg.Any<string>(), Arg.Any<bool>());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
+6
-3
@@ -16,14 +16,17 @@ public class CheckPathExistsQueryFixture
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a random valid query to check if paths exist.
|
/// Creates a random valid query to check if paths exist.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="includeHiddenElements">Whether to include hidden file system elements or not.</param>
|
||||||
/// <returns>The created query.</returns>
|
/// <returns>The created query.</returns>
|
||||||
public static CheckPathExistsQuery CreateCheckPathExistsQuery()
|
public static CheckPathExistsQuery CreateCheckPathExistsQuery(bool includeHiddenElements = true)
|
||||||
{
|
{
|
||||||
return new Faker<CheckPathExistsQuery>()
|
return new Faker<CheckPathExistsQuery>()
|
||||||
.CustomInstantiator(f => new CheckPathExistsQuery(
|
.CustomInstantiator(f => new CheckPathExistsQuery(
|
||||||
default!
|
default!,
|
||||||
|
default
|
||||||
))
|
))
|
||||||
.RuleFor(x => x.Path, f => f.System.FilePath());
|
.RuleFor(x => x.Path, f => f.System.FilePath())
|
||||||
|
.RuleFor(x => x.IncludeHiddenElements, includeHiddenElements);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
+32
@@ -124,6 +124,38 @@ public class PathServiceTests
|
|||||||
_mockPathStrategy.Received(1).Exists(Arg.Is<FileSystemPathId>(id => id.Path == existingPath));
|
_mockPathStrategy.Received(1).Exists(Arg.Is<FileSystemPathId>(id => id.Path == existingPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Exists_WhenPathIsHiddenAndIncludeHiddenElementsIsTrue_ShouldReturnTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
string existingPath = @"C:\ExistingPath";
|
||||||
|
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(existingPath);
|
||||||
|
_mockPathStrategy.Exists(pathId, true).Returns(true);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
bool result = _sut.Exists(existingPath, true);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
result.Should().BeTrue();
|
||||||
|
_mockPathStrategy.Received(1).Exists(Arg.Is<FileSystemPathId>(id => id.Path == existingPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Exists_WhenPathIsHiddenAndIncludeHiddenElementsIsFalse_ShouldReturnFalse()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
string existingPath = @"C:\ExistingPath";
|
||||||
|
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(existingPath);
|
||||||
|
_mockPathStrategy.Exists(pathId, false).Returns(false);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
bool result = _sut.Exists(existingPath, false);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
result.Should().BeFalse();
|
||||||
|
_mockPathStrategy.Received(1).Exists(Arg.Is<FileSystemPathId>(id => id.Path == existingPath), false);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Exists_WithValidNonExistingPath_ShouldReturnFalse()
|
public void Exists_WithValidNonExistingPath_ShouldReturnFalse()
|
||||||
{
|
{
|
||||||
|
|||||||
+30
-6
@@ -128,18 +128,40 @@ public class UnixPathStrategyTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Exists_WhenPathExists_ShouldReturnTrue()
|
public void Exists_WhenPathExistsAndIsHiddenAndIncludeHiddenElementsIsTrue_ShouldReturnTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
string existingPath = "/home/user/existing_file.txt";
|
||||||
|
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(existingPath);
|
||||||
|
|
||||||
|
_mockFileSystem.Path.Exists(existingPath).Returns(true);
|
||||||
|
_mockFileSystem.File.Exists(existingPath).Returns(true);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
bool result = _sut.Exists(pathId, true);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
result.Should().BeTrue();
|
||||||
|
_mockFileSystem.Path.Received(1).Exists(existingPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Exists_WhenPathExistsAndIsHiddenAndIncludeHiddenElementsIsFalse_ShouldReturnFalse()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
string existingPath = "/home/user/existing_file.txt";
|
string existingPath = "/home/user/existing_file.txt";
|
||||||
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(existingPath);
|
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(existingPath);
|
||||||
_mockFileSystem.Path.Exists(existingPath).Returns(true);
|
_mockFileSystem.Path.Exists(existingPath).Returns(true);
|
||||||
|
_mockFileSystem.File.Exists(existingPath).Returns(true);
|
||||||
|
IFileInfo mockFileInfo = Substitute.For<IFileInfo>();
|
||||||
|
mockFileInfo.Attributes.Returns(System.IO.FileAttributes.Hidden);
|
||||||
|
_mockFileSystem.FileInfo.New(Arg.Any<string>()).Returns(mockFileInfo);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
bool result = _sut.Exists(pathId);
|
bool result = _sut.Exists(pathId, false);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeTrue();
|
result.Should().BeFalse();
|
||||||
_mockFileSystem.Path.Received(1).Exists(existingPath);
|
_mockFileSystem.Path.Received(1).Exists(existingPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +190,7 @@ public class UnixPathStrategyTests
|
|||||||
_mockFileSystem.Path.Exists(rootPath).Returns(true);
|
_mockFileSystem.Path.Exists(rootPath).Returns(true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
bool result = _sut.Exists(pathId);
|
bool result = _sut.Exists(pathId, true);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeTrue();
|
result.Should().BeTrue();
|
||||||
@@ -182,9 +204,10 @@ public class UnixPathStrategyTests
|
|||||||
string directoryPath = "/home/user/documents/";
|
string directoryPath = "/home/user/documents/";
|
||||||
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(directoryPath);
|
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(directoryPath);
|
||||||
_mockFileSystem.Path.Exists(directoryPath).Returns(true);
|
_mockFileSystem.Path.Exists(directoryPath).Returns(true);
|
||||||
|
_mockFileSystem.Directory.Exists(directoryPath).Returns(true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
bool result = _sut.Exists(pathId);
|
bool result = _sut.Exists(pathId, true);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeTrue();
|
result.Should().BeTrue();
|
||||||
@@ -198,9 +221,10 @@ public class UnixPathStrategyTests
|
|||||||
string filePath = "/home/user/documents/file.txt";
|
string filePath = "/home/user/documents/file.txt";
|
||||||
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(filePath);
|
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(filePath);
|
||||||
_mockFileSystem.Path.Exists(filePath).Returns(true);
|
_mockFileSystem.Path.Exists(filePath).Returns(true);
|
||||||
|
_mockFileSystem.File.Exists(filePath).Returns(true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
bool result = _sut.Exists(pathId);
|
bool result = _sut.Exists(pathId, true);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeTrue();
|
result.Should().BeTrue();
|
||||||
|
|||||||
+28
-5
@@ -156,21 +156,42 @@ public class WindowsPathStrategyTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Exists_WhenPathExists_ShouldReturnTrue()
|
public void Exists_WhenPathExistsAndIsHiddenAndIncludeHiddenElementsIsTrue_ShouldReturnTrue()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
string existingPath = @"C:\Users\User\existing_file.txt";
|
string existingPath = @"C:\Users\User\existing_file.txt";
|
||||||
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(existingPath);
|
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(existingPath);
|
||||||
_mockFileSystem.Path.Exists(existingPath).Returns(true);
|
_mockFileSystem.Path.Exists(existingPath).Returns(true);
|
||||||
|
_mockFileSystem.File.Exists(existingPath).Returns(true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
bool result = _sut.Exists(pathId);
|
bool result = _sut.Exists(pathId, true);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeTrue();
|
result.Should().BeTrue();
|
||||||
_mockFileSystem.Path.Received(1).Exists(existingPath);
|
_mockFileSystem.Path.Received(1).Exists(existingPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Exists_WhenPathExistsAndIsHiddenAndIncludeHiddenElementsIsFalse_ShouldReturnFalse()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
string existingPath = @"C:\Users\User\existing_file.txt";
|
||||||
|
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(existingPath);
|
||||||
|
_mockFileSystem.Path.Exists(existingPath).Returns(true);
|
||||||
|
_mockFileSystem.File.Exists(existingPath).Returns(true);
|
||||||
|
IFileInfo mockFileInfo = Substitute.For<IFileInfo>();
|
||||||
|
mockFileInfo.Attributes.Returns(System.IO.FileAttributes.Hidden);
|
||||||
|
_mockFileSystem.FileInfo.New(Arg.Any<string>()).Returns(mockFileInfo);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
bool result = _sut.Exists(pathId, false);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
result.Should().BeFalse();
|
||||||
|
_mockFileSystem.Path.Received(1).Exists(existingPath);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Exists_WhenPathDoesNotExist_ShouldReturnFalse()
|
public void Exists_WhenPathDoesNotExist_ShouldReturnFalse()
|
||||||
{
|
{
|
||||||
@@ -210,9 +231,10 @@ public class WindowsPathStrategyTests
|
|||||||
string directoryPath = @"C:\Users\User\Documents\";
|
string directoryPath = @"C:\Users\User\Documents\";
|
||||||
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(directoryPath);
|
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(directoryPath);
|
||||||
_mockFileSystem.Path.Exists(directoryPath).Returns(true);
|
_mockFileSystem.Path.Exists(directoryPath).Returns(true);
|
||||||
|
_mockFileSystem.Directory.Exists(directoryPath).Returns(true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
bool result = _sut.Exists(pathId);
|
bool result = _sut.Exists(pathId, true);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeTrue();
|
result.Should().BeTrue();
|
||||||
@@ -226,9 +248,10 @@ public class WindowsPathStrategyTests
|
|||||||
string filePath = @"C:\Users\User\Documents\file.txt";
|
string filePath = @"C:\Users\User\Documents\file.txt";
|
||||||
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(filePath);
|
FileSystemPathId pathId = _fileSystemPathIdFixture.CreateFileSystemPathId(filePath);
|
||||||
_mockFileSystem.Path.Exists(filePath).Returns(true);
|
_mockFileSystem.Path.Exists(filePath).Returns(true);
|
||||||
|
_mockFileSystem.File.Exists(filePath).Returns(true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
bool result = _sut.Exists(pathId);
|
bool result = _sut.Exists(pathId, true);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeTrue();
|
result.Should().BeTrue();
|
||||||
@@ -244,7 +267,7 @@ public class WindowsPathStrategyTests
|
|||||||
_mockFileSystem.Path.Exists(uncPath).Returns(true);
|
_mockFileSystem.Path.Exists(uncPath).Returns(true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
bool result = _sut.Exists(pathId);
|
bool result = _sut.Exists(pathId, true);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeTrue();
|
result.Should().BeTrue();
|
||||||
|
|||||||
+3
-3
@@ -634,7 +634,7 @@ public class PathControllerTests
|
|||||||
.Returns(expectedResponse);
|
.Returns(expectedResponse);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
IActionResult result = await _sut.CheckPathExists(path, cancellationToken);
|
IActionResult result = await _sut.CheckPathExists(path, true, cancellationToken);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
OkObjectResult okResult = result.Should().BeOfType<OkObjectResult>().Subject;
|
OkObjectResult okResult = result.Should().BeOfType<OkObjectResult>().Subject;
|
||||||
@@ -652,7 +652,7 @@ public class PathControllerTests
|
|||||||
.Returns(new PathExistsResponse(true));
|
.Returns(new PathExistsResponse(true));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await _sut.CheckPathExists(path, cancellationToken);
|
await _sut.CheckPathExists(path, true, cancellationToken);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
await _mockMediator.Received(1).Send(Arg.Is<CheckPathExistsQuery>(q => q.Path == path), Arg.Is(cancellationToken));
|
await _mockMediator.Received(1).Send(Arg.Is<CheckPathExistsQuery>(q => q.Path == path), Arg.Is(cancellationToken));
|
||||||
@@ -674,7 +674,7 @@ public class PathControllerTests
|
|||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
cts.CancelAfter(50);
|
cts.CancelAfter(50);
|
||||||
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => _sut.CheckPathExists(path, cts.Token));
|
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => _sut.CheckPathExists(path, true, cts.Token));
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user