コード例 #1
0
        public void AddAndGetSeat()
        {
            var testStudent       = GetTestStudents();
            var seatController    = new SeatController(_seatLogger);
            var studentController = new StudentController(_studentLogger);
            var classController   = new ClassController(_classLogger);

            // attempt to get seat
            var request = seatController.GetSeatAPI(testStudent);

            Assert.False(request[0].response);

            // add student
            studentController.RemoveStudent(testStudent);
            request = studentController.AddStudent(testStudent);
            Assert.True(request[0].response);

            // add class for student
            request = studentController.AddClass(testStudent);
            Assert.True(request[0].response);

            // add seat
            request = seatController.AddSeatAPI(testStudent);
            Assert.True(request[0].response);

            // get seat
            request = seatController.GetSeatAPI(testStudent);
            Assert.True(request[0].response);

            // cleanup
            request = studentController.RemoveStudent(testStudent);
            Assert.True(request[0].response);
        }
コード例 #2
0
        public void AddClass()
        {
            var testStudents      = GetTestStudents();
            var studentController = new StudentController(_studentLogger);

            DatabaseConnector.Connector.RemoveStudent(testStudents[0].email);
            var request = studentController.AddStudent(testStudents);

            if (request[0].response)
            {
                var request2 = studentController.AddClass(testStudents);
                Assert.True(request2[0].response);
            }

            // cleanup
            studentController.RemoveStudent(testStudents);
        }
コード例 #3
0
        public void RemoveClassFromStudent()
        {
            var testClass         = GetTestClass();
            var testStudent       = GetTestStudents();
            var studentController = new StudentController(_studentLogger);
            var classController   = new ClassController(_classLogger);

            // add student
            DatabaseConnector.Connector.RemoveStudent(testStudent[0].email);
            var request = studentController.AddStudent(testStudent);

            Assert.True(request[0].response);

            // make class
            DatabaseConnector.Connector.RemoveClass(testClass[0].className);
            var request2 = classController.MakeClassAPI(testClass);

            Assert.True(request2[0].response);

            //add class
            request = studentController.AddClass(testStudent);
            Assert.True(request[0].response);

            // get student, assert class attached to student
            request = studentController.GetStudentAPI(testStudent);
            Assert.True(request[0].classes.Length == 1);

            // remove class from student
            request = studentController.RemoveClassFromStudent(testStudent);
            Assert.True(request[0].response);

            // get student
            request = studentController.GetStudentAPI(testStudent);
            //Assert.True(request[0].classes.Length == 0);

            // cleanup
            classController.RemoveClassAPI(testClass);
            request = studentController.RemoveStudent(testStudent);
            Assert.True(request[0].response);
        }