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>
49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
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; }
|
|
}
|
|
}
|