GetPreviousYear() 공개 메소드

public GetPreviousYear ( ) : YearRange
리턴 YearRange
예제 #1
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();
        }
예제 #2
0
        public void GetPreviousYearTest()
        {
            var currentYearStart = new DateTime(ClockProxy.Clock.Now.Year, 4, 1);

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

            previousYear.IsReadOnly.Should().Be.True();
            previousYear.YearBaseMonth.Should().Be(April);
            previousYear.BaseYear.Should().Be(currentYearStart.Year - 1);
            previousYear.Start.Should().Be(currentYearStart.AddYears(-1));
            previousYear.End.Should().Be(currentYearStart);
        }
예제 #3
0
        public void GetPreviousYearTest() {
            var currentYearStart = new DateTime(ClockProxy.Clock.Now.Year, 4, 1);

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

            previousYear.IsReadOnly.Should().Be.True();
            previousYear.YearBaseMonth.Should().Be(April);
            previousYear.BaseYear.Should().Be(currentYearStart.Year - 1);
            previousYear.Start.Should().Be(currentYearStart.AddYears(-1));
            previousYear.End.Should().Be(currentYearStart);
        }
예제 #4
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();
        }