using KArtSell.Modules.ModelOperations.Domain;
namespace KArtSell.ModelOperations.UnitTests;
public sealed class EvaluationWindowPlannerTests
{
    [Fact] public void Uses_trading_sessions_not_calendar_days()
    {
        var due = EvaluationWindowPlanner.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;
        }
    }
}
