using StarterNG.Application.Abstractions;
namespace StarterNG.Tests.Fakes;
/// A host machine described inline: platform, home folder, env vars.
public sealed class FakeEnvironment : IEnvironment
{
private readonly Dictionary _variables = new(StringComparer.Ordinal);
public bool IsWindows { get; set; }
public bool IsLinux { get; set; } = true;
public bool IsMacOS { get; set; }
public string BaseDirectory { get; set; } = Path.Combine("game");
public string? GetVariable(string name) => _variables.TryGetValue(name, out var value) ? value : null;
public FakeEnvironment With(string name, string value)
{
_variables[name] = value;
return this;
}
/// Switches the fake to Windows, with an APPDATA folder.
public FakeEnvironment AsWindows(string appData = "C:/Users/kolejarz/AppData/Roaming")
{
IsWindows = true;
IsLinux = false;
IsMacOS = false;
return With("APPDATA", appData);
}
}