Files
KArtSell.Aegis/tests/KArtSell.ModelOperations.UnitTests/EvaluationWindowPlannerTests.cs
T
kjh2064 dcd1322d41
ci / backend (push) Failing after 12s
ci / frontend (push) Failing after 19s
ci / static (push) Failing after 45s
Initial commit: Add project files
2026-08-02 05:15:36 +09:00

22 lines
1023 B
C#

using KArtSell.Modules.ModelOperations.Domain;
namespace KArtSell.ModelOperations.UnitTests;
public sealed class EvaluationWindowPlannerTests
{
[Fact] public void Uses_trading_sessions_not_calendar_days()
{
var planner = new EvaluationWindowPlanner();
var due = planner.Plan("KRX", new DateOnly(2026, 8, 3), new WeekdayCalendar());
Assert.Equal(new[] { 1, 5, 20, 63, 126, 252 }, due.Select(x => x.WindowTradingDays));
Assert.All(due, x => Assert.DoesNotContain(x.DueSession.DayOfWeek, new[] { DayOfWeek.Saturday, DayOfWeek.Sunday }));
}
private sealed class WeekdayCalendar : ITradingSessionCalendar
{
public DateOnly AddTradingSessions(string calendarId, DateOnly startSession, int sessionCount)
{
var current = startSession; var count = 0;
while (count < sessionCount) { current = current.AddDays(1); if (current.DayOfWeek is not (DayOfWeek.Saturday or DayOfWeek.Sunday)) count++; }
return current;
}
}
}