public void CheckIfDateIsBeforeToday_EnterTheDateOfYesterday_ResultIsFalse() { //Arrange var date = DateTime.Now.AddDays(-1); var result = false; //Act try { //The method CheckIfDateIsBeforeToday has a void return type and throws a InvalidDateException when the date is invalid InputValidation.CheckIfDateIsBeforeToday(date); result = true; } catch (InvalidDateException e) { result = false; } //Assert Assert.False(result); }
public void CheckIfDateIsBeforeToday_EnterADateAYearAwayFromCurrentDate_ResultIsTrue() { //Arrange var date = DateTime.Now.AddYears(1); var result = false; //Act try { //The method CheckIfDateIsBeforeToday has a void return type and throws a InvalidDateException when the date is invalid InputValidation.CheckIfDateIsBeforeToday(date); result = true; } catch (InvalidDateException e) { result = false; } //Assert Assert.True(result); }