Exemplo n.º 1
0
        public void SearchInSeasonTest()
        {
            // Arrange
            CampgroundsSqlDAL campgroundDAL = new CampgroundsSqlDAL(connectionString);
            DateTime          arrival       = new DateTime(2019, 6, 1);
            DateTime          departure     = new DateTime(2019, 6, 10);
            UserReservation   reserve       = new UserReservation(campId, arrival, departure);

            //Act
            bool isInSeason = campgroundDAL.SearchInSeason(reserve);

            //Assert
            Assert.IsTrue(isInSeason);

            //Set up a new test that should return false.
            DateTime        arrival2    = new DateTime(2019, 2, 15);
            DateTime        departure2  = new DateTime(2019, 2, 22);
            UserReservation reserve2    = new UserReservation(campId, arrival2, departure2);
            bool            isInSeason2 = campgroundDAL.SearchInSeason(reserve2);

            Assert.IsFalse(isInSeason2);

            //add test where you put departure before arrival, etc
            //test bounds like max dates/ end dates
        }
Exemplo n.º 2
0
        public void ListCampgroundsTest()
        {
            //Arrange
            CampgroundsSqlDAL campgroundDAL = new CampgroundsSqlDAL(connectionString);

            //Act
            //parkId established in the TestInitialize section above
            List <Campground> campgrounds = campgroundDAL.ListAllCampgrounds(1);

            //Assert
            Assert.AreEqual("Test", campgrounds[campgrounds.Count - 1].CampgroundName);
            Assert.AreEqual(22.00m, campgrounds[campgrounds.Count - 1].DailyFee);
        }
Exemplo n.º 3
0
        public void DisplayCampgrounds(int park_id)
        {
            //This method was created because we needed to do the same code in 2 separate methods.
            CampgroundsSqlDAL campgroundSqlDal = new CampgroundsSqlDAL(connectionString);
            List <Campground> campgrounds      = campgroundSqlDal.GetCampgrounds(park_id);
            ParksSqlDAL       parksSqlDal      = new ParksSqlDAL(connectionString);
            Park currentPark = parksSqlDal.GetPark(park_id);

            Console.WriteLine(currentPark.Name + " National Park Campgrounds");
            Console.WriteLine();
            Console.Write("Name".PadLeft(9).PadRight(39));
            Console.Write("Open".PadRight(15));
            Console.Write("Close".PadRight(14));
            Console.WriteLine("Daily Fee");
            foreach (Campground campground in campgrounds)
            {
                campground.DisplayCampground();
            }
        }