public void TestMethod1( )
        {
            //Arrange
            BookingCtr    bc       = new BookingCtr();
            CustomerCtr   cc       = new CustomerCtr();
            EscapeRoomCtr esrCtr   = new EscapeRoomCtr();
            EmployeeCtr   empCtr   = new EmployeeCtr();
            EscapeRoom    Er       = esrCtr.GetForOwner(2);
            Customer      cus      = cc.Get("Anorak");
            Employee      em       = empCtr.Get(1);
            TimeSpan      bookTime = new TimeSpan(16, 00, 00);
            Booking       book     = new Booking()
            {
                AmountOfPeople = 10,
                BookingTime    = bookTime,
                Cus            = cus,
                Date           = DateTime.Now.AddDays(7.0).Date,
                Emp            = em,
                Er             = Er
            };

            //Act
            bc.Create(book.Emp, book.Cus, book.Er, book.BookingTime, book.AmountOfPeople, book.Date);
            Booking TestBook = bc.Get(cus, Er, book.Date);

            bc.Update(book.Cus, book.Er, book.Date, book.Emp, 100, book.BookingTime, TestBook.Id);
            TestBook = bc.Get(cus, Er, book.Date);

            //Assert
            Assert.AreEqual(book.Er.Name, TestBook.Er.Name);
            Assert.AreNotEqual(book.AmountOfPeople, TestBook.AmountOfPeople);

            bc.Delete(cus, Er, book.Date, em, TestBook.AmountOfPeople, TestBook.BookingTime);
        }
Esempio n. 2
0
 /// <summary>
 /// An event for when a key is stroke, then it runs the get methode and sets it to customer and sets all the labels
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txbName_KeyDown(object sender, EventArgs e)
 {
     Cus = Cusctr.Get(txbUserName.Text);
     lblFirstNameRead.Text        = Cus.FirstName;
     lblLastNameRead.Text         = Cus.LastName;
     lblPhoneRead.Text            = Cus.Phone;
     lblBookCustomerNameRead.Text = Cus.FirstName + Cus.LastName;
     txbUserName.BackColor        = Color.White;
 }
Esempio n. 3
0
        public void TestBookRoomOwner()
        {
            //Arrange
            BookingCtr    bc  = new BookingCtr();
            CustomerCtr   cc  = new CustomerCtr();
            EscapeRoomCtr ec  = new EscapeRoomCtr();
            EmployeeCtr   emc = new EmployeeCtr();

            MAPMAClient.Model.Customer   cus = cc.Get("Anorak");
            MAPMAClient.Model.EscapeRoom er  = ec.GetForOwner(2);
            MAPMAClient.Model.Employee   em  = emc.Get(1);
            MAPMAClient.Model.Booking    hostBook;
            MAPMAClient.Model.Booking    book = new MAPMAClient.Model.Booking()
            {
                AmountOfPeople = 7,
                BookingTime    = DateTime.Now.TimeOfDay,
                Cus            = cus,
                Date           = DateTime.Now.AddDays(7.0).Date,
                Emp            = em,
                Er             = er
            };
            MAPMAClient.Model.Booking bookWithoutTime = new MAPMAClient.Model.Booking()
            {
                AmountOfPeople = 7,
                Cus            = cus,
                Date           = DateTime.Now.AddDays(7.0).Date,
                Emp            = em,
                Er             = er
            };


            ////Act
            bc.Create(book.Emp, book.Cus, book.Er, book.BookingTime, book.AmountOfPeople, book.Date);
            hostBook = bc.Get(cus, er, book.Date);

            ////Assert
            Assert.AreEqual(bookWithoutTime.Date, hostBook.Date);
            Assert.AreEqual(bookWithoutTime.Emp.EmployeeID, hostBook.Emp.EmployeeID);
            Assert.AreEqual(bookWithoutTime.Cus.Username, hostBook.Cus.Username);

            bc.Delete(cus, er, book.Date, book.Emp, book.AmountOfPeople, book.BookingTime);
        }