Files
LanMountainDesktop/tests/LanMountainDesktop.Tests/AirAppRuntimeDataPathTests.cs

41 lines
1000 B
C#
Raw Normal View History

2026-06-01 01:12:52 +08:00
using LanMountainDesktop.Services;
using Xunit;
namespace LanMountainDesktop.Tests;
2026-08-11 23:03:55 +08:00
public sealed class AirAppRuntimeDataPathTests : IDisposable
2026-06-01 01:12:52 +08:00
{
private readonly string _dataRoot = Path.Combine(
Path.GetTempPath(),
"LanMountainDesktop.Tests",
2026-08-11 23:03:55 +08:00
nameof(AirAppRuntimeDataPathTests),
2026-06-01 01:12:52 +08:00
Guid.NewGuid().ToString("N"));
[Fact]
2026-08-11 23:03:55 +08:00
public void AirAppRuntime_UsesHostDataRootForAirAppsAndMarketData()
2026-06-01 01:12:52 +08:00
{
AppDataPathProvider.Initialize(["--data-root", _dataRoot]);
2026-08-11 23:03:55 +08:00
using var runtime = new AirAppRuntimeService();
2026-06-01 01:12:52 +08:00
Assert.Equal(
2026-08-11 23:03:55 +08:00
Path.Combine(Path.GetFullPath(_dataRoot), "Extensions", "AirApps"),
runtime.AirAppsDirectory);
2026-06-01 01:12:52 +08:00
}
public void Dispose()
{
AppDataPathProvider.ResetForTests();
try
{
if (Directory.Exists(_dataRoot))
{
Directory.Delete(_dataRoot, recursive: true);
}
}
catch
{
}
}
}