public void NumSeatsAvailable_AfterReservingSeatHold_ShouldReturnSameNumberOfAvailableSeats() { // Arrange BasicVenue oneRowFiveSeatsVenue = new BasicVenue(1, 5); ITicketService ticketService = new BasicTicketService(oneRowFiveSeatsVenue, TestData.HourHoldDuration); // Act SeatHold seatHold = ticketService.FindAndHoldSeats(3, TestData.TestCustomerEmail); int numSeatsAvailableAfterHold = ticketService.NumSeatsAvailable(); ticketService.ReserveSeats(seatHold.Id, TestData.TestCustomerEmail); int numSeatsAvailableAfterReservation = ticketService.NumSeatsAvailable(); // Assert Assert.AreEqual(2, numSeatsAvailableAfterHold); Assert.AreEqual(2, numSeatsAvailableAfterReservation); }
public void NumSeatsAvailable_NoHeldSeats_ShouldReturnTotalVenueCapacity() { // Arrange BasicVenue singleSeatVenue = new BasicVenue(1, 1); ITicketService ticketService = new BasicTicketService(singleSeatVenue, TestData.HourHoldDuration); // Act int actualNumSeatsAvailable = ticketService.NumSeatsAvailable(); // Assert Assert.AreEqual(1, actualNumSeatsAvailable); }
public void NumSeatsAvailable_AfterReleasingHold_ShouldIncrementAvailableSeats() { // Arrange BasicVenue singleSeatVenue = new BasicVenue(1, 1); ITicketService ticketService = new BasicTicketService(singleSeatVenue, TestData.NegativeHoldDuration); // Act ticketService.FindAndHoldSeats(1, TestData.TestCustomerEmail); int actualNumSeatsAvailable = ticketService.NumSeatsAvailable(); // Assert Assert.AreEqual(1, actualNumSeatsAvailable, $"The seat should be released when NumSeatsAvailable is called."); }
public void NumSeatsAvailable_AfterHoldingAllSeats_ShouldReturnNoAvailableSeats() { // Arrange BasicVenue oneRowFiveSeatsVenue = new BasicVenue(1, 5); ITicketService ticketService = new BasicTicketService(oneRowFiveSeatsVenue, TestData.HourHoldDuration); // Act ticketService.FindAndHoldSeats(5, TestData.TestCustomerEmail); int actualNumSeatsAvailable = ticketService.NumSeatsAvailable(); // Assert Assert.AreEqual(0, actualNumSeatsAvailable); }