public void GetAvailabilityFromPark_ReturnsCount0Again() { // Arrange ParkSqlDAL dal = new ParkSqlDAL(ConnectionString); IList <Campsite> campsite = dal.ParkAvailability(0, new DateTime(2018, 07, 21), new DateTime(2018, 07, 23)); // Assert Assert.AreEqual(0, campsite.Count); }
public void GetAvailabilityFromPark_DateIsAvailable() { // Arrange ParkSqlDAL dal = new ParkSqlDAL(ConnectionString); int iD = 0; DateTime start = new DateTime(2000, 10, 01); DateTime end = new DateTime(2000, 10, 10); IList <Campsite> campsite = dal.ParkAvailability(iD, start, end); // Assert Assert.AreEqual(0, campsite.Count); }
private void GetParkAvailability_View() { // ParkAvailability DateTime startDate = CLIHelper.GetDateTime("What is the arrival date? mm/dd/yyyy"); DateTime endDate = CLIHelper.GetDateTime("What is the departure date? mm/dd/yyyy"); ParkSqlDAL parkDAL = new ParkSqlDAL(DatabaseConnection); IList <Campsite> availableCampsites = parkDAL.ParkAvailability(this.ChosenParkID, startDate, endDate); int lengthOfStay = (int)(endDate - startDate).TotalDays; CampgroundSqlDAL campgroundDAL = new CampgroundSqlDAL(DatabaseConnection); IList <Campground> campgroundsList = campgroundDAL.GetCampgroundsFromPark(this.ChosenParkID); Dictionary <int, Campground> campgroundDict = this.ListToDict(campgroundsList); if (availableCampsites.Count > 0) { 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)); foreach (Campsite campsite in availableCampsites) { fee = campgroundDict[campsite.Campground_Id].Daily_Fee; cost = fee * lengthOfStay; this.PrintCampsiteAvailability( campgroundDict[campsite.Campground_Id].Name, campsite.Site_Number, campsite.Max_Occupancy, campsite.IsAccessible, campsite.Max_RV_Length, campsite.HasUtilities, cost); } } else { Console.WriteLine("**** NO RESULTS ****"); } }