Files
riojoy/tests/RioJoy.Core.Tests/Profiles/ConfigLocatorTests.cs
T
CydandClaude Fable 5 97caf124a6 pod: bundled per-game deployment (portable config, --exit-with, build-pod)
Phase 10: RIO hardware exists only on pods + dev boxes, so production is one
RIOJoy copy inside each podized game folder, no resident tray. ConfigLocator
makes a config.json beside the exe win over %APPDATA%; --exit-with <exe|pid>
(CompanionTarget/CompanionExit, 60s startup grace) tears down and quits when
the game exits; a starting --exit-with instance waits up to 15s for the
predecessor mutex instead of silently exiting. deploy/build-pod.ps1 emits
the ~4.5MB drop-in (app + portable config wrapping the profile + start
script, no drivers) - verified against the shipped Descent profile. 455
tests; PLAN.md Phase 10 + INPUT-INTEGRATION.md pod section.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-31 22:01:52 -05:00

51 lines
1.4 KiB
C#

using RioJoy.Core.Profiles;
using Xunit;
namespace RioJoy.Core.Tests.Profiles;
public class ConfigLocatorTests
{
[Fact]
public void NoPortableFile_ResolvesToRoaming()
{
string dir = Path.Combine(Path.GetTempPath(), $"riojoy-loc-{Guid.NewGuid():N}");
Directory.CreateDirectory(dir);
try
{
Assert.Equal(@"C:\roaming\config.json",
ConfigLocator.Resolve(dir, @"C:\roaming\config.json"));
}
finally
{
Directory.Delete(dir, recursive: true);
}
}
[Fact]
public void PortableFileBesideExe_Wins()
{
string dir = Path.Combine(Path.GetTempPath(), $"riojoy-loc-{Guid.NewGuid():N}");
Directory.CreateDirectory(dir);
try
{
string portable = Path.Combine(dir, ConfigLocator.PortableConfigFileName);
File.WriteAllText(portable, "{}");
Assert.Equal(portable, ConfigLocator.Resolve(dir, @"C:\roaming\config.json"));
}
finally
{
Directory.Delete(dir, recursive: true);
}
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
public void MissingExeDirectory_FallsBackToRoaming(string? exeDir)
{
Assert.Equal(@"C:\roaming\config.json",
ConfigLocator.Resolve(exeDir, @"C:\roaming\config.json"));
}
}