public void TestMethod1( )
        {
            //Arrange
            EscapeRoomServices ess    = new EscapeRoomServices();
            EmployeeCtr        empCtr = new EmployeeCtr();

            MAPMAClient.Model.EscapeRoom Es1 = new MAPMAClient.Model.EscapeRoom();
            MAPMAClient.Model.Employee   Em1 = empCtr.Get(1);
            Es1.Name         = "The Dark Room";
            Es1.Description  = "The Fors is Strong in the darkside";
            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 <MAPMAClient.Model.EscapeRoom> escapeRooms = new List <MAPMAClient.Model.EscapeRoom>();

            escapeRooms = ess.GetAllForOwner();
            bool found = false;
            int  i     = 0;

            MAPMAClient.Model.EscapeRoom EsR = new MAPMAClient.Model.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);
            }
        }
Example #2
0
        /// <summary>
        /// Converts one Employee to MAPMA.Model.Employee
        /// </summary>
        /// <param name="employee"></param>
        /// <returns>MAPMA.Model.Employee</returns>
        private Model.Employee GetEmployeeClientSide(EmpRef.Employee employee)
        {
            MAPMAClient.Model.Employee emp;

            emp = new MAPMAClient.Model.Employee {
                Address    = employee.address,
                CityName   = employee.cityName,
                EmployeeID = employee.employeeID,
                FirstName  = employee.firstName,
                LastName   = employee.lastName,
                Mail       = employee.mail,
                Phone      = employee.phone,
                Region     = employee.region,
                Zipcode    = employee.zipcode
            };

            return(emp);
        }
Example #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);
        }
Example #4
0
        /// <summary>
        /// Converts the list of Employees to MAPMAClient.Model.Employee
        /// </summary>
        /// <param name="employees"></param>
        /// <returns> a list of MAPMAClient.Model.Employee</returns>
        private List <Model.Employee> GetClientsideEmployees(IEnumerable <EmpRef.Employee> employees)
        {
            List <Model.Employee> foundEmp = new List <Model.Employee>();

            Model.Employee emp;

            foreach (var emps in employees)
            {
                emp = new MAPMAClient.Model.Employee {
                    Address    = emps.address,
                    CityName   = emps.cityName,
                    EmployeeID = emps.employeeID,
                    FirstName  = emps.firstName,
                    LastName   = emps.lastName,
                    Mail       = emps.mail,
                    Phone      = emps.phone,
                    Region     = emps.region,
                    Zipcode    = emps.zipcode
                };
                foundEmp.Add(emp);
            }
            return(foundEmp);
        }