public void SearchForAvailableReservationTest()
        {
            ReservationSqlDAL myDAL = new ReservationSqlDAL(connectionString);

            List <Site> testReservationList = myDAL.SearchForAvailableReservation(siteID, startDate, endDate);

            Assert.AreEqual(testReservationList.Count, 0);

            List <Site> testReservationList2 = myDAL.SearchForAvailableReservation(siteID, Convert.ToDateTime("02/01/2019"), Convert.ToDateTime("02/02/2019"));

            Assert.AreEqual(testReservationList.Count, 1);
        }
コード例 #2
0
        // Called after user chooses a campsite, start date, and end date in order to search for available reservations.
        // Uses a DAO to search the database searching for available sites within the given dates and returns a list of
        // those that are available
        public void SearchForAvailableReservation(int campgroundSelection, DateTime arrivalDate, DateTime departureDate)
        {
            ReservationSqlDAL myDAL          = new ReservationSqlDAL(databaseConnectionString);
            List <Site>       availableSites = myDAL.SearchForAvailableReservation(campgroundSelection, arrivalDate, departureDate);

            Console.WriteLine("Site ID    Max Occupancy");
            foreach (Site site in availableSites)
            {
                Console.WriteLine(site);
            }
            Console.WriteLine();
            ConfirmReservation(campgroundSelection, arrivalDate, departureDate);
        }