public void ValidationReturnsMultipleErrorCountWhenDatesAreNotCorrect() { var model = new PostViewModel { ValidFrom = DateTime.UtcNow.AddDays(-1), ValidUntil = DateTime.UtcNow.AddDays(-4), }; var errorsCount = model.Validate(null).Count(); Assert.True(errorsCount > 1); }
public void ValidationPassesWhenValidFromDateIsGreaterThanCurrentDateAndValidUntilDateIsGreaterThanValidFromDate() { var model = new PostViewModel { ValidFrom = DateTime.UtcNow, ValidUntil = DateTime.UtcNow.AddDays(1), }; var errorsCount = model.Validate(null).Count(); Assert.Equal(0, errorsCount); }
public void ValidationFailsWhenCurrentDateIsGreaterThanValidFromDate() { var model = new PostViewModel { ValidFrom = DateTime.UtcNow.AddDays(-1), ValidUntil = DateTime.UtcNow.AddDays(3), }; var errorsCount = model.Validate(null).Count(); Assert.True(errorsCount > 0); }