public void SignUp_WithinLimit_True()
        {
            var student = AddNewStudent();
            var course  = AddNewCourse(2);

            Assert.NotEqual(0, student.Id);
            Assert.NotEqual(0, course.Id);
            var isSignedUp = _courseStudentRepo.Signup(courseId: course.Id, studentId: student.Id);

            Assert.True(isSignedUp);
        }
예제 #2
0
 public ActionResult Sigup(int courseId, int studentId)
 {
     try
     {
         var isSignedUp = _courseStudentRepo.Signup(courseId: courseId, studentId: studentId);
         if (isSignedUp)
         {
             return(Ok());
         }
         return(BadRequest(Internal_Server_Error));
     }
     catch (CourseCapacityFullException e)
     {
         return(BadRequest(HandleCourseCapacityFullException(courseId, studentId)));
     }
 }
        public void GetList_NotEmpty()
        {
            var student = AddNewStudent();
            var course  = AddNewCourse(2);
            var teacher = AddNewTeacher();

            Assert.NotEqual(0, student.Id);
            Assert.NotEqual(0, course.Id);
            Assert.NotEqual(0, teacher.Id);

            var isAssigned = _courseTeacherRepository.Assign(courseId: course.Id, teacherId: teacher.Id);

            Assert.True(isAssigned);

            var isSignedUp = _courseStudentRepo.Signup(courseId: course.Id, studentId: student.Id);

            Assert.True(isSignedUp);

            var coursesStudentsTeachersModel = _integrationRepo.GetDetails();

            Assert.NotEmpty(coursesStudentsTeachersModel);
        }