Exemplo 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);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor for Booking with all the parameters
 /// </summary>
 /// <param name="amountOfPeople">the amount of peple on the booking</param>
 /// <param name="date">the date of the booking</param>
 /// <param name="bookingTime">the time for the booking</param>
 /// <param name="cus">the customer on the booking</param>
 /// <param name="er">the booked escaperoom</param>
 /// <param name="emp">the employee on the booking</param>
 public Booking(int amountOfPeople, DateTime date, TimeSpan bookingTime, Customer cus, EscapeRoom er, Employee emp)
 {
     this.amountOfPeople = amountOfPeople;
     this.date           = date;
     this.bookingTime    = bookingTime;
     this.cus            = cus;
     this.er             = er;
     this.emp            = emp;
 }