public void SetYearSafe_preserves_second() { var dateTime = new DateTime(2014, 7, 7, 22, 32, 46); var actual = dateTime.SetYearSafe(2015); Assert.AreEqual(dateTime.Second, actual.Second); }
public void SetYearSafe_preserves_minute() { var dateTime = new DateTime(2014, 7, 7, 22, 32, 46); var actual = dateTime.SetYearSafe(2015); Assert.AreEqual(dateTime.Minute, actual.Minute); }
public void SetYearSafe_preserves_month() { var dateTime = new DateTime(2014, 7, 7, 22, 32, 46); var actual = dateTime.SetYearSafe(2020); Assert.AreEqual(dateTime.Month, actual.Month); }
public void SetYearSafe_preserves_hour() { var dateTime = new DateTime(2014, 7, 7, 22, 32, 46); var actual = dateTime.SetYearSafe(2015); Assert.AreEqual(dateTime.Hour, actual.Hour); }
public void SetYearSafe_preserves_day() { var dateTime = new DateTime(2014, 7, 7, 22, 32, 46); var actual = dateTime.SetYearSafe(2020); Assert.AreEqual(dateTime.Day, actual.Day); }
public void SetYearSafe_lower_bounding_applied() { var dateTime = new DateTime(2014, 7, 7, 22, 32, 46); var actual = dateTime.SetYearSafe(0); Assert.AreEqual(1, actual.Year); }
public void SetYearSafe_adjusts_day_for_leapYear() { var dateTime = new DateTime(2016, 2, 29, 7, 22, 32, 46); var actual = dateTime.SetYearSafe(2015); Assert.AreEqual(28, actual.Day); }
public void SetYearSafe() { var dateTime = new DateTime(2014, 7, 7, 22, 32, 46); const int newYear = 2016; var actual = dateTime.SetYearSafe(newYear); Assert.AreEqual(newYear, actual.Year); }