Beispiel #1
0
        public void ViewCampgrounds_ShouldReturnAllCampgrounds()
        {
            CampGroundSqlDAO   dao         = new CampGroundSqlDAO(ConnectionString);
            IList <CampGround> campGrounds = dao.ViewCampgrounds(ParkId);

            Assert.AreEqual(1, campGrounds.Count);
        }
        public void IsValidCampgroundInvalidInputTest()
        {
            //Arrange
            CampGroundSqlDAO campgroundDAO = new CampGroundSqlDAO(connectionString);
            //Act
            bool isValid = campgroundDAO.IsValidCampground(testParkId, 30);

            //Assert
            Assert.AreEqual(false, isValid);
        }
        public void IsValidCampgroundHappyTest()
        {
            //Arrange
            CampGroundSqlDAO campgroundDAO = new CampGroundSqlDAO(connectionString);
            //Act
            bool isValid = campgroundDAO.IsValidCampground(testParkId, testCampgroundId);

            //Assert
            Assert.AreEqual(true, isValid);
        }
        public void GeCampgroundByParkIdTest()
        {
            //Arrange
            CampGroundSqlDAO campgroundDAO = new CampGroundSqlDAO(connectionString);
            //Act
            IList <CampGround> campgrounds = campgroundDAO.GetCampGroundByParkId(testParkId);

            //Assert
            Assert.IsTrue(campgrounds.Count > 0);
        }
        public void BetweenOpenMonthsTestClosed()
        {
            //Arrange
            CampGroundSqlDAO campgroundDAO = new CampGroundSqlDAO(connectionString);
            //Act
            bool isOpen = campgroundDAO.BetweenOpenMonths(testCampgroundId, 2);

            //Assert
            Assert.AreEqual(false, isOpen);
        }
        public void CampGroundMonthToReserveTest()
        {
            //Arrange
            CampGroundSqlDAO campgroundDAO = new CampGroundSqlDAO(connectionString);
            //Act
            int month = campgroundDAO.CampGroundMonthToReserve(testStartDate);

            //Assert
            Assert.AreEqual(6, month);
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            // Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            string connectionString = configuration.GetConnectionString("Project");

            ICampGroundDAO  campGroundDAO  = new CampGroundSqlDAO(connectionString);
            IParkDAO        parkDAO        = new ParkSqlDAO(connectionString);
            ISiteDAO        siteDAO        = new SiteSqlDAO(connectionString);
            IReservationDAO reservationDAO = new ReservationSqlDAO(connectionString);

            ParksReservationCLI parksReservationCLI = new ParksReservationCLI(parkDAO, campGroundDAO, siteDAO, reservationDAO);

            parksReservationCLI.RunCLI();
        }