public async Task ListCoursesByStudent_ValidId_Ok() { var studentId = 1; var actual = await _courseLogic.ListCoursesByStudent(studentId); Assert.NotNull(actual); }
public async Task <IActionResult> ListAllCoursesByStudent(int studentId) { try { if (studentId < 1) { return(ValidationProblem("Invalid studentId")); } var courses = await _courseLogic.ListCoursesByStudent(studentId); return(Ok(courses)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }