private static void emptyTableBooking() { BookingService bookingSrv = new BookingService(); bookingSrv.emptyTable(); List<BookingBO> bookings = bookingSrv.getAllFromTable(); Assert.AreEqual(0, bookings.Count(), string.Format("'Booking' Table should be empty.")); }
private static void fullFillTableBooking() { RoomService roomSrv = new RoomService(); List<RoomBO> rooms = roomSrv.getAllFromTable(); Assert.AreNotEqual(0, rooms.Count(), string.Format("There should be values in 'Rooms' Table.")); int existingRoomID = rooms.ElementAt(0).RoomID; CustomerService customerSrv = new CustomerService(); List<CustomerBO> customers = customerSrv.getAllFromTable(); Assert.AreNotEqual(0, customers.Count(), string.Format("There should be values in 'Customer' Table.")); int existingCustomerID = customers.ElementAt(0).CustomerID; AdministratorService adminSrv = new AdministratorService(); List<AdministratorBO> admins = adminSrv.getAllFromTable(); Assert.AreNotEqual(0, admins.Count(), string.Format("There should be values in 'Administrator' Table.")); int existingAdminID = admins.ElementAt(0).AdminID; //Verify that booking cannot be created before Customer (CustomerID foreign key) //Verify that booking cannot be created before Room (RoomID foreign key) //Verify that booking cannot be created before Administrator (AdminID foreign key) BookingService bookingSrv = new BookingService(); bookingSrv.addNew(DateTime.Now.AddDays(1), existingRoomID, existingCustomerID, 25, DateTime.Now, existingAdminID, "no smoking");// take first from list bookingSrv.addNew(DateTime.Now.AddDays(1), existingRoomID, existingCustomerID, 40, DateTime.Now, existingAdminID, "no pets allowed"); bookingSrv.addNew(DateTime.Now.AddDays(10), existingRoomID, existingCustomerID, 77, DateTime.Now, existingAdminID, "reconfirm by phone"); bookingSrv.addNew(DateTime.Now.AddDays(17), existingRoomID, existingCustomerID, 55, DateTime.Now, existingAdminID, "reconfirm by phone tomorrow"); bookingSrv.addNew(DateTime.Now.AddDays(-5), existingRoomID, existingCustomerID, 10, DateTime.Now.AddDays(-8), existingAdminID, "catering "); bookingSrv.addNew(DateTime.Now.AddDays(-2), existingRoomID, existingCustomerID, 100, DateTime.Now.AddDays(-5), existingAdminID, "no catering"); List<BookingBO> bookings = bookingSrv.getAllFromTable(); Assert.AreNotEqual(0, bookings.Count(), string.Format("There should be values in 'Booking' Table.")); }