public void OrderTrip(int tripId, Domain.Core.Customer customer) { var trip = UnitOfWork.Trips.Get(tripId).CheckForNull(); trip.WithCustomer(customer); UnitOfWork.Trips.Update(trip); UnitOfWork.SaveChanges(); }
public void OrderTrip_ShouldAttachCustomerToTheTrip() { // Arrange var customer = new Domain.Core.Customer().WithName("Dan").Is(Gender.Male) as Domain.Core.Customer; var trip = new Domain.Core.Trip().IsFrom("Kyiv").IsTo("Brovary"); _unitOfWork.Trips.Get(trip.Id).Returns(trip); // Act var service = new TripService(_unitOfWork, _mapper); service.OrderTrip(trip.Id, customer); // Assert trip.Customer.Should().BeEquivalentTo(customer); }