public void GetBookingsForTodayWhenRepositoryIsFaulty() { // Arrange var response_handler = new GetBookingForDateResponseHandler(); var booking_repository = new FaultyBookingRepository(); var get_booking_for_date_interaction = new GetBookingForDateInteractor(response_handler, booking_repository); // Act get_booking_for_date_interaction.Execute(); // Assert Assert.IsTrue(response_handler.Exception != null); Assert.IsTrue(response_handler.Bookings == null || response_handler.Bookings.Count == 0); }
public void GetBookingsForTodayWhenThereAreNone() { // Arrange var today = new DateTime(2018, 1, 1, 10, 0, 0); var expected = bookings.Where(booking => booking.Start.Date == today.Date || booking.End.Date == today.Date).ToList(); var response_handler = new GetBookingForDateResponseHandler(); var booking_repository = new InMemoryBookingRepository(); booking_repository.Bookings = bookings; var get_booking_for_date_interaction = new GetBookingForDateInteractor(response_handler, booking_repository); get_booking_for_date_interaction.Date = today; // Act get_booking_for_date_interaction.Execute(); // Assert Assert.IsTrue(response_handler.Bookings.Count == 0); CollectionAssert.AreEqual(expected, response_handler.Bookings.ToList()); }