예제 #1
0
        public void TestAddStudentToCourse()
        {
            var course1    = new Course("StartIT");
            var course2    = new Course("GetIT");
            var courseList = new CourseList();
            var student    = new Student("Tom Erik", "*****@*****.**");

            courseList.AddCourse(course1);
            courseList.AddCourse(course2);

            var test = courseList.AddStudentToCourse(student, course2);


            Assert.AreEqual(true, test);
        }
예제 #2
0
        public void TestAddCourse()
        {
            var course     = new Course("GetIT");
            var courseList = new CourseList();
            var result     = courseList.AddCourse(course);

            Assert.AreEqual(true, result);
        }
예제 #3
0
 public ActionResult Create(CourseClass c)
 {
     if (ModelState.IsValid)
     {
         CourseList cList = new CourseList();
         cList.AddCourse(c);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
예제 #4
0
        public void TestRemoveCourseFail()
        {
            var course     = new Course("GetIT");
            var course2    = new Course("StartIT");
            var courseList = new CourseList();

            courseList.AddCourse(course2);
            var result = courseList.RemoveCourse(course);

            Assert.AreEqual(false, result);
        }
        public ViewResult CourseForm(Course course)
        {
            if (ModelState.IsValid)
            {
                CourseList.AddCourse(course);

                return(View("ThankYouCourse", course));
            }
            else
            {
                return(View());
            }
        }
예제 #6
0
        public void TestAddCourseToStudent()
        {
            var student1    = new Student("Tom Erik", "*****@*****.**");
            var course1     = new Course("StartIT");
            var courseList  = new CourseList();
            var studentList = new StudentList();
            var addStudent  = studentList.AddStudent(student1);

            courseList.AddCourse(course1);

            var result = studentList.AddCourseToStudent(course1, student1);

            Assert.AreEqual(true, result);
        }