public void GetTeacher_ShouldReturnBadRequest() { //Arrange testSchoolRegisterContext = new TestSchoolRegisterContext(); teacherRepo = new MockTeacherRepo(testSchoolRegisterContext); teachersController = new TeachersController(teacherRepo); //Act IHttpActionResult actionResult = teachersController.GetTeacher(null); //Assert Assert.IsInstanceOfType(actionResult, typeof(BadRequestResult)); }
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 PutTeacher_ShouldReturnBadRequestDifferentId() { // Arrange testSchoolRegisterContext = new TestSchoolRegisterContext(); teacherRepo = new MockTeacherRepo(testSchoolRegisterContext); teachersController = new TeachersController(teacherRepo); //Act IHttpActionResult actionResult = teachersController.PutTeacher("notExistingTeacherId", new Teacher { Id = "sampleTeacherId" }); //Assert Assert.IsInstanceOfType(actionResult, typeof(BadRequestResult)); }
public void GetTeacher_ShouldReturnForbidden() { //Arrange testSchoolRegisterContext = new TestSchoolRegisterContext(); teacherRepo = new MockTeacherRepo(testSchoolRegisterContext); teachersController = new TeachersController(teacherRepo); PopulateTeacherFields(); //Act var actionResult = teachersController.GetTeacher("unauthenticatedTeacherId") as ResponseMessageResult; //Assert Assert.IsNotNull(actionResult); Assert.AreEqual(actionResult.Response.StatusCode, HttpStatusCode.Forbidden); }
public void GetTeacher_ShouldReturnNotFound() { //Arrange testSchoolRegisterContext = new TestSchoolRegisterContext(); teacherRepo = new MockTeacherRepo(testSchoolRegisterContext); teachersController = new TeachersController(teacherRepo); PopulateTeacherFields(); //Act var actionResult = teachersController.GetTeacher("notExistingTeacherId"); //Assert Assert.IsNotNull(actionResult); Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult)); }
public void GetTeacher_ShouldReturnOk() { //Arrange testSchoolRegisterContext = new TestSchoolRegisterContext(); teacherRepo = new MockTeacherRepo(testSchoolRegisterContext); teachersController = new TeachersController(teacherRepo); PopulateTeacherFields(); //Act var actionResult = teachersController.GetTeacher("sampleTeacherId"); var contentResult = actionResult as OkNegotiatedContentResult <TeacherBasicDto>; // Assert Assert.IsNotNull(contentResult); Assert.IsNotNull(contentResult.Content); Assert.AreEqual("sampleTeacherId", contentResult.Content.Id); }
public TeacherController(ITeacherRepo teacherRepo, IEducationRepo educationRepo) { this.teacherRepo = teacherRepo; this.educationRepo = educationRepo; }
public TeacherService(ITeacherRepo teacherRepo) { _teacherRepo = teacherRepo; }
public TeacherController(ITeacherRepo teacherRepo) { this.teacherRepo = teacherRepo; }
public TeacherService(ITeacherRepo teacherRepo, IMapper mapper) { _mapper = mapper; _teacherRepo = teacherRepo; }
public TeacherController(ITeacherRepo teacherRepo, IEducationRepo_DbContext educationRepo) { _teacherRepo = teacherRepo; this.educationRepo = educationRepo; }
public TeachersController(ITeacherRepo repo, IMapper mapper) { this._repo = repo; _mapper = mapper; }
public TeachersController(ITeacherRepo repo, IAttendanceRepo attendanceRepo, IMarkRepo markRepo) { _repo = repo; _attendanceRepo = attendanceRepo; _markRepo = markRepo; }