Esempio n. 1
0
        public void CreateBooking( )
        {
            IBookingServices     bs  = new BookingServices();
            ICustomerServices    cs  = new CustomerServices();
            IEscapeRoom_Services es  = new EscapeRoom_Services();
            IEmplyeeServices     ems = new EmplyeeServices();

            ModelLayer.Customer   cus = cs.Get("Anorak");
            ModelLayer.Employee   em  = ems.Get(1);
            ModelLayer.EscapeRoom er  = es.GetForOwner(1);
            Booking hostBook;
            Booking book = new Booking()
            {
                amountOfPeople = 22,
                bookingTime    = new TimeSpan(16, 00, 0000),
                cus            = cus,
                date           = DateTime.Now.AddDays(7.0).Date,
                emp            = em,
                er             = er
            };


            //Act
            bs.Create(book.emp.employeeID, book.cus.username, book.er.escapeRoomID, book.bookingTime, book.amountOfPeople, book.date);
            hostBook = bs.Get(book.er.escapeRoomID, book.cus.username, book.date);

            //Assert
            Assert.AreEqual(book.date.Date, hostBook.date.Date);
            Assert.AreEqual(book.emp.employeeID, hostBook.emp.employeeID);
            Assert.AreEqual(book.cus.username, hostBook.cus.username);

            bs.Delete(book.emp.employeeID, book.cus.username, book.er.escapeRoomID, book.bookingTime, book.amountOfPeople, book.date);

            Assert.IsNull(bs.Get(book.er.escapeRoomID, book.cus.username, book.date).cus);
        }
Esempio n. 2
0
        public void CreateRoom( )
        {
            //Arrange
            IEscapeRoom_Services ess    = new EscapeRoom_Services();
            IEmplyeeServices     empSer = new EmplyeeServices();

            ModelLayer.EscapeRoom Es1 = new ModelLayer.EscapeRoom();
            ModelLayer.Employee   Em1 = empSer.Get(1);
            Es1.name         = "The Dark Room";
            Es1.description  = "The Force is Strong in the darkRoom";
            Es1.maxClearTime = 180;
            Es1.cleanTime    = 90;
            Es1.price        = 1200;
            Es1.rating       = 0;
            Es1.emp          = Em1;
            Es1.Image        = null;

            //Act
            ess.CreateEscapeRoom(Es1.name, Es1.description, Es1.maxClearTime, Es1.cleanTime, Es1.price, Es1.rating, Es1.emp.employeeID, Es1.Image);

            //Assert
            List <ModelLayer.EscapeRoom> escapeRooms = new List <ModelLayer.EscapeRoom>();

            escapeRooms = (List <ModelLayer.EscapeRoom>)ess.GetAllForOwner();
            bool found = false;
            int  i     = 0;

            ModelLayer.EscapeRoom EsR = new ModelLayer.EscapeRoom();

            while (i < escapeRooms.Count && !found)
            {
                if (escapeRooms.ElementAt(i).name.Equals(Es1.name))
                {
                    EsR   = escapeRooms.ElementAt(i);
                    found = true;
                }
                else
                {
                    i++;
                }
            }

            Assert.IsTrue(found);

            if (EsR.escapeRoomID != 0)
            {
                ess.DeleteEscapeRoom(EsR.escapeRoomID);
            }
        }