public void SqlEnrollmentRepository_Fetches_List_of_Terms() { IEnrollmentRepository repository = new SqlEnrollmentRepository(); Dictionary <int, DateTime> terms = repository.FetchTermsForOnlineEnrollment(); Assert.IsNotNull(terms); }
public void SqlEnrollmentRepository_UnEnroll_a_Enrolled_Student() { IEnrollmentRepository repository = new SqlEnrollmentRepository(); // First enroll a student // var courseEnrollment = new CourseEnrollment { CourseOfferingNo = 0, StudentId = -121, GradeNo = 1, StatusId = 1, ImportDate = DateTime.Now, ImportConversion = "Student Portal" }; int isEnrolled = repository.EnrollStudent(courseEnrollment); Assert.AreEqual(1, isEnrolled); // Then Un-Enroll that student // var isUnEnrolled = repository.UnEnrollStudent(courseEnrollment.StudentId, courseEnrollment.CourseOfferingNo); Assert.IsTrue(isUnEnrolled); }
public void SqlEnrollmentRepository_UnEnrollStudent_Throws_Exception_if_Student_is_Not_Enrolled() { // Case 1: course offering exists but student is not enrolled // IEnrollmentRepository repository = new SqlEnrollmentRepository(); int studentId = -123; int courseOfferingNo = 604; try { // This line should throw an exception repository.UnEnrollStudent(studentId, courseOfferingNo); // This should not be executed. In case of a duplicate entry // above line must throw an exception. Assert.Fail(); } catch (Exception) { // Nothing to do, since in this scenario exception must be thrown } // Case 2: course offering does not exists but student exists // studentId = 2593; courseOfferingNo = -123; try { // This line should throw an exception repository.UnEnrollStudent(studentId, courseOfferingNo); // This should not be executed. In case of a duplicate entry // above line must throw an exception. Assert.Fail(); } catch (Exception) { // Nothing to do, since in this scenario exception must be thrown } // Case 3: both course offering and student do not exist // studentId = 2593; courseOfferingNo = 604; try { // This line should throw an exception repository.UnEnrollStudent(studentId, courseOfferingNo); // This should not be executed. In case of a duplicate entry // above line must throw an exception. Assert.Fail(); } catch (Exception) { // Nothing to do, since in this scenario exception must be thrown } }
public void SqlEnrollmentRepository_Enrolls_Student_in_a_Class_Offered_in_a_Term() { IEnrollmentRepository repository = new SqlEnrollmentRepository(); var courseEnrollment = new CourseEnrollment { CourseOfferingNo = 0, StudentId = -1, GradeNo = 1, StatusId = 1, ImportDate = DateTime.Now, ImportConversion = "Student Portal" }; int isEnrolled = repository.EnrollStudent(courseEnrollment); Assert.AreEqual(1, isEnrolled); }