public void ReturnsCorrectErrorWhenEndDateTimeIsLessThanStartDateTime()
        {
            var mockMediator = new Mock<IMediator>();

            mockMediator.Setup(x => x.Send(It.IsAny<EventByIdQuery>())).Returns(new Event { Id = 1, Campaign = new Campaign { TimeZoneId = "UTC" } });

            var validator = new TaskSummaryModelValidator(mockMediator.Object);

            var model = new TaskSummaryModel
            {
                StartDateTime = new DateTimeOffset(new DateTime(2000, 1, 1)),
                EndDateTime = new DateTimeOffset(new DateTime(1999, 1, 1))
            };

            var errors = validator.Validate(model);

            Assert.True(errors.Exists(x => x.Key.Equals("EndDateTime")));
            Assert.Equal(errors.Find(x => x.Key == "EndDateTime").Value, "End date cannot be earlier than the start date");
        }
        public void ReturnsNoErrorForNonItineraryTaskWhenModelsDatesAreValid()
        {
            var mockMediator = new Mock<IMediator>();

            mockMediator.Setup(x => x.Send(It.IsAny<EventByIdQuery>())).Returns(new Event
            {
                Id = 1,
                Campaign = new Campaign
                {
                    TimeZoneId = "UTC",
                },
                StartDateTime = eventStartDate,
                EndDateTime = eventEndDate,
                EventType = EventType.Rally
            });

            var validator = new TaskSummaryModelValidator(mockMediator.Object);

            var model = new TaskSummaryModel
            {
                StartDateTime = eventStartDate.AddDays(1),
                EndDateTime = eventEndDate.AddDays(-1)
            };

            var errors = validator.Validate(model);

            Assert.True(errors.Count == 0);
        }