Files
poli0981andClaude Opus 5.5 22c3ed7451 test(app): shared fakes and a temporary data folder for every test
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>
2026-10-25 08:02:08 +07:00

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);
}