public void GetCoursesByTeacherId_ShouldReturnNotFound() { // Arrange testSchoolRegisterContext = new TestSchoolRegisterContext(); teacherRepo = new MockTeacherRepo(testSchoolRegisterContext); teachersController = new TeachersController(teacherRepo); //Act IHttpActionResult actionResult = teachersController.GetCoursesByTeacherId("sampleTeacherId"); //Assert Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult)); }
public void GetCoursesByTeacherId_ShouldReturnForbidden() { //Arrange testSchoolRegisterContext = new TestSchoolRegisterContext(); teacherRepo = new MockTeacherRepo(testSchoolRegisterContext); teachersController = new TeachersController(teacherRepo); PopulateTeacherFields(); //Act var actionResult = teachersController.GetCoursesByTeacherId("unauthenticatedTeacherId") as ResponseMessageResult; //Assert Assert.IsNotNull(actionResult); Assert.AreEqual(actionResult.Response.StatusCode, HttpStatusCode.Forbidden); }