コード例 #1
0
 public static void GetWeeksInYear()
 {
     for (int year = 0; year <= 400; year++)
     {
         int expected = s_yearsWith53Weeks.Contains(year) ? 53 : 52;
         Assert.Equal(expected, ISOWeek.GetWeeksInYear(2000 + year));
     }
 }
コード例 #2
0
 public static void GetYear(DateTime date, int expected)
 {
     Assert.Equal(expected, ISOWeek.GetYear(date));
 }
コード例 #3
0
 public static void GetYearEnd_ForYear9999_Throws()
 {
     AssertExtensions.Throws <ArgumentOutOfRangeException>("value", () => ISOWeek.GetYearEnd(9999));
 }
コード例 #4
0
 public static void GetYearEnd(int year, DateTime expected)
 {
     Assert.Equal(expected, ISOWeek.GetYearEnd(year));
 }
コード例 #5
0
 public static void GetWeeksInYear_WithInvalidYear_Throws(int year)
 {
     AssertExtensions.Throws <ArgumentOutOfRangeException>(nameof(year), () => ISOWeek.GetWeeksInYear(year));
 }
コード例 #6
0
 public static void ToDateTime_WithInvalidDayOfWeek_Throws(int dayOfWeek)
 {
     AssertExtensions.Throws <ArgumentOutOfRangeException>(nameof(dayOfWeek), () => ISOWeek.ToDateTime(2018, 1, (DayOfWeek)dayOfWeek));
 }
コード例 #7
0
 public static void ToDateTime_WithInvalidYear_Throws(int year)
 {
     AssertExtensions.Throws <ArgumentOutOfRangeException>(nameof(year), () => ISOWeek.ToDateTime(year, 1, DayOfWeek.Friday));
 }
コード例 #8
0
 public static void ToDateTime(int year, int week, DayOfWeek dayOfWeek, DateTime expected)
 {
     Assert.Equal(expected, ISOWeek.ToDateTime(year, week, dayOfWeek));
 }