public void SelectJourneys(List <Journey> journeys) { if (journeys == null) { throw new ArgumentNullException($"{nameof(journeys)} is null"); } AggregateIsNewSpecification.Create().ThrowDomainErrorIfNotSatisfied(this); JourneyValidationSpecification.Create().ThrowDomainErrorIfNotSatisfied(journeys); // Raise event Emit(new JourneysSelectedEvent(journeys)); }
public void WhenJourneyIsEmptyShouldReturnFalse() { //Arrange var spec = JourneyValidationSpecification.Create(); var journeys = new List <Journey>(); //Act var isSatisfy = spec.IsSatisfiedBy(journeys); var why = spec.WhyIsNotSatisfiedBy(journeys); //Assert isSatisfy.Should().BeFalse(); why.Should().HaveCount(1); }
public void WhenDepartureDateLessThenNowShouldReturnFalse() { //Arrange var spec = JourneyValidationSpecification.Create(); var journeys = new JourneysBuilder().BuildJourneys(); journeys.ForEach(x => x.DepartureDate = DateTime.Today.AddDays(-1)); //Act var isSatisfy = spec.IsSatisfiedBy(journeys); var why = spec.WhyIsNotSatisfiedBy(journeys); //Assert isSatisfy.Should().BeFalse(); why.Should().HaveCount(1); }