Ejemplo n.º 1
0
        public void TrimDayTest()
        {
            TimeTool.TrimToDay(testTime).Should().Be(new DateTime(testTime.Year, testTime.Month, 1));

            Enumerable
            .Range(0, TimeTool.GetDaysInMonth(testTime.Year, testTime.Month))
            .RunEach(d => { TimeTool.TrimToDay(testTime, d + 1).Should().Be(new DateTime(testTime.Year, testTime.Month, d + 1)); });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 기간을 <see cref="DayRange"/>로 열거합니다.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <DayRange> GetDays()
        {
            var startMonth = TimeTool.StartTimeOfMonth(Start);

            return
                (Enumerable
                 .Range(0, MonthCount)
#if !SILVERLIGHT
                 .AsParallel()
                 .AsOrdered()
#endif
                 .SelectMany(m => {
                var monthStart = startMonth.AddMonths(m);
                var daysOfMonth = TimeTool.GetDaysInMonth(monthStart.Year, monthStart.Month);

                return
                Enumerable.Range(0, daysOfMonth)
                .Select(d => new DayRange(monthStart.AddDays(d), TimeCalendar));
            }));
        }