public void TestCampground() { var park = CreatePark("Mt. Airy"); park.Id = _db.AddPark(park); var campgrounds = _db.GetCampgrounds(park.Id); Assert.AreEqual(0, campgrounds.Count); var bobGround = CreateCampground("Bob", park.Id); bobGround.Id = _db.AddCampground(bobGround); var timGround = CreateCampground("Tim", park.Id); timGround.Id = _db.AddCampground(timGround); campgrounds = _db.GetCampgrounds(park.Id); Assert.AreEqual(2, campgrounds.Count); foreach (var campground in campgrounds) { if (campground.Id == bobGround.Id) { Assert.AreEqual(bobGround.Name, campground.Name); Assert.AreEqual(bobGround.ParkId, campground.ParkId); Assert.AreEqual(bobGround.OpenFromMonth, campground.OpenFromMonth); Assert.AreEqual(bobGround.OpenToMonth, campground.OpenToMonth); Assert.AreEqual(bobGround.DailyFee, campground.DailyFee); } } }
/// <summary> /// Manages the reservation workflow for the entire park /// </summary> /// <param name="park">The park information the reservtion is for</param> private void DisplayParkWideReservation(ParkItem park) { ReservationInfo reservationInfo = new ReservationInfo(); List <SiteInfo> siteInfos = new List <SiteInfo>(); try { reservationInfo = GetReservationInfo(reservationInfo); var campgrounds = _db.GetCampgrounds(park.Id); foreach (var campground in campgrounds) { reservationInfo.CampgroundId = campground.Id; var sites = _db.GetSites(reservationInfo); foreach (var site in sites) { siteInfos.Add(site.CreateSiteInfo(campground.DailyFee, campground.Name)); } } ReservationItem item = new ReservationItem(); item.SiteId = GetSiteSelection(siteInfos, reservationInfo, "", true); DisplayCompleteReservation(reservationInfo, item); throw new ExitToMainException(); } catch (ExitException) { // do nothing, the user cancelled the reservation process } }