public void GetAvailability_ReturnsCount0Again1() { // Arrange CampgroundSqlDAL dal = new CampgroundSqlDAL(ConnectionString); IList <Campsite> campsite = dal.CampgroundAvailability(CampgroundId, new DateTime(2018, 07, 21), new DateTime(2018, 07, 22)); // Assert Assert.AreEqual(0, campsite.Count); }
public void GetAvailability_DateIsAvailable() { // Arrange CampgroundSqlDAL dal = new CampgroundSqlDAL(ConnectionString); //int iD = 0; DateTime start = new DateTime(2000, 10, 01); DateTime end = new DateTime(2000, 10, 10); IList <Campsite> campsite = dal.CampgroundAvailability(CampgroundId, start, end); // Assert Assert.AreEqual(1, campsite.Count); }
// LEVEL: CAMPGROUND ///////////////////////////////////////// private int[] GetCampgroundAvailability_View(int campgroundID, DateTime startDate, DateTime endDate) { CampgroundSqlDAL campDAL = new CampgroundSqlDAL(DatabaseConnection); IList <Campsite> availableCampsites = campDAL.CampgroundAvailability(campgroundID, startDate, endDate); int lengthOfStay = (int)(endDate - startDate).TotalDays; Campground campground = campDAL.CampgroundDetails(campgroundID); if (availableCampsites.Count > 0) { int[] output = new int[availableCampsites.Count]; decimal cost = 0; decimal fee = 0; Console.WriteLine( "Campground".PadRight(30) + "Site No.".PadRight(15) + "Max Occup.".ToString().PadRight(15) + "Accessible".PadRight(15) + "RV Len".PadRight(15) + "Utility".PadRight(15) + "Cost".PadLeft(20)); int i = 0; foreach (Campsite campsite in availableCampsites) { output[i] = campsite.Site_Number; fee = campground.Daily_Fee; cost = fee * lengthOfStay; this.PrintCampsiteAvailability( campground.Name, campsite.Site_Number, campsite.Max_Occupancy, campsite.IsAccessible, campsite.Max_RV_Length, campsite.HasUtilities, cost); i++; } return(output); } else { Console.WriteLine("**** NO RESULTS ****"); return(new int[0]); } }