public void CourseExists_CourseExists_True() { Course course = generator.CreateCourse(testcoursetitle, testdepartmentname, testlastnameinstructor, testfirstnameinstructor, testlogininstructor, testpasswordinstructor); var result = StudentEnrollmentBL.CourseExists(course.CourseID); Assert.True(result); }
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 })); }
public void CourseExists_CourseDoesntExist_False() { var result = StudentEnrollmentBL.CourseExists(-2); Assert.False(result); }