public void InsertNewBookingTest() { Reservation reservation = new Reservation() { from_date = dateStart, to_date = dateEnd, reservation_name = "Test", site_id = 1 }; int id = resDAO.InsertNewBooking(reservation); Assert.AreNotEqual(0, id); Reservation getReservation = resDAO.FindReservation(id); Assert.AreEqual(reservation.from_date, getReservation.from_date); Assert.AreEqual(reservation.to_date, getReservation.to_date); Assert.AreEqual(reservation.reservation_name, getReservation.reservation_name); Assert.AreEqual(reservation.site_id, getReservation.site_id); }
private void AvailableCampsites(int campgroundID_input, DateTime arrivalDate, DateTime departDate) { IList <Site> AvailableSites = cliHelper.DoCampSiteSearch(this.campgroundDAO, campgroundID_input, arrivalDate, departDate); Campground campground = campgroundDAO.FindCampground(campgroundID_input); if (AvailableSites.Count == 0) { //need functionality here to direct the user back up to dates menue Console.WriteLine("Sorry... There are no campsites for these dates. "); Console.WriteLine("Would you like to choose new Dates? (Y/N)"); if (Console.ReadLine().ToLower() == "y") { //send them to date menu } } int totalDays = (departDate - arrivalDate).Days; Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine(" Thank you for that information. Here are the sites that are available with your information:"); Console.ResetColor(); Console.WriteLine(); string campInfo = string.Format("{0, -7} {1, -13} {2, -15} {3, -17} {4,-12} {5,-17} {6, -12}\n ", " ID", "Site Number", "Max Occupancy", "Handicap Access", "Utilities", "Max RV Length", "Total Price"); Console.WriteLine(campInfo); for (int i = 0; i < 5; i++) { Console.WriteLine(String.Format("{0, -12} {1, -15} {2, -13} {3, -13} {4, -18} {5,-14} {6, -10} ", $" {AvailableSites[i].site_id}.", $"{AvailableSites[i].site_number}", $"{AvailableSites[i].max_occupancy}", $"{AvailableSites[i].AccessibleMssg}", $"{AvailableSites[i].UtilitiesMssg}", $"{AvailableSites[i].max_rv_length}", $"{(totalDays * campground.daily_fee):c2}")); } Console.WriteLine(); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine(" Which site should would you like to reserve? (Please enter the ID number listed)"); Console.ResetColor(); int siteNum; int.TryParse(Console.ReadLine(), out siteNum); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine(" What name should we enter for the reservation?"); Console.ResetColor(); string resName = Console.ReadLine(); Reservation reservation = cliHelper.ReserveSite(AvailableSites, arrivalDate, departDate, siteNum, resName); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine(); Console.WriteLine($" Congratulations! You have placed your reservation. " + $"\n Your confirmation number is: {reservationDAO.InsertNewBooking(reservation)}. " + "\n Please hold onto this number for future reference."); Console.ResetColor(); Console.WriteLine(); Console.WriteLine(" You can enter 'M' to return to the main menu, or any other key to quit."); string finalTransaction = Console.ReadLine(); if (finalTransaction == "m") { PrintHeader(); PrintMenu(); RunCLI(); } System.Environment.Exit(0); }