public void GetCampsites_Returns_All_Campsites()
        {
            CampsiteSqlDAO        dao       = new CampsiteSqlDAO(base.ConnectionString);
            IList <CampsiteModel> campsites = dao.GetCampsites(base.CampgroundId);

            Assert.AreEqual(base.CampsiteCount, campsites.Count);
        }
        public void GetAvailableReservations_Returns_0_Sites()
        {
            CampsiteSqlDAO  dao        = new CampsiteSqlDAO(base.ConnectionString);
            CampgroundModel campground = new CampgroundModel();

            campground.Campground_Id = base.CampgroundId;
            IList <CampsiteModel> availableSites = dao.GetAvailableReservations(campground, new DateTime(2019, 01, 01), new DateTime(2019, 02, 05));

            Assert.AreEqual(Math.Min(base.CampsiteCount, 5), availableSites.Count);
        }
Exemple #3
0
        public void GetCampSitesByCampgroundsTest()
        {
            //Arrange
            CampsiteSqlDAO dao = new CampsiteSqlDAO(ConnectionString);
            //Act
            IList <Campsite> test = dao.GetCampSitesByCampgrounds(WhiteLodgeCampgroundId);

            //Asserts
            Assert.IsTrue(test.Count == 1);
        }
Exemple #4
0
        public void GetCampsites()
        {
            //Arrange
            CampsiteSqlDAO dao = new CampsiteSqlDAO(ConnectionString);
            //Act
            IList <Campsite> test = dao.GetCampsites();

            //Assert
            Assert.IsTrue(test.Count == 2);
        }
Exemple #5
0
        public void GetAvailabeSitesByParkTest()
        {
            //Arrange
            CampsiteSqlDAO dao      = new CampsiteSqlDAO(ConnectionString);
            DateTime       fromDate = new DateTime(2001, 2, 27, 12, 0, 0);
            DateTime       toDate   = new DateTime(2001, 4, 24, 12, 0, 0);
            //Act
            IList <Campsite> test = dao.GetAvailabeSitesByPark(TwinPeaksParkId, fromDate, toDate);

            //Asserts
            Assert.AreEqual(2, test.Count);
        }
Exemple #6
0
        public void GetSiteAndReservationDateTest()
        {
            //Arrange
            CampsiteSqlDAO dao      = new CampsiteSqlDAO(ConnectionString);
            DateTime       fromDate = new DateTime(1991, 2, 26, 12, 0, 0);
            DateTime       toDate   = new DateTime(1991, 4, 26, 12, 0, 0);
            //Act
            IList <Campsite> test = dao.GetAvailableSitesFilteredByDate(WhiteLodgeCampgroundId, fromDate, toDate, "");

            //Asserts
            Assert.IsTrue(test.Count == 1);
        }
        public void ConstructsCampsitesProperly()
        {
            //Assign
            CampsiteSqlDAO   campsiteSqlDAO = new CampsiteSqlDAO(ConnectionString);
            IList <Campsite> campsites      = campsiteSqlDAO.GetCampsites();

            //Assert
            Assert.AreEqual(BlackLodgeCampgroundId, campsites[0].Campground_Id);
            Assert.AreEqual(9, campsites[0].Site_Number);
            Assert.AreEqual(100, campsites[0].Max_Occupancy);
            Assert.AreEqual(true, campsites[0].IsAccessible);
            Assert.AreEqual(0, campsites[0].Max_Rv_Length);
            Assert.AreEqual(true, campsites[0].HasUtilities);
        }
Exemple #8
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");

            IParkSqlDAO        parkSqlDAO         = new ParkSqlDAO(@"Server=.\SQLEXPRESS;Database=npcampground;Trusted_Connection=True;");
            ICampgroundSqlDAO  campgroundSqlDAO   = new CampgroundSqlDAO(@"Server=.\SQLEXPRESS;Database=npcampground;Trusted_Connection=True;");
            ICampsiteSqlDAO    campsiteSqlDAO     = new CampsiteSqlDAO(@"Server=.\SQLEXPRESS;Database=npcampground;Trusted_Connection=True;");
            IReservationSqlDAO reservationsSqlDAO = new ReservationSqlDAO(@"Server=.\SQLEXPRESS;Database=npcampground;Trusted_Connection=True;");

            ReservationSystemCLI cli = new ReservationSystemCLI(parkSqlDAO, campgroundSqlDAO, campsiteSqlDAO, reservationsSqlDAO);

            cli.ReservationInterface();
        }