Example #1
0
        public void GetReservation_ReturnAllReservation()
        {
            //Arrange
            ReservationSQLDAO dao = new ReservationSQLDAO(this.connectionString);


            //Act
            IList <Reservation> list = dao.GetReservations(SiteId);

            //Assert
            Assert.AreEqual(1, list.Count);
        }
Example #2
0
        public void CreateReservation_AddToList()
        {
            //Arrange
            ReservationSQLDAO   dao    = new ReservationSQLDAO(this.connectionString);
            IList <Reservation> list   = dao.GetReservations(SiteId);
            int reservationCountBefore = list.Count;

            //Act
            Reservation reservation = new Reservation();

            dao.AddReservation(SiteId, "Patt", DateTime.Parse("06/06/2019"), DateTime.Parse("06/07/2019"));


            //Assert
            list = dao.GetReservations(SiteId);
            int reservationCountAfter = list.Count;

            Assert.AreEqual(reservationCountBefore + 1, reservationCountAfter);
        }
Example #3
0
        public void GetSites_ReturnTopFive()
        {
            //Arrange
            SiteSQLDAO dao = new SiteSQLDAO(this.connectionString);

            ReservationSQLDAO Rdao = new ReservationSQLDAO(this.connectionString);

            IList <Site> list = dao.GetSites(DateTime.Parse("06/06/2019"), DateTime.Parse("06/07/2019"), CampgroundID);

            int listCountBefore = list.Count;

            //Act
            Rdao.AddReservation(SiteId, "Patt", DateTime.Parse("06/06/2019"), DateTime.Parse("06/07/2019"));

            list = dao.GetSites(DateTime.Parse("06/06/2019"), DateTime.Parse("06/07/2019"), CampgroundID);

            int listCountAfter = list.Count;

            //Assert
            Assert.AreEqual(listCountBefore - 1, listCountAfter);
        }
Example #4
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);
            IReservationDAO reservationDAO = new ReservationSQLDAO(connectionString);
            ISiteDAO        siteDAO        = new SiteSQLDAO(connectionString);



            // Create a menu and run it
            ViewParksMenu menu = new ViewParksMenu(parkDAO, campgroundDAO, reservationDAO, siteDAO);

            menu.Run();
        }