Exemplo n.º 1
0
        public void TestCancelBookingResults()
        {
            //Tests the Cancel Booking Results method in the Booking Manager- which takes a BookingDetails object.
            //Grabs the ID for the dummy booking
            int id = TestCleanupAccessor.GetBooking();
            //retrieves the full booking information
            Booking booking1 = myBook.RetrieveBooking(id);

            //Creates a BookingDetails object and assigns variables from the booking to it.
            bookingDetails               = new BookingDetails();
            bookingDetails.BookingID     = id;
            bookingDetails.GuestID       = guestID;
            bookingDetails.EmployeeID    = empID;
            bookingDetails.ItemListID    = itemID;
            bookingDetails.Quantity      = bQuantity;
            bookingDetails.DateBooked    = dateBooked;
            bookingDetails.TicketPrice   = ticket;
            bookingDetails.ExtendedPrice = extended;
            bookingDetails.Discount      = discount;
            bookingDetails.TotalCharge   = total;
            //Passes the object to the CancelBookingResults method and asserts that that cancel will be successful
            ResultsEdit result   = myBook.CancelBookingResults(bookingDetails);
            ResultsEdit expected = ResultsEdit.Success;

            Assert.AreEqual(expected, result);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        public void TestEditBooking()
        {
            // 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 newB = myBook.RetrieveBooking(BookingID);

            //Updates the booking with new quantity
            newB.Quantity = 3;
            int rows     = myBook.EditBooking(newB);
            int expected = 3;
            //Grabs the record to test and see if the update went through
            Booking toCheck = myBook.RetrieveBooking(BookingID);

            Assert.AreEqual(expected, toCheck.Quantity);
        }