public void ParkDALTests() { /*TEST GetAllParks method*/ //Arrange ParkDAL parkDAL = new ParkDAL(connectionString); //Act List <Park> parks = parkDAL.GetAllParks(); //Assert Assert.AreEqual(_numberOfParks, parks.Count);//retrieved the number of rows beforehand to compare to the count in the returned list /*TEST GetAllCampgrounds method*/ List <Campground> campgrounds = parkDAL.GetAllCampgrounds(parks[0].ParkID); //using the first index of the returned list from GetAllParks Assert.AreEqual(_numberOfCampgroundsWithinPark, campgrounds.Count); //retrieved number of campgrounds within park_id = 1 beforehand /*TEST GetAllSites method*/ List <Site> sites = parkDAL.GetAllSites(campgrounds[0].CampgroundID); //using the first index of the returned list from GetAllCampgrounds Assert.AreEqual(_numberOfSitesWithinCampground, sites.Count); //retrieved number of campgrounds within campground_id = 1 beforehand /*TEST GetAllSites method*/ //using the first index of the returned list from GetAllCampgrounds, a test from_date, a test to_date List <Site> sitesAvailable = parkDAL.GetSelectedSites(campgrounds[0].CampgroundID, "2018-10-15", "2018-10-20"); Assert.AreEqual(_numberOfSitesAvailable, sitesAvailable.Count);//retrieved number of campgrounds within campground_id = 1 beforehand }
public void AllParksTest() { ParkDAL thisPark = new ParkDAL(connectionString); List <ParkModel> listOfParks = thisPark.GetAllParks(); Assert.AreEqual(parkCount, listOfParks.Count); }
public void GetAllParksTest() { ParkDAL parkDal = new ParkDAL(connectionString); List <Park> parks = parkDal.GetAllParks(); Assert.IsNotNull(parks); Assert.AreEqual(parkCount, parks.Count); }
public void GetAllParks_Test() { //Arrange ParkDAL dal = new ParkDAL(ConnectionString); //Act var parks = dal.GetAllParks(); //Assert Assert.AreEqual(1, parks.Count); }
public void GetAllParksTest() { // Arrange ParkDAL parkDal = new ParkDAL(connectionString); // Act List <Park> parks = parkDal.GetAllParks(); //<-- use our dummy country // Assert Assert.IsTrue(parks.Count > 0); Assert.AreEqual("AAA", parks[0].ParkCode); }
public void GetAllParksTest() { //Arrange ParkDAL dal = new ParkDAL(connectionString); //Act List <Park> parks = dal.GetAllParks(); //Assert Assert.IsNotNull(parks); Assert.AreEqual(numberOfParks + 1, parks.Count); }
public void GetAllParksTest() { // Arrange ParkDAL pDAL = new ParkDAL(connectionString); //Act IList <Park> park = pDAL.GetAllParks(); //Assert int parkTotal = park.Count; Assert.AreEqual(1, parkTotal); }
public void RunCLI() { Console.Clear(); while (true) { Console.Clear(); //Calls method to show header ShowHeader(); //Calls method to show park list - from dictionary BuildParkListForMenu(); //Input string selection = Console.ReadLine(); int parkSelection; ParkInfoCLI parkInfo = new ParkInfoCLI(); ParkDAL dal = new ParkDAL(DatabaseConnection); IDictionary <int, Park> parks = dal.GetAllParks(); // Try Parse park selection bool parkKey = int.TryParse(selection, out parkSelection); if (parkKey == false) { if (selection.ToLower() == "q") { return; } else { Console.WriteLine("Please enter a valid selection."); Thread.Sleep(2000); } } else { if (parks.ContainsKey(parkSelection)) { //Call sub menu for park info parkInfo.DisplayParkInfo(parks[parkSelection]); } else { Console.WriteLine("Please enter a valid selection."); Thread.Sleep(2000); } } } }
public void GetAllParksTest() { IParkDAL parkDal = new ParkDAL(connString); List <Park> parks = parkDal.GetAllParks(); Assert.IsNotNull(parks); List <string> names = new List <string>(); foreach (Park park in parks) { names.Add(park.Name); } CollectionAssert.Contains(names, "Nico National Park"); }
public void GetAllParksTest() { using (TransactionScope transaction = new TransactionScope()) { //Arrange int parkId = InsertFakeParK("Blue Stone", "Canada", DateTime.UtcNow, 587, 4, "This is a park."); ParkDAL testClass = new ParkDAL(); //Act List <Park> parks = testClass.GetAllParks(); bool containsAPark = parks.Exists(p => p.Name == "Blue Stone"); //Assert Assert.IsTrue(containsAPark); } }
/// <summary> /// Build Park Selection Menu /// </summary> private void BuildParkListForMenu() { //int parkNumber = 1; //Connect to Park DAL class ParkDAL dal = new ParkDAL(DatabaseConnection); IDictionary <int, Park> parks = dal.GetAllParks(); foreach (KeyValuePair <int, Park> park in parks) { Console.WriteLine(park.Key + ") " + park.Value.Name); //parkNumber++; } Console.WriteLine($"Q) Quit"); }
// GET: Home public ActionResult Index() { List <Park> nationalParks = parkDal.GetAllParks(); return(View("Index", nationalParks)); }
public void GetAllParks_Test() { List <Park> parks = new List <Park>(dal.GetAllParks()); Assert.AreEqual(2, parks.Count); }