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)); } }
public static void GetYear(DateTime date, int expected) { Assert.Equal(expected, ISOWeek.GetYear(date)); }
public static void GetYearEnd_ForYear9999_Throws() { AssertExtensions.Throws <ArgumentOutOfRangeException>("value", () => ISOWeek.GetYearEnd(9999)); }
public static void GetYearEnd(int year, DateTime expected) { Assert.Equal(expected, ISOWeek.GetYearEnd(year)); }
public static void GetWeeksInYear_WithInvalidYear_Throws(int year) { AssertExtensions.Throws <ArgumentOutOfRangeException>(nameof(year), () => ISOWeek.GetWeeksInYear(year)); }
public static void ToDateTime_WithInvalidDayOfWeek_Throws(int dayOfWeek) { AssertExtensions.Throws <ArgumentOutOfRangeException>(nameof(dayOfWeek), () => ISOWeek.ToDateTime(2018, 1, (DayOfWeek)dayOfWeek)); }
public static void ToDateTime_WithInvalidYear_Throws(int year) { AssertExtensions.Throws <ArgumentOutOfRangeException>(nameof(year), () => ISOWeek.ToDateTime(year, 1, DayOfWeek.Friday)); }
public static void ToDateTime(int year, int week, DayOfWeek dayOfWeek, DateTime expected) { Assert.Equal(expected, ISOWeek.ToDateTime(year, week, dayOfWeek)); }