Add Explorer Workbench with hierarchical, off-UI Storage analysis.
Storage queries run in the background with cancellation and covering indexes so switching views no longer freezes the UI. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
44
tests/Explorer.FileOperations.Tests/FileOperationTests.cs
Normal file
44
tests/Explorer.FileOperations.Tests/FileOperationTests.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using Explorer.Domain;
|
||||
using Explorer.Domain.Abstractions;
|
||||
using Explorer.FileOperations;
|
||||
|
||||
namespace Explorer.FileOperations.Tests;
|
||||
|
||||
public class FileOperationTests
|
||||
{
|
||||
[Fact]
|
||||
public void New_folder_and_rename_on_real_filesystem()
|
||||
{
|
||||
var root = Path.Combine(Path.GetTempPath(), "ew-ops", Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(root);
|
||||
try
|
||||
{
|
||||
var ops = new FileOperationService(null!, new StubShell(), new StubEnum());
|
||||
var created = ops.NewFolder(root);
|
||||
Assert.True(Directory.Exists(created));
|
||||
ops.Rename(created, "Renamed");
|
||||
Assert.True(Directory.Exists(Path.Combine(root, "Renamed")));
|
||||
}
|
||||
finally
|
||||
{
|
||||
try { Directory.Delete(root, true); } catch { /* ignore */ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
file sealed class StubEnum : IFileSystemEnumerator
|
||||
{
|
||||
public IEnumerable<FileSystemItem> EnumerateChildren(string directoryPath) => [];
|
||||
public IReadOnlyList<FileSystemItem> EnumerateChildrenSafe(string directoryPath, out string? error) { error = null; return []; }
|
||||
public FileSystemItem? GetItem(string path) => null;
|
||||
}
|
||||
|
||||
file sealed class StubShell : IShellFileOperations
|
||||
{
|
||||
public void Open(string path) { }
|
||||
public bool DeleteToRecycleBin(IReadOnlyList<string> paths, out string? error) { error = "n/a"; return false; }
|
||||
public bool CopyFileWithProgress(string source, string destination, bool overwrite, IProgress<long>? progress, CancellationToken cancellationToken, out string? error)
|
||||
{ error = "n/a"; return false; }
|
||||
public bool MoveFileWithProgress(string source, string destination, bool overwrite, IProgress<long>? progress, CancellationToken cancellationToken, out string? error)
|
||||
{ error = "n/a"; return false; }
|
||||
}
|
||||
Reference in New Issue
Block a user