Exemplo n.º 1
0
        public void TestSetPresidentsDay()
        {
            var assertHolidays = NewYorkStockExchangeCalendarTestRig.Where(w => w.Name == HolidayNames.PresidentsDayText).ToList();

            Assert.True(assertHolidays.TrueForAll(t => t.Date.Month == 2), "Not all are in February?");
            TestSetForwardWeekDayHolidays(assertHolidays, 3, DayOfWeek.Monday, HolidayNames.PresidentsDayText);
        }
Exemplo n.º 2
0
        public void TestSetThanksgiving()
        {
            var assertHolidays = NewYorkStockExchangeCalendarTestRig.Where(w => w.Name == HolidayNames.ThanksgivingDayText).ToList();

            Assert.True(assertHolidays.TrueForAll(t => t.Date.Month == 11), "Not all in November");
            TestSetForwardWeekDayHolidays(assertHolidays, 4, DayOfWeek.Thursday, HolidayNames.ThanksgivingDayText);
        }
Exemplo n.º 3
0
        public void TestSetMemorialDay()
        {
            var assertHolidays = NewYorkStockExchangeCalendarTestRig.Where(w => w.Name == HolidayNames.MemorialDayText).ToList();

            TestSetYearRange(assertHolidays);
            TestSetReverseWeekDayHolidays(assertHolidays, 1, DayOfWeek.Monday, HolidayNames.MemorialDayText);
        }
Exemplo n.º 4
0
        public void TestSetNewYears()
        {
            var data = NewYorkStockExchangeCalendarTestRig.Where(s => s.Name == HolidayNames.NewYearsDayText).ToList();

            Assert.True(data.TrueForAll(t => t.Date.Month == 1), "Not all are in January.");
            Assert.True(data.TrueForAll(t => t.Date.Day >= 1 && t.Date.Day <= 2), "Date mismatch.");
        }
Exemplo n.º 5
0
        public void TestSetMartinLutherKing()
        {
            var assertHolidays = NewYorkStockExchangeCalendarTestRig.Where(w => w.Name == HolidayNames.MartinLutherKingText).ToList();

            Assert.True(assertHolidays.TrueForAll(t => t.Date.Day >= 12 && t.Date.Day <= 25), "Date out of range.");
            TestSetYearRange(assertHolidays);
            TestSetForwardWeekDayHolidays(assertHolidays, 3, DayOfWeek.Monday, HolidayNames.MartinLutherKingText);
        }
Exemplo n.º 6
0
        public void TestSetLaborDay()
        {
            var assertHolidays = NewYorkStockExchangeCalendarTestRig.Where(w => w.Name == HolidayNames.LaborDayText).ToList();

            TestSetYearRange(assertHolidays);
            Assert.True(assertHolidays.TrueForAll(a => a.Date.Month == 9), "Wrong month.");
            TestSetForwardWeekDayHolidays(assertHolidays, 1, DayOfWeek.Monday, HolidayNames.MartinLutherKingText);
        }
Exemplo n.º 7
0
        public void TestSetIndependenceDay()
        {
            var data = NewYorkStockExchangeCalendarTestRig.Where(s => s.Name == HolidayNames.IndependentsDayText).ToList();

            TestSetYearRange(data);
            Assert.True(data.TrueForAll(t => t.Date.Month == 7), "Not all 4th July is in July.");
            Assert.True(data.TrueForAll(t => t.Date.Day >= 3 && t.Date.Day <= 5), "Some dates out of range.");
        }
Exemplo n.º 8
0
        public void TestSetChristmas()
        {
            var christmasData = NewYorkStockExchangeCalendarTestRig.Where(s => s.Name == HolidayNames.ChristmasDayText).ToList();

            TestSetYearRange(christmasData);
            Assert.True(christmasData.TrueForAll(d => d.Date.Month == 12), "Christmas is not always in December?");
            Assert.True(christmasData.TrueForAll(d => d.Date.Day >= 24 && d.Date.Day <= 26), "Christmas dates out of range.");
        }
Exemplo n.º 9
0
        public void IsBusinessDayNyse()
        {
            CalendarDateTime.ClearCalendar();
            Calendars.NewYorkStockExchange();
            var currentDate = _holidayMinDateTestRig;

            while (currentDate <= _holidayMaxDateTestRig)
            {
                var expected = currentDate.DayOfWeek != DayOfWeek.Saturday &&
                               currentDate.DayOfWeek != DayOfWeek.Sunday &&
                               NewYorkStockExchangeCalendarTestRig.All(a => a.Date != currentDate);
                var actual = currentDate.IsWorkDay();
                Assert.True(expected == actual, "Fail on: " + currentDate);
                currentDate = currentDate.AddDays(1);
            }
        }