Files
GmRelayBot/tests/GmRelay.Bot.Tests/Infrastructure/Scheduling/SessionTriggerStoreSourceTests.cs
T
Toutsu 2a707e4825
PR Checks / test-and-build (pull_request) Successful in 7m9s
feat(platform): route scheduler notifications through platform messenger
2026-05-21 12:30:35 +03:00

33 lines
1.2 KiB
C#

namespace GmRelay.Bot.Tests.Infrastructure.Scheduling;
public sealed class SessionTriggerStoreSourceTests
{
[Fact]
public async Task DbSessionTriggerStore_ShouldFilterTriggersByConfiguredPlatform()
{
var source = await ReadRepositoryFileAsync(
"src/GmRelay.Shared/Infrastructure/Scheduling/ISessionTriggerStore.cs");
Assert.Contains("PlatformSchedulerOptions", source, StringComparison.Ordinal);
Assert.Contains("JOIN game_groups g ON g.id = s.group_id", source, StringComparison.Ordinal);
Assert.Contains("g.platform = @Platform", source, StringComparison.Ordinal);
}
private static async Task<string> ReadRepositoryFileAsync(string relativePath)
{
var directory = new DirectoryInfo(AppContext.BaseDirectory);
while (directory is not null)
{
var candidate = Path.Combine(directory.FullName, relativePath);
if (File.Exists(candidate))
{
return await File.ReadAllTextAsync(candidate);
}
directory = directory.Parent;
}
throw new FileNotFoundException($"Could not locate repository file '{relativePath}'.");
}
}