public void SearchMatchingAvailSites(UserReservation userReservation) { sites = siteConnect.GetAvailableSites(userReservation); for (int i = 0; i < campgrounds.Count; i++) { if (campgrounds[i].CampgroundId == userReservation.CampgroundID) { userReservation.CampName = campgrounds[i].CampgroundName; Console.Clear(); Console.WriteLine($"{userReservation.CampName} has the following campsites:"); Console.WriteLine("Site No.".PadRight(15) + "Max Occup.".PadRight(15) + "Accessible".PadRight(15) + "Max RV Length".PadRight(25) + "Utility".PadRight(15) + "Cost"); ShowSites(sites, userReservation, campgrounds[i].DailyFee); } } Console.WriteLine(); int siteInput = CLIHelper.GetInteger("Please choose the site number you would like to book (or 0 to cancel).", sites.Count, true); if (siteInput == 0) { Quit(); } else { ReserveSite(userReservation); } }
public void GetAvailableSitesTest() { //Arrange SitesSqlDAL siteDal = new SitesSqlDAL(connectionString); List <Site> sites = new List <Site>(); DateTime arrival2 = new DateTime(2019, 6, 5); DateTime departure2 = new DateTime(2019, 6, 15); UserReservation reserve4 = new UserReservation(7, arrival2, departure2); //Act sites = siteDal.GetAvailableSites(reserve4); // Assert //Assert.AreEqual(13, sites[siteId1].SiteNumber); //Assert.AreEqual(14, sites[siteId2].SiteNumber); //Assert.AreEqual(15, sites[siteId3].SiteNumber); //Assert.AreEqual(16, sites[siteId4].SiteNumber); CollectionAssert.Contains(sites, site); }