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:
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||
<PackageReference Include="xunit" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Explorer.Domain\Explorer.Domain.csproj" />
|
||||
<ProjectReference Include="..\..\src\Explorer.FileOperations\Explorer.FileOperations.csproj" />
|
||||
<ProjectReference Include="..\..\src\Explorer.Application\Explorer.Application.csproj" />
|
||||
<ProjectReference Include="..\..\src\Explorer.Storage.Sqlite\Explorer.Storage.Sqlite.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
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