public void it_should_add_the_booking_to_the_repository_when_the_car_booking_doesnt_clash_with_an_existing_booking(BookingServiceClashDetectionTestCaseData clashDetectionTestCaseData) { // Act var bookingService = CreateServiceUnderTest(clashDetectionTestCaseData.ExistingBookings); bookingService.MakeCarBooking(clashDetectionTestCaseData.Car, clashDetectionTestCaseData.StartDate, clashDetectionTestCaseData.Duration, clashDetectionTestCaseData.Discount, clashDetectionTestCaseData.Name); // Assert TestContext.WriteLine($"{clashDetectionTestCaseData.TestDescription}{Environment.NewLine}"); TestContext.WriteLine(clashDetectionTestCaseData.ForTestContext()); var findMyBooking = clashDetectionTestCaseData.ExistingBookings.GetCarBookings().FirstOrDefault(x => x.CarId == clashDetectionTestCaseData.Car.Id && x.Name == clashDetectionTestCaseData.Name && x.RentalDate == clashDetectionTestCaseData.StartDate); Assert.IsNotNull(findMyBooking); }
public void it_should_throw_an_exception_when_the_car_booking_clashes_with_an_existing_booking(BookingServiceClashDetectionTestCaseData clashDetectionTestCaseData) { // Act var bookingService = CreateServiceUnderTest(clashDetectionTestCaseData.ExistingBookings); // Assert TestContext.WriteLine($"{clashDetectionTestCaseData.TestDescription}{Environment.NewLine}"); TestContext.WriteLine(clashDetectionTestCaseData.ForTestContext()); Assert.Throws <Exception>(() => bookingService.MakeCarBooking(clashDetectionTestCaseData.Car, clashDetectionTestCaseData.StartDate, clashDetectionTestCaseData.Duration, clashDetectionTestCaseData.Discount, clashDetectionTestCaseData.Name)); }