public void GetAvailableSitesOnCampgroundTest()
        {
            string       Camp        = "Camp Blue";
            DateTime     StartDate   = new DateTime(2020, 1, 2);
            DateTime     EndDate     = new DateTime(2020, 1, 3);
            CampsiteDAO  campsiteDAO = new CampsiteDAO(connectionString);
            IList <Site> sites       = campsiteDAO.GetAvailableSitesOnCampground(Camp, StartDate, EndDate);

            Assert.AreEqual(1, sites.Count);
        }
Пример #2
0
        public void makeReservationTest()
        {
            string         Camp           = "Camp Blue";
            DateTime       StartDate      = new DateTime(2020, 1, 2);
            DateTime       EndDate        = new DateTime(2020, 1, 3);
            CampsiteDAO    campsiteDAO    = new CampsiteDAO(connectionString);
            IList <Site>   sites          = campsiteDAO.GetAvailableSitesOnCampground(Camp, StartDate, EndDate);
            ReservationDAO reservationDAO = new ReservationDAO(connectionString);
            int            confirmationNo = reservationDAO.makeReservation(sites[0], "John Brown", StartDate, EndDate);

            Assert.IsTrue(confirmationNo > newreservation_id);
        }
        public void GetPriceOfStayTest()
        {
            CampsiteDAO  campsiteDAO = new CampsiteDAO(connectionString);
            string       Camp        = "Camp Red";
            DateTime     StartDate   = new DateTime(2020, 3, 2);
            DateTime     EndDate     = new DateTime(2020, 3, 4);
            IList <Site> sites       = campsiteDAO.GetAvailableSitesOnCampground(Camp, StartDate, EndDate);
            Site         s           = sites[0];
            decimal      price       = campsiteDAO.GetPriceOfStay(s, StartDate, EndDate);

            Assert.AreEqual(price, 200M);
        }
        public void GetTop5CampsitesTest()
        {
            CampsiteDAO   campsiteDAO = new CampsiteDAO(connectionString);
            string        Camp        = "Camp Red";
            DateTime      StartDate   = new DateTime(2020, 3, 2);
            DateTime      EndDate     = new DateTime(2020, 3, 3);
            IList <Site>  sites       = campsiteDAO.GetAvailableSitesOnCampground(Camp, StartDate, EndDate);
            List <string> top5        = campsiteDAO.GetTop5Campsites(sites, StartDate, EndDate);
            //string s = "Site number: " + "2" + " MaxOccupancy: " + "6" + " Is Accessible: " + "Yes" + " Max RV: " + "25" + " Utilities:  " + "Yes" + " Total Price: " + "$100.00";

            string siteNumber   = "2";
            string maxOccupancy = "6";
            string isAccessible = "Yes";
            string maxRV        = "25";
            string utilities    = "Yes";
            string totalPrice   = "$100.00";

            string s = $"{siteNumber,-15}{maxOccupancy,-15}{isAccessible,-15}{maxRV,-15}{utilities,-15}{totalPrice,-15}";

            Assert.AreEqual(s, top5[0]);
        }