public void TestGetBookingbyIDAccess() { // Retrieves a booking from the database by ID, first captures the dummy booking from database //using a TestAccessor, then uses a real accessor method to be tested. BookingID = TestCleanupAccessor.GetBooking(); Booking booking2 = BookingAccessor.GetBooking(BookingID); decimal expected = 1234; Assert.AreEqual(expected, booking2.TicketPrice); }
public Booking RetrieveBooking(int bookingId) { try { return(BookingAccessor.GetBooking(bookingId)); } catch (Exception) { var ax = new ApplicationException("There was a problem accessing your data."); throw ax; } }
public void TestUpdateBookingAccess() { // Updates the dummy booking in the database, first captures the dummy bookingID from database //using a TestAccessor BookingID = TestCleanupAccessor.GetBooking(); //Assigns one booking object to be the old record and one to be the new record Booking old = BookingAccessor.GetBooking(BookingID); Booking newB = new Booking(guestID, empID, itemID, 3, dateBooked, ticket, extended, discount, total); //Updates the old with the new quantity int rows = BookingAccessor.UpdateBooking(old, newB); int expected = 3; //Grabs the record to test and see if the update went through Booking toCheck = BookingAccessor.GetBooking(BookingID); Assert.AreEqual(expected, toCheck.Quantity); }