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); }
public void EmployeeManagerGetEmpLogin() { //Grabs the fake emp id int ID = TestCleanupAccessor.getTestEmp(); //Gets the entire Employee Record by login info Employee orig = myManager.GetEmployeeLogin(ID, Password); //Asserts that the record returned matches the one in setup. Assert.AreEqual("Test", orig.FirstName); }
public void TestRetrieveBooking() { // Retrieves a booking from the database by ID, first captures the dummy booking from database //using a TestAccessor, then uses a real manager method to be tested. BookingID = TestCleanupAccessor.GetBooking(); Booking booking2 = myBook.RetrieveBooking(BookingID); int expected = 1234; Assert.AreEqual(expected, booking2.TicketPrice); }
public void EmployeeManagerEditEmployee() { //Grabs the fake emp id int ID = TestCleanupAccessor.getTestEmp(); //Gets the entire Employee Record Employee orig = EmployeeAccessor.GetEmployee(ID); //Creates a new employee object with the original properties, update the active property to false. Employee newEmp = new Employee(orig.FirstName, orig.LastName, orig.Password, (int)orig.Level, false); //calls to manager. ResultsEdit result = myManager.EditCurrentEmployee(orig, newEmp); //Asserts that the update went through Assert.AreEqual(ResultsEdit.Success, result); }
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); }
public void TestEditBookingResultsListingFull() { //Tests the Edit Booking Results method in the Booking Manager- which takes an int and a Booking object. //Grabs the ID for the dummy booking int id = TestCleanupAccessor.GetBooking(); //retrieves the full booking information, assigns the initial quantity to an int, then reassigns the object quantity //to a new amount Booking booking1 = myBook.RetrieveBooking(id); int original = booking1.Quantity; booking1.Quantity = 30; //Passes the object to the EditBookingResults method and asserts that that result will be full ResultsEdit result = myBook.EditBookingResult(original, booking1); ResultsEdit expected = ResultsEdit.ListingFull; Assert.AreEqual(expected, result); }
public void EmployeeManagerDeleteRecord() { TestCleanupAccessor.testEmp(testEmp); }
public void CleanupTest() { TestCleanupAccessor.resetItemListing100(); TestCleanupAccessor.testBook(booking); }