Inheritance: YearTimeRange
Esempio n. 1
0
        public void YearBaseMonthTest()
        {
            var year = new YearRange(TimeCalendar.New(April));

            year.YearBaseMonth.Should().Be(April);
            new YearRange().YearBaseMonth.Should().Be(January);
        }
Esempio n. 2
0
        public void YearCompareTest()
        {
            var moment             = new DateTime(2008, 2, 18);
            var calendarYearSweden = new YearRange(moment, TimeCalendar.New(January));

            calendarYearSweden.YearBaseMonth.Should().Be(January);

            var calendarYearGermany = new YearRange(moment, TimeCalendar.New(April));

            calendarYearGermany.YearBaseMonth.Should().Be(April);

            var calendarYearUnitedStates = new YearRange(moment, TimeCalendar.New(October));

            calendarYearUnitedStates.YearBaseMonth.Should().Be(October);

            calendarYearSweden.Should().Not.Be.EqualTo(calendarYearGermany);
            calendarYearSweden.Should().Not.Be.EqualTo(calendarYearUnitedStates);
            calendarYearGermany.Should().Not.Be.EqualTo(calendarYearUnitedStates);

            calendarYearSweden.BaseYear.Should().Be(calendarYearGermany.BaseYear + 1);
            calendarYearSweden.BaseYear.Should().Be(calendarYearUnitedStates.BaseYear + 1);

            calendarYearSweden.GetPreviousYear().BaseYear.Should().Be(calendarYearGermany.GetPreviousYear().BaseYear + 1);
            calendarYearSweden.GetPreviousYear().BaseYear.Should().Be(calendarYearUnitedStates.GetPreviousYear().BaseYear + 1);

            calendarYearSweden.GetNextYear().BaseYear.Should().Be(calendarYearGermany.GetNextYear().BaseYear + 1);
            calendarYearSweden.GetNextYear().BaseYear.Should().Be(calendarYearUnitedStates.GetNextYear().BaseYear + 1);

            calendarYearSweden.IntersectsWith(calendarYearGermany).Should().Be.True();
            calendarYearSweden.IntersectsWith(calendarYearUnitedStates).Should().Be.True();
            calendarYearGermany.IntersectsWith(calendarYearUnitedStates).Should().Be.True();
        }
Esempio n. 3
0
        public void CurrentYearTest() {
            var currentYear = ClockProxy.Clock.Now.Year;
            var year = new YearRange(currentYear);

            year.IsReadOnly.Should().Be.True();
            year.BaseYear.Should().Be(currentYear);
            year.Start.Should().Be(new DateTime(currentYear, 1, 1));
            year.End.Should().Be.LessThan(new DateTime(currentYear + 1, 1, 1));
        }
Esempio n. 4
0
        public void DefaultCalendarTest() {
            var yearStart = new DateTime(ClockProxy.Clock.Now.Year, 1, 1);

            var year = new YearRange(yearStart);

            year.YearBaseMonth.Should().Be(1);
            year.BaseYear.Should().Be(yearStart.Year);
            year.Start.Should().Be(yearStart.Add(year.TimeCalendar.StartOffset));
            year.End.Should().Be(yearStart.AddYears(1).Add(year.TimeCalendar.EndOffset));
        }
Esempio n. 5
0
        public void CurrentYearTest()
        {
            var currentYear = ClockProxy.Clock.Now.Year;
            var year        = new YearRange(currentYear);

            year.IsReadOnly.Should().Be.True();
            year.BaseYear.Should().Be(currentYear);
            year.Start.Should().Be(new DateTime(currentYear, 1, 1));
            year.End.Should().Be.LessThan(new DateTime(currentYear + 1, 1, 1));
        }
Esempio n. 6
0
        public void YearIndexTest()
        {
            const int yearIndex = 1994;
            var       year      = new YearRange(yearIndex);

            year.IsReadOnly.Should().Be.True();
            year.BaseYear.Should().Be(yearIndex);
            year.Start.Should().Be(new DateTime(yearIndex, 1, 1));
            year.End.Should().Be.LessThan(new DateTime(yearIndex + 1, 1, 1));
        }
Esempio n. 7
0
        public void DefaultCalendarTest()
        {
            var yearStart = new DateTime(ClockProxy.Clock.Now.Year, 1, 1);

            var year = new YearRange(yearStart);

            year.YearBaseMonth.Should().Be(1);
            year.BaseYear.Should().Be(yearStart.Year);
            year.Start.Should().Be(yearStart.Add(year.TimeCalendar.StartOffset));
            year.End.Should().Be(yearStart.AddYears(1).Add(year.TimeCalendar.EndOffset));
        }
Esempio n. 8
0
        public void GetNextYearTest()
        {
            DateTime currentYearStart = new DateTime(ClockProxy.Clock.Now.Year, 4, 1);

            var currentYear = new YearRange(currentYearStart.Year, TimeCalendar.New(TimeSpan.Zero, TimeSpan.Zero, April));
            var nextYear    = currentYear.GetNextYear();

            nextYear.IsReadOnly.Should().Be.True();
            nextYear.YearBaseMonth.Should().Be(April);
            nextYear.BaseYear.Should().Be(currentYearStart.Year + 1);
            nextYear.Start.Should().Be(currentYearStart.AddYears(1));
            nextYear.End.Should().Be(currentYearStart.AddYears(2));
        }
Esempio n. 9
0
        public void YearPeriodTest()
        {
            var currentYear = ClockProxy.Clock.Now.Year;
            var yearStart   = new DateTime(currentYear, 4, 1);
            var yearEnd     = yearStart.AddYears(1);

            var year = new YearRange(currentYear, TimeCalendar.New(TimeSpan.Zero, TimeSpan.Zero, April));

            year.IsReadOnly.Should().Be.True();
            year.YearBaseMonth.Should().Be(April);
            year.BaseYear.Should().Be(yearStart.Year);
            year.Start.Should().Be(yearStart);
            year.End.Should().Be(yearEnd);
        }
Esempio n. 10
0
        public void GetQuartersTest()
        {
            var year = new YearRange(TimeCalendar.New(October));

            var index = 0;

            foreach (var quarter in year.GetQuarters())
            {
                quarter.BaseYear.Should().Be(year.BaseYear);
                quarter.Start.Should().Be(year.Start.AddMonths(index * TimeSpec.MonthsPerQuarter));
                quarter.End.Should().Be(quarter.TimeCalendar.MapEnd(quarter.Start.AddMonths(TimeSpec.MonthsPerQuarter)));
                index++;
            }
            index.Should().Be(TimeSpec.QuartersPerYear);
        }
Esempio n. 11
0
        public void GetMonthsTest()
        {
            var year = new YearRange(TimeCalendar.New(October));

            var months = year.GetMonths().ToList();

            months.Count.Should().Be(TimeSpec.MonthsPerYear);

            for (var m = 0; m < months.Count; m++)
            {
                var month = months[m];
                month.Start.Should().Be(year.Start.AddMonths(m));
                month.End.Should().Be(month.TimeCalendar.MapEnd(month.Start.AddMonths(1)));
            }
        }
Esempio n. 12
0
        public void AddYearsTest()
        {
            var currentYear = new YearRange(TimeCalendar.New(April));

            currentYear.AddYears(0).Should().Be(currentYear);

            var pastYear = currentYear.AddYears(-10);

            pastYear.Start.Should().Be(currentYear.Start.AddYears(-10));
            pastYear.End.Should().Be(currentYear.End.AddYears(-10));

            var futureYear = currentYear.AddYears(10);

            futureYear.Start.Should().Be(currentYear.Start.AddYears(10));
            futureYear.End.Should().Be(currentYear.End.AddYears(10));
        }
Esempio n. 13
0
        public void GetHalfyearsTest()
        {
            var year = new YearRange(TimeCalendar.New(October));

            var index = 0;

            foreach (var halfyear in year.GetHalfyears())
            {
                halfyear.BaseYear.Should().Be(year.BaseYear);
                halfyear.Start.Should().Be(year.Start.AddMonths(index * TimeSpec.MonthsPerHalfyear));
                halfyear.End.Should().Be(halfyear.TimeCalendar.MapEnd(halfyear.Start.AddMonths(TimeSpec.MonthsPerHalfyear)));

                index++;
            }

            Assert.AreEqual(TimeSpec.HalfyearsPerYear, index);
        }
Esempio n. 14
0
        public void InitValuesTest() {
            var now = ClockProxy.Clock.Now;
            var thisYear = new DateTime(now.Year, 1, 1);
            var nextYear = thisYear.AddYears(1);

            var year = new YearRange(now, TimeCalendar.NewEmptyOffset());

            year.Start.Year.Should().Be(thisYear.Year);
            year.Start.Month.Should().Be(thisYear.Month);
            year.Start.Day.Should().Be(thisYear.Day);
            year.Start.Hour.Should().Be(0);
            year.Start.Minute.Should().Be(0);
            year.Start.Second.Should().Be(0);
            year.Start.Millisecond.Should().Be(0);

            year.End.Year.Should().Be(nextYear.Year);
            year.End.Month.Should().Be(nextYear.Month);
            year.End.Day.Should().Be(nextYear.Day);
            year.End.Hour.Should().Be(0);
            year.End.Minute.Should().Be(0);
            year.End.Second.Should().Be(0);
            year.End.Millisecond.Should().Be(0);
        }
Esempio n. 15
0
        public void InitValuesTest()
        {
            var now      = ClockProxy.Clock.Now;
            var thisYear = new DateTime(now.Year, 1, 1);
            var nextYear = thisYear.AddYears(1);

            var year = new YearRange(now, TimeCalendar.NewEmptyOffset());

            year.Start.Year.Should().Be(thisYear.Year);
            year.Start.Month.Should().Be(thisYear.Month);
            year.Start.Day.Should().Be(thisYear.Day);
            year.Start.Hour.Should().Be(0);
            year.Start.Minute.Should().Be(0);
            year.Start.Second.Should().Be(0);
            year.Start.Millisecond.Should().Be(0);

            year.End.Year.Should().Be(nextYear.Year);
            year.End.Month.Should().Be(nextYear.Month);
            year.End.Day.Should().Be(nextYear.Day);
            year.End.Hour.Should().Be(0);
            year.End.Minute.Should().Be(0);
            year.End.Second.Should().Be(0);
            year.End.Millisecond.Should().Be(0);
        }
        public void CollectExcludePeriodTest() {
            const int workingDays2011 = 365 - 2 - (51 * 2) - 1;
            const int workingDaysMarch2011 = 31 - 8; // total days - weekend days

            var year2011 = new YearRange(2011);

            var filter1 = new CalendarPeriodCollectorFilter();
            filter1.AddWorkingWeekDays();

            var collector1 = new CalendarPeriodCollector(filter1, year2011);
            collector1.CollectDays();
            collector1.Periods.Count.Should().Be(workingDays2011);

            // 3월 제외
            var filter2 = new CalendarPeriodCollectorFilter();
            filter2.AddWorkingWeekDays();
            filter2.ExcludePeriods.Add(new MonthRange(2011, March));

            var collector2 = new CalendarPeriodCollector(filter2, year2011);
            collector2.CollectDays();
            collector2.Periods.Count.Should().Be(workingDays2011 - workingDaysMarch2011);


            // 2011년 26주차~27주차 (여름휴가가 2주야!!!)
            //
            var filter3 = new CalendarPeriodCollectorFilter();
            filter3.AddWorkingWeekDays();
            filter3.ExcludePeriods.Add(new MonthRange(2011, March));
            filter3.ExcludePeriods.Add(new WeekRangeCollection(2011, 26, 2));

            var collector3 = new CalendarPeriodCollector(filter3, year2011);
            collector3.CollectDays();
            collector3.Periods.Count.Should().Be(workingDays2011 - workingDaysMarch2011 - 2 * TimeSpec.WeekDaysPerWeek);
        }
Esempio n. 17
0
        public void FiscalYearTest() {
            var testDate = new DateTime(2008, 11, 18);
            var year = new YearRange(testDate, TimeCalendar.New(October));

            year.YearBaseMonth.Should().Be(October);
            year.BaseYear.Should().Be(testDate.Year);

            // Start & End
            year.Start.Year.Should().Be(testDate.Year);
            year.Start.Month.Should().Be(October);
            year.Start.Day.Should().Be(1);
            year.End.Year.Should().Be(testDate.Year + 1);
            year.End.Month.Should().Be(September);
            year.End.Day.Should().Be(CultureInfo.CurrentCulture.Calendar.GetDaysInMonth(year.End.Year, year.End.Month));

            // Half Years

            var halfyears = year.GetHalfyears();

            foreach(var halfyear in year.GetHalfyears()) {
                if(halfyear.Halfyear == HalfyearKind.First) {
                    halfyear.Start.Should().Be(year.Start);
                    halfyear.Start.Year.Should().Be(testDate.Year);
                    halfyear.Start.Month.Should().Be(October);
                    halfyear.Start.Day.Should().Be(1);

                    halfyear.End.Year.Should().Be(testDate.Year + 1);
                    halfyear.End.Month.Should().Be(March);
                    halfyear.End.Day.Should().Be(CultureInfo.CurrentCulture.Calendar.GetDaysInMonth(halfyear.End.Year,
                                                                                                    halfyear.End.Month));
                }
                else {
                    halfyear.Start.Should().Be(year.Start.AddMonths(TimeSpec.MonthsPerHalfyear));
                    halfyear.Start.Year.Should().Be(testDate.Year + 1);
                    halfyear.Start.Month.Should().Be(April);
                    halfyear.Start.Day.Should().Be(1);

                    halfyear.End.Year.Should().Be(testDate.Year + 1);
                    halfyear.End.Month.Should().Be(September);
                    halfyear.End.Day.Should().Be(CultureInfo.CurrentCulture.Calendar.GetDaysInMonth(halfyear.End.Year,
                                                                                                    halfyear.End.Month));
                }
            }

            // Quarters
            foreach(var quarter in year.GetQuarters()) {
                switch(quarter.Quarter) {
                    case QuarterKind.First:
                        quarter.Start.Should().Be(year.Start);
                        quarter.Start.Year.Should().Be(testDate.Year);
                        quarter.Start.Month.Should().Be(October);
                        quarter.Start.Day.Should().Be(1);
                        quarter.End.Year.Should().Be(testDate.Year);
                        quarter.End.Month.Should().Be(December);
                        quarter.End.Day.Should().Be(quarter.TimeCalendar.GetDaysInMonth(quarter.End.Year, quarter.End.Month));
                        break;

                    case QuarterKind.Second:
                        quarter.Start.Year.Should().Be(testDate.Year + 1);
                        quarter.Start.Month.Should().Be(January);
                        quarter.Start.Day.Should().Be(1);
                        quarter.End.Year.Should().Be(testDate.Year + 1);
                        quarter.End.Month.Should().Be(March);
                        quarter.End.Day.Should().Be(quarter.TimeCalendar.GetDaysInMonth(quarter.End.Year, quarter.End.Month));
                        break;

                    case QuarterKind.Third:
                        quarter.Start.Year.Should().Be(testDate.Year + 1);
                        quarter.Start.Month.Should().Be(April);
                        quarter.Start.Day.Should().Be(1);
                        quarter.End.Year.Should().Be(testDate.Year + 1);
                        quarter.End.Month.Should().Be(June);
                        quarter.End.Day.Should().Be(quarter.TimeCalendar.GetDaysInMonth(quarter.End.Year, quarter.End.Month));
                        break;

                    case QuarterKind.Fourth:
                        quarter.End.Should().Be(year.End);
                        quarter.Start.Year.Should().Be(testDate.Year + 1);
                        quarter.Start.Month.Should().Be(July);
                        quarter.Start.Day.Should().Be(1);
                        quarter.End.Year.Should().Be(testDate.Year + 1);
                        quarter.End.Month.Should().Be(September);
                        quarter.End.Day.Should().Be(quarter.TimeCalendar.GetDaysInMonth(quarter.End.Year, quarter.End.Month));
                        break;
                }
            }

            // months
            //
            var monthIndex = 0;
            foreach(var month in year.GetMonths()) {
                if(monthIndex == 0)
                    Assert.AreEqual(month.Start, year.Start);
                else if(monthIndex == TimeSpec.MonthsPerYear - 1)
                    Assert.AreEqual(month.End, year.End);

                var startDate = new DateTime(year.BaseYear, year.Start.Month, 1).AddMonths(monthIndex);

                month.Start.Year.Should().Be(startDate.Year);
                month.Start.Month.Should().Be(startDate.Month);
                month.Start.Day.Should().Be(startDate.Day);
                month.End.Year.Should().Be(startDate.Year);
                month.End.Month.Should().Be(startDate.Month);

                monthIndex++;
            }
        }
Esempio n. 18
0
        public void CalendarQuarterOfYearTest() {
            var currentYear = ClockProxy.Clock.Now.Year;

            var timeCalendar = TimeCalendar.New(October);
            var calendarYear = new YearRange(currentYear, timeCalendar);

            calendarYear.YearBaseMonth.Should().Be(October);
            calendarYear.BaseYear.Should().Be(currentYear);
            calendarYear.Start.Should().Be(new DateTime(currentYear, October, 1));
            calendarYear.End.Should().Be(calendarYear.TimeCalendar.MapEnd(calendarYear.Start.AddYears(1)));
            calendarYear.UnmappedEnd.Should().Be(calendarYear.Start.AddYears(1));

            // Q1
            var q1 = new QuarterRange(calendarYear.BaseYear, QuarterKind.First, timeCalendar);
            q1.YearBaseMonth.Should().Be(calendarYear.YearBaseMonth);
            q1.BaseYear.Should().Be(calendarYear.BaseYear);
            q1.Start.Should().Be(new DateTime(currentYear, October, 1));
            q1.End.Should().Be(q1.TimeCalendar.MapEnd(q1.Start.AddMonths(TimeSpec.MonthsPerQuarter)));
            q1.UnmappedEnd.Should().Be(q1.Start.AddMonths(TimeSpec.MonthsPerQuarter));

            // Q2
            var q2 = new QuarterRange(calendarYear.BaseYear, QuarterKind.Second, timeCalendar);
            q2.YearBaseMonth.Should().Be(calendarYear.YearBaseMonth);
            q2.BaseYear.Should().Be(calendarYear.BaseYear);
            q2.Start.Should().Be(new DateTime(currentYear + 1, 1, 1));
            q2.End.Should().Be(q2.TimeCalendar.MapEnd(q2.Start.AddMonths(TimeSpec.MonthsPerQuarter)));
            q2.UnmappedEnd.Should().Be(q2.Start.AddMonths(TimeSpec.MonthsPerQuarter));

            // Q3
            var q3 = new QuarterRange(calendarYear.BaseYear, QuarterKind.Third, timeCalendar);
            q3.YearBaseMonth.Should().Be(calendarYear.YearBaseMonth);
            q3.BaseYear.Should().Be(calendarYear.BaseYear);
            q3.Start.Should().Be(new DateTime(currentYear + 1, 4, 1));
            q3.End.Should().Be(q3.TimeCalendar.MapEnd(q3.Start.AddMonths(TimeSpec.MonthsPerQuarter)));
            q3.UnmappedEnd.Should().Be(q3.Start.AddMonths(TimeSpec.MonthsPerQuarter));

            // Q4
            var q4 = new QuarterRange(calendarYear.BaseYear, QuarterKind.Fourth, timeCalendar);
            q4.YearBaseMonth.Should().Be(calendarYear.YearBaseMonth);
            q4.BaseYear.Should().Be(calendarYear.BaseYear);
            q4.Start.Should().Be(new DateTime(currentYear + 1, 7, 1));
            q4.End.Should().Be(q4.TimeCalendar.MapEnd(q4.Start.AddMonths(TimeSpec.MonthsPerQuarter)));
            q4.UnmappedEnd.Should().Be(q4.Start.AddMonths(TimeSpec.MonthsPerQuarter));
        }
Esempio n. 19
0
        public void YearCompareTest() {
            var moment = new DateTime(2008, 2, 18);
            var calendarYearSweden = new YearRange(moment, TimeCalendar.New(January));
            calendarYearSweden.YearBaseMonth.Should().Be(January);

            var calendarYearGermany = new YearRange(moment, TimeCalendar.New(April));
            calendarYearGermany.YearBaseMonth.Should().Be(April);

            var calendarYearUnitedStates = new YearRange(moment, TimeCalendar.New(October));
            calendarYearUnitedStates.YearBaseMonth.Should().Be(October);

            calendarYearSweden.Should().Not.Be.EqualTo(calendarYearGermany);
            calendarYearSweden.Should().Not.Be.EqualTo(calendarYearUnitedStates);
            calendarYearGermany.Should().Not.Be.EqualTo(calendarYearUnitedStates);

            calendarYearSweden.BaseYear.Should().Be(calendarYearGermany.BaseYear + 1);
            calendarYearSweden.BaseYear.Should().Be(calendarYearUnitedStates.BaseYear + 1);

            calendarYearSweden.GetPreviousYear().BaseYear.Should().Be(calendarYearGermany.GetPreviousYear().BaseYear + 1);
            calendarYearSweden.GetPreviousYear().BaseYear.Should().Be(calendarYearUnitedStates.GetPreviousYear().BaseYear + 1);

            calendarYearSweden.GetNextYear().BaseYear.Should().Be(calendarYearGermany.GetNextYear().BaseYear + 1);
            calendarYearSweden.GetNextYear().BaseYear.Should().Be(calendarYearUnitedStates.GetNextYear().BaseYear + 1);

            calendarYearSweden.IntersectsWith(calendarYearGermany).Should().Be.True();
            calendarYearSweden.IntersectsWith(calendarYearUnitedStates).Should().Be.True();
            calendarYearGermany.IntersectsWith(calendarYearUnitedStates).Should().Be.True();
        }
Esempio n. 20
0
        public void GetNextYearTest() {
            DateTime currentYearStart = new DateTime(ClockProxy.Clock.Now.Year, 4, 1);

            var currentYear = new YearRange(currentYearStart.Year, TimeCalendar.New(TimeSpan.Zero, TimeSpan.Zero, April));
            var nextYear = currentYear.GetNextYear();

            nextYear.IsReadOnly.Should().Be.True();
            nextYear.YearBaseMonth.Should().Be(April);
            nextYear.BaseYear.Should().Be(currentYearStart.Year + 1);
            nextYear.Start.Should().Be(currentYearStart.AddYears(1));
            nextYear.End.Should().Be(currentYearStart.AddYears(2));
        }
Esempio n. 21
0
        public void AddYearsTest() {
            var currentYear = new YearRange(TimeCalendar.New(April));

            currentYear.AddYears(0).Should().Be(currentYear);

            var pastYear = currentYear.AddYears(-10);
            pastYear.Start.Should().Be(currentYear.Start.AddYears(-10));
            pastYear.End.Should().Be(currentYear.End.AddYears(-10));

            var futureYear = currentYear.AddYears(10);
            futureYear.Start.Should().Be(currentYear.Start.AddYears(10));
            futureYear.End.Should().Be(currentYear.End.AddYears(10));
        }
Esempio n. 22
0
        public void GetHalfyearsTest() {
            var year = new YearRange(TimeCalendar.New(October));

            var index = 0;
            foreach(var halfyear in year.GetHalfyears()) {
                halfyear.BaseYear.Should().Be(year.BaseYear);
                halfyear.Start.Should().Be(year.Start.AddMonths(index * TimeSpec.MonthsPerHalfyear));
                halfyear.End.Should().Be(halfyear.TimeCalendar.MapEnd(halfyear.Start.AddMonths(TimeSpec.MonthsPerHalfyear)));

                index++;
            }

            Assert.AreEqual(TimeSpec.HalfyearsPerYear, index);
        }
Esempio n. 23
0
        public void GetQuartersTest() {
            var year = new YearRange(TimeCalendar.New(October));

            var index = 0;
            foreach(var quarter in year.GetQuarters()) {
                quarter.BaseYear.Should().Be(year.BaseYear);
                quarter.Start.Should().Be(year.Start.AddMonths(index * TimeSpec.MonthsPerQuarter));
                quarter.End.Should().Be(quarter.TimeCalendar.MapEnd(quarter.Start.AddMonths(TimeSpec.MonthsPerQuarter)));
                index++;
            }
            index.Should().Be(TimeSpec.QuartersPerYear);
        }
Esempio n. 24
0
        public void GetMonthsTest() {
            var year = new YearRange(TimeCalendar.New(October));

            var months = year.GetMonths().ToList();
            months.Count.Should().Be(TimeSpec.MonthsPerYear);

            for(var m = 0; m < months.Count; m++) {
                var month = months[m];
                month.Start.Should().Be(year.Start.AddMonths(m));
                month.End.Should().Be(month.TimeCalendar.MapEnd(month.Start.AddMonths(1)));
            }
        }
Esempio n. 25
0
 public void YearBaseMonthTest() {
     var year = new YearRange(TimeCalendar.New(April));
     year.YearBaseMonth.Should().Be(April);
     new YearRange().YearBaseMonth.Should().Be(January);
 }
Esempio n. 26
0
        public void YearMomentTest() {
            const int yearIndex = 2002;
            var year = new YearRange(new DateTime(yearIndex, 3, 15));

            year.IsReadOnly.Should().Be.True();
            year.BaseYear.Should().Be(yearIndex);
            year.Start.Should().Be(new DateTime(yearIndex, 1, 1));
            year.End.Should().Be.LessThan(new DateTime(yearIndex + 1, 1, 1));
        }
Esempio n. 27
0
        public void YearPeriodTest() {
            var currentYear = ClockProxy.Clock.Now.Year;
            var yearStart = new DateTime(currentYear, 4, 1);
            var yearEnd = yearStart.AddYears(1);

            var year = new YearRange(currentYear, TimeCalendar.New(TimeSpan.Zero, TimeSpan.Zero, April));

            year.IsReadOnly.Should().Be.True();
            year.YearBaseMonth.Should().Be(April);
            year.BaseYear.Should().Be(yearStart.Year);
            year.Start.Should().Be(yearStart);
            year.End.Should().Be(yearEnd);
        }