예제 #1
0
    public void Finds_fourth_day_of_week_in_a_month()
    {
        var cases = new [] {
            new { month = 3, dayOfWeek = DayOfWeek.Monday, expectation = "2013-3-25" },
            new { month = 5, dayOfWeek = DayOfWeek.Tuesday, expectation = "2013-5-28" },
            new { month = 7, dayOfWeek = DayOfWeek.Wednesday, expectation = "2013-7-24" },
            new { month = 9, dayOfWeek = DayOfWeek.Thursday, expectation = "2013-9-26" },
            new { month = 12, dayOfWeek = DayOfWeek.Friday, expectation = "2013-12-27" },
            new { month = 2, dayOfWeek = DayOfWeek.Saturday, expectation = "2013-2-23" },
            new { month = 4, dayOfWeek = DayOfWeek.Sunday, expectation = "2013-4-28" }
        };

        foreach (var c in cases)
        {
            DateTime day = new Meetup(c.month, 2013).Day(c.dayOfWeek, Schedule.Fourth);
            Assert.That(day.ToString("yyyy-M-d"), Is.EqualTo(c.expectation));
        }
    }
예제 #2
0
    public void Finds_first_teenth_day_of_week_in_a_month()
    {
        var cases = new [] {
            new { month = 5, dayOfWeek = DayOfWeek.Monday, expectation = "2013-5-13" },
            new { month = 3, dayOfWeek = DayOfWeek.Tuesday, expectation = "2013-3-19" },
            new { month = 1, dayOfWeek = DayOfWeek.Wednesday, expectation = "2013-1-16" },
            new { month = 5, dayOfWeek = DayOfWeek.Thursday, expectation = "2013-5-16" },
            new { month = 4, dayOfWeek = DayOfWeek.Friday, expectation = "2013-4-19" },
            new { month = 2, dayOfWeek = DayOfWeek.Saturday, expectation = "2013-2-16" },
            new { month = 10, dayOfWeek = DayOfWeek.Sunday, expectation = "2013-10-13" }
        }.ToList();

        foreach (var c in cases)
        {
            DateTime day = new Meetup(c.month, 2013).Day(c.dayOfWeek, Schedule.Teenth);
            Assert.That(day.ToString("yyyy-M-d"), Is.EqualTo(c.expectation));
        }
    }
예제 #3
0
 public string Finds_third_day_of_week_in_a_month(int month, DayOfWeek dayOfWeek)
 {
     DateTime day = new Meetup(month, 2013).Day(dayOfWeek, Schedule.Third);
     return day.ToString("yyyy-M-d");
 }
예제 #4
0
    public string Finds_last_day_of_week_in_a_month(int month, DayOfWeek dayOfWeek)
    {
        DateTime day = new Meetup(month, 2013).Day(dayOfWeek, Schedule.Last);

        return(day.ToString("yyyy-M-d"));
    }
예제 #5
0
 public string Finds_first_teenth_day_of_week_in_a_month(int month, DayOfWeek dayOfWeek)
 {
     var day = new Meetup(month, 2013).Day(dayOfWeek, Schedule.Teenth);
     return day.ToString("yyyy-M-d");
 }
예제 #6
0
    public void Finds_last_day_of_week_in_a_month(int month, DayOfWeek dayOfWeek, string expected)
    {
        DateTime day = new Meetup(month, 2013).Day(dayOfWeek, Schedule.Last);

        Assert.Equal(expected, day.ToString("yyyy-M-d"));
    }