AddMonth() 공개 정적인 메소드

public static AddMonth ( int startYear, int startMonth, int count ) : YearAndMonth
startYear int
startMonth int
count int
리턴 YearAndMonth
예제 #1
0
        public void AddMonthTest()
        {
            for (int i = 1; i <= TimeSpec.MonthsPerYear; i++)
            {
                TimeTool.AddMonth(1, i).Month.Should().Be(i % TimeSpec.MonthsPerYear + 1);
            }

            for (var i = 1; i <= TimeSpec.MonthsPerYear; i++)
            {
                TimeTool.AddMonth(1, -i).Month.Should().Be((1 - i) <= 0 ? (TimeSpec.MonthsPerYear + 1 - i) : 1 - i);
            }

            const int ThreeYears = 3 * TimeSpec.MonthsPerYear;

            for (var i = 1; i < ThreeYears; i++)
            {
                var yearAndMonth = TimeTool.AddMonth(new YearAndMonth(2008, 1), i);

                yearAndMonth.Year.Should().Be(2008 + i / TimeSpec.MonthsPerYear);
                yearAndMonth.Month.Should().Be(i % TimeSpec.MonthsPerYear + 1);
            }
        }