Initial commit: Add project files
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user