private void SearchForSite() { Console.Clear(); //clears the screen and displays the campground options Console.WriteLine(); Console.WriteLine("**Please note, if your reservation date is during the park off-season, campgrounds will be unavailable to book**"); GetCampGrounds(); Console.WriteLine(); //searches to book reservation tempCampId = CLIHelper.GetInteger("Which campground would you like to reserve? (enter C to cancel and go back to park listing)"); arriveDate = CLIHelper.GetDateTime("What is the arrival date? __/__/____"); departDate = CLIHelper.GetDateTime("What is the departure date? __/__/____"); SiteDAL dal = new SiteDAL(DatabaseConnection); IList <CampSite> campSites = dal.SearchForSiteTotalAmt(tempParkId, tempCampId, arriveDate, departDate); Console.WriteLine(); Console.WriteLine(("Site No.").PadRight(15) + ("Max Occup.").PadRight(30) + ("Accessible?").PadRight(15) + ("Max RV Length").PadRight(15) + ("Utility").PadRight(15) + ("Fee").PadRight(15)); if (campSites.Count > 0) { foreach (CampSite site in campSites) { Console.WriteLine((site.SiteNumber.ToString()).PadRight(15) + (site.MaxOccupancy.ToString()).PadRight(30) + (site.Accessible.ToString()).PadRight(15) + (site.MaxRVLength.ToString()).PadRight(15) + (site.Utilities.ToString()).PadRight(15) + "$" + (site.Fee.ToString()).PadRight(15)); } BookReservation(); } else { Console.WriteLine("**** NO SPOTS OPEN TO RESERVE ****"); Console.WriteLine("Press Y to go back to park options" + Environment.NewLine + "Press N to Exit"); string choice = Console.ReadLine(); switch (choice.ToLower()) { case "y": DisplayParkOptions(); break; case "n": Environment.Exit(0); break; default: Console.WriteLine("Please Choose a valid option."); break; } } }
public void SearchForSiteTotalTest() { // Arrange SiteDAL sDAL = new SiteDAL(connectionString); //Act double p = 0; IList <CampSite> site = sDAL.SearchForSiteTotalAmt(1, 1, DateTime.Now.AddDays(4), DateTime.Now.AddDays(8)); foreach (CampSite s in site) { p = s.Fee; } //Assert Assert.AreEqual(140.00D, p); }