Extract a per-user background host so indexing can later run outside the window.
Keep the GUI as the index writer for now; mutex, named pipe, and opt-in logon autostart prepare Explorer.Host.exe without two SQLite writers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
48
tests/Explorer.Hosting.Tests/CoreRegistrationTests.cs
Normal file
48
tests/Explorer.Hosting.Tests/CoreRegistrationTests.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Explorer.Contracts;
|
||||
using Explorer.Domain;
|
||||
using Explorer.Domain.Abstractions;
|
||||
using Explorer.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Explorer.Hosting.Tests;
|
||||
|
||||
public class CoreRegistrationTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task AddExplorerCore_registers_workbench_without_clipboard()
|
||||
{
|
||||
var dir = Path.Combine(Path.GetTempPath(), "ew-hosting", Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(dir);
|
||||
try
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
services.AddLogging();
|
||||
services.AddSingleton<IAppEnvironment>(new TempEnv(dir));
|
||||
services.AddExplorerCore();
|
||||
await using var sp = services.BuildServiceProvider();
|
||||
Assert.NotNull(sp.GetService<IWorkbenchHost>());
|
||||
Assert.NotNull(sp.GetService<IIndexingHost>());
|
||||
Assert.NotNull(sp.GetService<ITransferHost>());
|
||||
Assert.Null(sp.GetService<IOsClipboard>());
|
||||
}
|
||||
finally
|
||||
{
|
||||
try { Directory.Delete(dir, true); } catch { /* ignore */ }
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class TempEnv : IAppEnvironment
|
||||
{
|
||||
public TempEnv(string dir)
|
||||
{
|
||||
DataDirectory = 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