public void ReserveSeats_TwiceOnSameSeatHold_ShouldThrowException() { // Arrange BasicVenue venue = new BasicVenue(3, 3); ITicketService ticketService = new BasicTicketService(venue, TestData.HourHoldDuration); // Act SeatHold seatHold = ticketService.FindAndHoldSeats(1, TestData.TestCustomerEmail); ticketService.ReserveSeats(seatHold.Id, TestData.TestCustomerEmail); ticketService.ReserveSeats(seatHold.Id, TestData.TestCustomerEmail); }
public void ReserveSeats_TwoReservations_ShouldHaveDifferentReservationCodes() { // Arrange BasicVenue venue = new BasicVenue(3, 3); ITicketService ticketService = new BasicTicketService(venue, TestData.HourHoldDuration); // Act SeatHold firstSeatHold = ticketService.FindAndHoldSeats(1, TestData.TestCustomerEmail); SeatHold secondSeatHold = ticketService.FindAndHoldSeats(1, TestData.TestCustomerEmail); string firstReservationCode = ticketService.ReserveSeats(firstSeatHold.Id, TestData.TestCustomerEmail); string secondReservationCode = ticketService.ReserveSeats(secondSeatHold.Id, TestData.TestCustomerEmail); // Assert Assert.AreNotEqual(firstReservationCode, secondReservationCode, "Reservation codes should never be the same."); }
public void ReserveSeats_NoHeldSeats_ShouldThrowException() { // Arrange BasicVenue venue = new BasicVenue(3, 3); ITicketService ticketService = new BasicTicketService(venue, TestData.HourHoldDuration); // Act ticketService.ReserveSeats(1, TestData.TestCustomerEmail); }
public void ReserveSeats_ValidSeatHold_ShouldReserveSeats() { // Arrange BasicVenue venue = new BasicVenue(3, 3); ITicketService ticketService = new BasicTicketService(venue, TestData.HourHoldDuration, 8); // Act SeatHold seatHold = ticketService.FindAndHoldSeats(1, TestData.TestCustomerEmail); string reservationCode = ticketService.ReserveSeats(seatHold.Id, TestData.TestCustomerEmail); // Assert Assert.AreEqual(8, reservationCode.Length); }
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); }