public void PreviousTradingDayForWeekEnd() { var tradingCalendar = new TradingCalendar(Guid.NewGuid()); var nonTradingDays = new NonTradingDay[] { new NonTradingDay(new Date(2019, 01, 01), "New Years Day"), new NonTradingDay(new Date(2019, 12, 25), "Christmas Day") }; var @event = new NonTradingDaysSetEvent(tradingCalendar.Id, 0, 2019, nonTradingDays); tradingCalendar.ApplyEvents(new Event[] { @event }); tradingCalendar.PreviousTradingDay(new Date(2019, 11, 10)).Should().Be(new Date(2019, 11, 08)); }
public void CheckIfDateIsAtradingDayReturnFalse() { var tradingCalendar = new TradingCalendar(Guid.NewGuid()); var nonTradingDays = new NonTradingDay[] { new NonTradingDay(new Date(2019, 01, 01), "New Years Day"), new NonTradingDay(new Date(2019, 12, 25), "Christmas Day") }; var @event = new NonTradingDaysSetEvent(tradingCalendar.Id, 0, 2019, nonTradingDays); tradingCalendar.ApplyEvents(new Event[] { @event }); tradingCalendar.IsTradingDay(new Date(2019, 01, 01)).Should().BeFalse(); }
public void ApplyNonTradingDaysSetEvent() { var tradingCalendar = new TradingCalendar(Guid.NewGuid()); var nonTradingDays = new NonTradingDay[] { new NonTradingDay(new Date(2019, 01, 01), "New Years Day"), new NonTradingDay(new Date(2019, 12, 25), "Christmas Day") }; var @event = new NonTradingDaysSetEvent(tradingCalendar.Id, 0, 2019, nonTradingDays); tradingCalendar.ApplyEvents(new Event[] { @event }); using (new AssertionScope()) { tradingCalendar.IsTradingDay(new Date(2019, 01, 01)).Should().BeFalse(); tradingCalendar.IsTradingDay(new Date(2019, 12, 25)).Should().BeFalse(); tradingCalendar.IsTradingDay(new Date(2019, 01, 02)).Should().BeTrue(); } }