AddQuarter() public static method

public static AddQuarter ( this startQuarter, int count ) : YearAndQuarter
startQuarter this
count int
return YearAndQuarter
コード例 #1
0
        public void AddQuarterTest()
        {
            TimeTool.AddQuarter(QuarterKind.First, 1).Quarter.Should().Be(QuarterKind.Second);
            TimeTool.AddQuarter(QuarterKind.Second, 1).Quarter.Should().Be(QuarterKind.Third);
            TimeTool.AddQuarter(QuarterKind.Third, 1).Quarter.Should().Be(QuarterKind.Fourth);
            TimeTool.AddQuarter(QuarterKind.Fourth, 1).Quarter.Should().Be(QuarterKind.First);

            TimeTool.AddQuarter(QuarterKind.First, -1).Quarter.Should().Be(QuarterKind.Fourth);
            TimeTool.AddQuarter(QuarterKind.Second, -1).Quarter.Should().Be(QuarterKind.First);
            TimeTool.AddQuarter(QuarterKind.Third, -1).Quarter.Should().Be(QuarterKind.Second);
            TimeTool.AddQuarter(QuarterKind.Fourth, -1).Quarter.Should().Be(QuarterKind.Third);

            TimeTool.AddQuarter(QuarterKind.First, 2).Quarter.Should().Be(QuarterKind.Third);
            TimeTool.AddQuarter(QuarterKind.Second, 2).Quarter.Should().Be(QuarterKind.Fourth);
            TimeTool.AddQuarter(QuarterKind.Third, 2).Quarter.Should().Be(QuarterKind.First);
            TimeTool.AddQuarter(QuarterKind.Fourth, 2).Quarter.Should().Be(QuarterKind.Second);

            TimeTool.AddQuarter(QuarterKind.First, -2).Quarter.Should().Be(QuarterKind.Third);
            TimeTool.AddQuarter(QuarterKind.Second, -2).Quarter.Should().Be(QuarterKind.Fourth);
            TimeTool.AddQuarter(QuarterKind.Third, -2).Quarter.Should().Be(QuarterKind.First);
            TimeTool.AddQuarter(QuarterKind.Fourth, -2).Quarter.Should().Be(QuarterKind.Second);

            TimeTool.AddQuarter(QuarterKind.First, 3).Quarter.Should().Be(QuarterKind.Fourth);
            TimeTool.AddQuarter(QuarterKind.Second, 3).Quarter.Should().Be(QuarterKind.First);
            TimeTool.AddQuarter(QuarterKind.Third, 3).Quarter.Should().Be(QuarterKind.Second);
            TimeTool.AddQuarter(QuarterKind.Fourth, 3).Quarter.Should().Be(QuarterKind.Third);

            TimeTool.AddQuarter(QuarterKind.First, -3).Quarter.Should().Be(QuarterKind.Second);
            TimeTool.AddQuarter(QuarterKind.Second, -3).Quarter.Should().Be(QuarterKind.Third);
            TimeTool.AddQuarter(QuarterKind.Third, -3).Quarter.Should().Be(QuarterKind.Fourth);
            TimeTool.AddQuarter(QuarterKind.Fourth, -3).Quarter.Should().Be(QuarterKind.First);

            TimeTool.AddQuarter(QuarterKind.First, 4).Quarter.Should().Be(QuarterKind.First);
            TimeTool.AddQuarter(QuarterKind.Second, 4).Quarter.Should().Be(QuarterKind.Second);
            TimeTool.AddQuarter(QuarterKind.Third, 4).Quarter.Should().Be(QuarterKind.Third);
            TimeTool.AddQuarter(QuarterKind.Fourth, 4).Quarter.Should().Be(QuarterKind.Fourth);

            TimeTool.AddQuarter(QuarterKind.First, -4).Quarter.Should().Be(QuarterKind.First);
            TimeTool.AddQuarter(QuarterKind.Second, -4).Quarter.Should().Be(QuarterKind.Second);
            TimeTool.AddQuarter(QuarterKind.Third, -4).Quarter.Should().Be(QuarterKind.Third);
            TimeTool.AddQuarter(QuarterKind.Fourth, -4).Quarter.Should().Be(QuarterKind.Fourth);

            TimeTool.AddQuarter(QuarterKind.First, 2008, 1).Year.Should().Be(2008);
            TimeTool.AddQuarter(QuarterKind.Second, 2008, 1).Year.Should().Be(2008);
            TimeTool.AddQuarter(QuarterKind.Third, 2008, 1).Year.Should().Be(2008);
            TimeTool.AddQuarter(QuarterKind.Fourth, 2008, 1).Year.Should().Be(2009);

            TimeTool.AddQuarter(QuarterKind.First, 2008, 2).Year.Should().Be(2008);
            TimeTool.AddQuarter(QuarterKind.Second, 2008, 2).Year.Should().Be(2008);
            TimeTool.AddQuarter(QuarterKind.Third, 2008, 2).Year.Should().Be(2009);
            TimeTool.AddQuarter(QuarterKind.Fourth, 2008, 2).Year.Should().Be(2009);

            TimeTool.AddQuarter(QuarterKind.First, 2008, 4).Year.Should().Be(2009);
            TimeTool.AddQuarter(QuarterKind.Second, 2008, 4).Year.Should().Be(2009);
            TimeTool.AddQuarter(QuarterKind.Third, 2008, 4).Year.Should().Be(2009);
            TimeTool.AddQuarter(QuarterKind.Fourth, 2008, 4).Year.Should().Be(2009);

            TimeTool.AddQuarter(QuarterKind.First, 2008, 5).Year.Should().Be(2009);
            TimeTool.AddQuarter(QuarterKind.Second, 2008, 5).Year.Should().Be(2009);
            TimeTool.AddQuarter(QuarterKind.Third, 2008, 5).Year.Should().Be(2009);
            TimeTool.AddQuarter(QuarterKind.Fourth, 2008, 5).Year.Should().Be(2010);
        }