public void RetriveNonTradingDaysForYear() { 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") }; tradingCalendar.SetNonTradingDays(2019, nonTradingDays); tradingCalendar.NonTradingDays(2019).Should().HaveCount(2); }
public void RetriveNonTradingDaysForYearWithNoData() { 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") }; tradingCalendar.SetNonTradingDays(2019, nonTradingDays); tradingCalendar.NonTradingDays(2020).Should().BeEmpty(); }
public ServiceResult <RestApi.TradingCalendars.TradingCalendar> Get(int year) { var result = new RestApi.TradingCalendars.TradingCalendar(); result.Year = year; foreach (var nonTradingDay in _TradingCalendar.NonTradingDays(year)) { result.AddNonTradingDay(nonTradingDay.Date, nonTradingDay.Desciption); } return(ServiceResult <RestApi.TradingCalendars.TradingCalendar> .Ok(result)); }