public void ReturnsNoErrorForWhenDatesIsBetweenStartAndEndOfParentEvent() { var sut = new ItineraryEditModelValidator(); var model = new ItineraryEditModel { EventId = 1, Date = eventStartDate.AddDays(1).DateTime }; var errors = sut.Validate(model, TestEvent); Assert.True(errors.Count == 0); }
public void ReturnsCorrectErrorWhenModelsDateIsGreaterThanParentEventEndDate() { var sut = new ItineraryEditModelValidator(); var model = new ItineraryEditModel { EventId = 1, Date = eventEndDate.AddDays(1).DateTime }; var errors = sut.Validate(model, TestEvent); Assert.True(errors.Exists(x => x.Key.Equals("Date"))); Assert.Equal(errors.Find(x => x.Key == "Date").Value, "Date cannot be later than the event end date " + eventEndDate.Date.ToString("d")); }