AppPaths resolves the data folder once, and only the first Avalonia test used to point it at a temporary folder: a plain test running first would have used the real settings folder. A module initializer now sets it before any test. The dialog, storage and clipboard fakes move to Fakes.cs, can be scripted, and never accept the restart as administrator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
614 B
C#
18 lines
614 B
C#
using System;
|
|
using System.IO;
|
|
using System.Runtime.CompilerServices;
|
|
using HashTool.App.Infrastructure;
|
|
|
|
namespace HashTool.App.Tests;
|
|
|
|
/// <summary>
|
|
/// Runs before the first test touches <see cref="AppPaths"/>, which resolves its folder only once: settings, logs and crash
|
|
/// reports of every test go to a temporary folder, never the user's own.
|
|
/// </summary>
|
|
internal static class TestEnvironment
|
|
{
|
|
[ModuleInitializer]
|
|
internal static void Initialize() =>
|
|
Environment.SetEnvironmentVariable(AppPaths.DataDirectoryVariable, Directory.CreateTempSubdirectory("hashtool-app-tests-").FullName);
|
|
}
|