public void MustBeAValidDateClient() { var viewModel = new DateViewModel(); var viewModelValidator = new DateViewModelClientValidator(); viewModelValidator.ShouldHaveValidationErrorFor(x => x.Day, viewModel); }
public void YearRangeCheckFailed(int?year) { var viewModel = new DateViewModel { Year = year }; var viewModelValidator = new DateViewModelClientValidator(); viewModelValidator.ShouldHaveValidationErrorFor(x => x.Year, viewModel); }
public void YearRangeCheck(int yearOffset, bool expectValid) { var viewModel = new DateViewModel { Year = DateTime.Now.Year + yearOffset }; var viewModelValidator = new DateViewModelClientValidator(); if (expectValid) { viewModelValidator.ShouldNotHaveValidationErrorFor(x => x.Year, viewModel); } else { viewModelValidator.ShouldHaveValidationErrorFor(x => x.Year, viewModel); } }
public void MonthRangeCheck(int?month, bool expectValid) { var viewModel = new DateViewModel { Month = month }; var viewModelValidator = new DateViewModelClientValidator(); if (expectValid) { viewModelValidator.ShouldNotHaveValidationErrorFor(x => x.Month, viewModel); } else { viewModelValidator.ShouldHaveValidationErrorFor(x => x.Month, viewModel); } }
public void DayRangeCheck(int?day, bool expectValid) { var viewModel = new DateViewModel { Day = day }; var viewModelValidator = new DateViewModelClientValidator(); if (expectValid) { viewModelValidator.ShouldNotHaveValidationErrorFor(x => x.Day, viewModel); } else { viewModelValidator.ShouldHaveValidationErrorFor(x => x.Day, viewModel); } }