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); }
public void TestAddCourse() { var course = new Course("GetIT"); var courseList = new CourseList(); var result = courseList.AddCourse(course); Assert.AreEqual(true, result); }
public ActionResult Create(CourseClass c) { if (ModelState.IsValid) { CourseList cList = new CourseList(); cList.AddCourse(c); return(RedirectToAction("Index")); } return(View()); }
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()); } }
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); }