Пример #1
0
        public void CourseExists_CourseExists_True()
        {
            Course course = generator.CreateCourse(testcoursetitle, testdepartmentname, testlastnameinstructor, testfirstnameinstructor, testlogininstructor, testpasswordinstructor);
            var    result = StudentEnrollmentBL.CourseExists(course.CourseID);

            Assert.True(result);
        }
Пример #2
0
        public ActionResult Subscribe(int id)
        {
            int studentID = (int)TempData["StudentID"];

            if (StudentEnrollmentBL.CourseExists(id) && StudentEnrollmentBL.CanStudentSubscribe(studentID, id))
            {
                StudentEnrollmentBL.Subscribe(studentID, id);
            }
            else if (StudentEnrollmentBL.CourseExists(id) && !StudentEnrollmentBL.CanStudentSubscribe(studentID, id))
            {
                TempData["Error"] = "You already subscribed to this course";
            }
            else
            {
                TempData["Error"] = "This course doesn't exist";
            }
            TempData["StudentID"] = TempData["StudentID"];

            return(RedirectToAction("Details", new { controller = "Student", action = "Details", id = studentID }));
        }
Пример #3
0
        public void CourseExists_CourseDoesntExist_False()
        {
            var result = StudentEnrollmentBL.CourseExists(-2);

            Assert.False(result);
        }