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:
49
tests/Explorer.Application.Tests/PathHistoryStoreTests.cs
Normal file
49
tests/Explorer.Application.Tests/PathHistoryStoreTests.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Explorer.Application;
|
||||
using Explorer.Domain.Abstractions;
|
||||
|
||||
namespace Explorer.Application.Tests;
|
||||
|
||||
public class PathHistoryStoreTests
|
||||
{
|
||||
[Fact]
|
||||
public void Remember_moves_existing_path_to_front()
|
||||
{
|
||||
var next = PathHistoryStore.Remember(["D:\\Photos", "C:\\"], @"c:\");
|
||||
Assert.Equal(@"c:\", next[0]);
|
||||
Assert.Equal(2, next.Count);
|
||||
Assert.Equal(@"D:\Photos", next[1]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Load_and_save_roundtrip()
|
||||
{
|
||||
var dir = Path.Combine(Path.GetTempPath(), "ew-path-history", Guid.NewGuid().ToString("N"));
|
||||
try
|
||||
{
|
||||
var store = new PathHistoryStore(new HistoryEnv(dir));
|
||||
store.Save(["C:\\Work", "This PC", " "]);
|
||||
var loaded = store.Load();
|
||||
Assert.Equal(["C:\\Work"], loaded);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try { Directory.Delete(dir, true); } catch { /* ignore */ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
file sealed class HistoryEnv : IAppEnvironment
|
||||
{
|
||||
public HistoryEnv(string dir)
|
||||
{
|
||||
DataDirectory = dir;
|
||||
Directory.CreateDirectory(dir);
|
||||
DatabasePath = Path.Combine(dir, "index.db");
|
||||
LogDirectory = Path.Combine(dir, "logs");
|
||||
Directory.CreateDirectory(LogDirectory);
|
||||
}
|
||||
|
||||
public string DataDirectory { get; }
|
||||
public string DatabasePath { get; }
|
||||
public string LogDirectory { get; }
|
||||
}
|
||||
Reference in New Issue
Block a user