private void GetAllCampgrounds() { ParksDAL pdal = new ParksDAL(DatabaseConnection); List <Park> parks = pdal.GetAllParks(); if (parks.Count > 0) { foreach (Park park in parks) { Console.WriteLine("(" + park.Park_id + ") " + park.Name); Console.WriteLine(); } CampgroundDAL cdal = new CampgroundDAL(DatabaseConnection); int parkId = CLIHelper.GetInteger("Please select a Park Id : "); Console.WriteLine(); List <Campground> campground = cdal.GetAllCampgrounds(parkId); foreach (Campground camp in campground) { Console.WriteLine("(" + camp.CampgroundId + ") " + camp.Name.PadRight(30) + "Opening Month " + months[camp.OpenFromMM].ToString().PadRight(10) + "Closing Month " + months[camp.OpenToMM].ToString().PadRight(10) + "Daily Fee " + camp.DailyFee.ToString("c")); Console.WriteLine(); } } else { Console.WriteLine("**** NO RESULTS ****"); } Console.ReadLine(); }
public void ReturnsCampgroundsCorrectly() { // Arrange CampgroundDAL testClass = new CampgroundDAL(); // Act int expectedParkCount1 = GetCampgroundCount(1); List <Campground> campgrounds1 = testClass.GetAllCampgrounds(1); int expectedParkCount2 = GetCampgroundCount(2); List <Campground> campgrounds2 = testClass.GetAllCampgrounds(2); int expectedParkCount3 = GetCampgroundCount(3); List <Campground> campgrounds3 = testClass.GetAllCampgrounds(3); // Assert Assert.AreEqual(expectedParkCount1, campgrounds1.Count); Assert.AreEqual(expectedParkCount2, campgrounds2.Count); Assert.AreEqual(expectedParkCount3, expectedParkCount3); }
public void GetAllCampgroundsTest() { Campground camp = new Campground(); camp.Name = "fake ground"; camp.OpenFromMM = 01; camp.OpenToMM = 01; camp.DailyFee = 5; camp.ParkId = 1; CampgroundDAL dal = new CampgroundDAL(connectionsrting); List <Campground> output = dal.GetAllCampgrounds(1); Assert.IsTrue(output.Count > 0); }
public List <Campground> PrintAllCampgrounds(int parkId) { Console.Clear(); CampgroundDAL dal = new CampgroundDAL(); List <Campground> campgrounds = dal.GetAllCampgrounds(parkId); int counter = 1; Console.WriteLine("ID".PadRight(6) + "Name".PadRight(35) + "Open".PadRight(15) + "Close".PadRight(15) + "Daily Fee".PadRight(15)); foreach (Campground campground in campgrounds) { Console.WriteLine("#" + campground.CampgroundId.ToString().PadRight(5) + campground.Name.PadRight(35) + DateTimeFormatInfo.CurrentInfo.GetAbbreviatedMonthName(campground.OpeningMonth).ToString().PadRight(15) + DateTimeFormatInfo.CurrentInfo.GetAbbreviatedMonthName(campground.ClosingMonth).ToString().PadRight(15) + campground.DailyFee.ToString("C").PadRight(15)); counter++; } Console.WriteLine(); return(campgrounds); }
public void GetCampgrounds_Test(int id, int expectedResult) { List <Campground> campgrounds = new List <Campground>(dal.GetAllCampgrounds(id)); Assert.AreEqual(expectedResult, campgrounds.Count); }
public void CampgroundsInSelectedPark(int parkId) { CampgroundDAL dal = new CampgroundDAL(DatabaseConnectionString); campgrounds = dal.GetAllCampgrounds(parkId); }