public void add_customer_trip_with_overlapping_trips_expect_exception(DateTimeOffset firstStart, DateTimeOffset firstEnd, DateTimeOffset secondStart, DateTimeOffset secondEnd) { var trip = new Trip(Guid.NewGuid(), "TripName", "Destination", firstStart, firstEnd, DateTimeOffsetProvider); var customer = DomainTestsHelper.ValidCustomer; trip.AddCustomer(customer); var overlappingTrip = new Trip(Guid.NewGuid(), "TripName", "Destination", secondStart, secondEnd, DateTimeOffsetProvider); Action act = () => overlappingTrip.AddCustomer(customer); act.Should().Throw <DomainException>() .Where(ex => ex.ErrorCode == DomainErrorCodes.OverlappingTripDates); }
public async Task AddCustomerToTripAsync(Trip trip, Customer customer) { trip.AddCustomer(customer); await UpdateTripAsync(trip); }