Пример #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));
 }