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;
 }
Exemplo n.º 8
0
 public TeacherService(ITeacherRepo teacherRepo)
 {
     _teacherRepo = teacherRepo;
 }
Exemplo n.º 9
0
 public TeacherController(ITeacherRepo teacherRepo)
 {
     this.teacherRepo = teacherRepo;
 }
Exemplo n.º 10
0
 public TeacherService(ITeacherRepo teacherRepo, IMapper mapper)
 {
     _mapper      = mapper;
     _teacherRepo = teacherRepo;
 }
Exemplo n.º 11
0
 public TeacherController(ITeacherRepo teacherRepo, IEducationRepo_DbContext educationRepo)
 {
     _teacherRepo       = teacherRepo;
     this.educationRepo = educationRepo;
 }
Exemplo n.º 12
0
 public TeachersController(ITeacherRepo repo, IMapper mapper)
 {
     this._repo = repo;
     _mapper    = mapper;
 }
Exemplo n.º 13
0
 public TeachersController(ITeacherRepo repo, IAttendanceRepo attendanceRepo, IMarkRepo markRepo)
 {
     _repo           = repo;
     _attendanceRepo = attendanceRepo;
     _markRepo       = markRepo;
 }