예제 #1
0
        /// <summary>Gets the <see cref="CalendarDay"/> for the given <paramref name="date"/>.</summary>
        /// <param name="date">The date.</param>
        /// <returns>The <see cref="CalendarDay"/>.</returns>
        private static CalendarDay Get(DateTime date)
        {
            lock (Key)
            {
                if (Cache.ContainsKey(date))
                {
                    return Cache[date];
                }

                return Cache[date] = new CalendarDay(date);
            }
        }
예제 #2
0
        /// <summary>Calls assertions for easter holidays.</summary>
        /// <param name="calendarDay">The calendar day.</param>
        /// <param name="month">The month.</param>
        /// <param name="day">The day.</param>
        private static void Assert(CalendarDay calendarDay, int month, int day)
        {
            var date = calendarDay.Date;

            // Assert
            date.Month.ShouldEqual(month);
            date.Day.ShouldEqual(day);
            calendarDay.NextWorkingDay.DayOfWeek.ShouldEqual(DayOfWeek.Tuesday);
            calendarDay.PreviousWorkingDay.DayOfWeek.ShouldEqual(DayOfWeek.Thursday);
        }