public void Should_not_have_error_when_EndDate_is_GreaterThan_StartDate() { // Arrange ContractModelValidator validator = new ContractModelValidator(); var contracModel = new Model.ContractModel() { StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(1) }; // Act var result = validator.TestValidate(contracModel); //Assert Assert.True(result.IsValid); }
public void Should_have_error_when_EndDate_isnot_GreaterThan_StartDate() { // Arrange ContractModelValidator validator = new ContractModelValidator(); var contracModel = new Model.ContractModel() { StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(-1) }; // Act var result = validator.TestValidate(contracModel); //Assert result.ShouldHaveValidationErrorFor(x => x.EndDate); Assert.False(result.IsValid); }