public void TestCampgroundList()
        {
            TransactionScope test = new TransactionScope();

            ParkSqlDAL  parkDAL = new ParkSqlDAL(connectionString);
            List <Park> park    = parkDAL.GetParks();

            CampgroundSqlDAL campgroundDAL = new CampgroundSqlDAL(connectionString);

            List <Campground> testNumberOfCampsAcadia         = campgroundDAL.GetAllCampgroundFromPark(park[0]);
            List <Campground> testNumberOfCampsArches         = campgroundDAL.GetAllCampgroundFromPark(park[1]);
            List <Campground> testNumberOfCampsCuyahogaValley = campgroundDAL.GetAllCampgroundFromPark(park[2]);

            //assert
            bool outputAcadia_doesCampCountNumberMatch = testNumberOfCampsAcadia.Count == 3;

            Assert.IsTrue(outputAcadia_doesCampCountNumberMatch);

            bool outputArches_doesCampCountNumberMatch = testNumberOfCampsArches.Count == 3;

            Assert.IsTrue(outputArches_doesCampCountNumberMatch);

            bool outputCuyahogaValley_doesCampCountNumberMatch = testNumberOfCampsCuyahogaValley.Count == 1;

            Assert.IsTrue(outputCuyahogaValley_doesCampCountNumberMatch);

            test.Dispose();
        }
        public void TestCampgroundName()
        {
            TransactionScope testNames = new TransactionScope();

            ParkSqlDAL  parkDAL = new ParkSqlDAL(connectionString);
            List <Park> park    = parkDAL.GetParks();

            CampgroundSqlDAL campgroundDAL = new CampgroundSqlDAL(connectionString);

            List <Campground> testNamesOfCampsAcadia = campgroundDAL.GetAllCampgroundFromPark(park[0]);

            List <Campground> testNamesOfCampsArches = campgroundDAL.GetAllCampgroundFromPark(park[1]);

            List <Campground> testNamesOfCampsCuyahoga = campgroundDAL.GetAllCampgroundFromPark(park[2]);

            //assert
            bool outputArcadia_isCampNameCorrect1 = testNamesOfCampsAcadia[0].name == "Blackwoods";

            Assert.IsTrue(outputArcadia_isCampNameCorrect1);

            bool outputArcadia_isCampNameCorrect2 = testNamesOfCampsAcadia[2].name == "Schoodic Woods";

            Assert.IsTrue(outputArcadia_isCampNameCorrect2);

            bool outputArches_isCampNameCorrect1 = testNamesOfCampsAcadia[0].name == "Devil's Garden";

            Assert.IsTrue(outputArches_isCampNameCorrect1);

            bool outputArches_isCampNameCorrect2 = testNamesOfCampsAcadia[2].name == "Juniper Group Site";

            Assert.IsTrue(outputArches_isCampNameCorrect2);

            bool outputCuyahogaValley_isCampNameCorrect1 = testNamesOfCampsAcadia[2].name == "The Unnamed Primitive Campsites";

            Assert.IsTrue(outputCuyahogaValley_isCampNameCorrect1);

            testNames.Dispose();
        }
        public void TestListSiteDAL()
        {
            testScope = new TransactionScope();
            DateTime startTime = new DateTime(2016, 08, 01);
            DateTime endTime   = new DateTime(2016, 08, 03);

            ParkSqlDAL  parkDAL = new ParkSqlDAL(connectionString);
            List <Park> park    = parkDAL.GetParks();

            CampgroundSqlDAL  campgroundDAL           = new CampgroundSqlDAL(connectionString);
            List <Campground> testNumberOfCampsAcadia = campgroundDAL.GetAllCampgroundFromPark(park[0]);

            SiteSqlDAL siteDal = new SiteSqlDAL(connectionString);

            List <Site> availableSites = siteDal.GetAvailableSites(testNumberOfCampsAcadia[0], startTime, endTime);

            Assert.IsNotNull(availableSites);
            Assert.IsTrue(availableSites.Count > 0);

            testScope.Dispose();
        }
Exemplo n.º 4
0
        // this method displays the campgrounds for the currently selected park //
        private List <Campground> ViewCampgrounds()
        {
            CampgroundSqlDAL  dal         = new CampgroundSqlDAL(connectionString);
            List <Campground> campgrounds = dal.GetAllCampgroundFromPark(selectedPark);

            Console.WriteLine();
            Console.WriteLine($"{selectedPark.name} Park Campgrounds");
            Console.WriteLine("------------------------------------------------------------------------");
            Console.WriteLine("| {0,-3}| {1,-35}|{2,6} |{3,6} | {4,10} |", $"ID", $"Name", $"Open", $"Close", $"Fee   ");
            Console.WriteLine("------------------------------------------------------------------------");
            if (campgrounds.Count > 0)
            {
                for (int i = 0; i < campgrounds.Count; i++)
                {
                    Console.WriteLine("| {0,-3}| {1,-35}|{2,6} |{3,6} | {4,10} |", $"{i + 1}", $"{campgrounds[i].name}", $"{campgrounds[i].open_from_mm.ToString()}", $"{campgrounds[i].open_to_mm.ToString()}", $"{campgrounds[i].daily_fee.ToString("C")}");
                }
            }
            else
            {
                Console.WriteLine("**** NO RESULTS ****");
            }
            Console.WriteLine("------------------------------------------------------------------------");
            return(campgrounds);
        }