예제 #1
0
        public void GetEvaluacionInfoAndPage_WhenCalledThrowException_ReturnsStatusCodeResult()
        {
            //Arrange
            _controller = new EvaluacionController(_logger, _evaluacionInfoRepository, _usersInfoRepository);

            mockRepository.Setup(r => r.GetEvaluationInfoAndPage(It.IsAny <int>(), It.IsAny <int>())).Throws(new Exception());

            //Act
            var okResult = _controller.GetEvaluacionInfoAndPage(1, 1);

            //Assert
            Assert.IsType <ObjectResult>(okResult);
        }
예제 #2
0
        public void GetEvaluacionInfoAndPage_WhenCalledNullEvaluacion_ReturnNotFoundResult()
        {
            //Arrange
            _controller = new EvaluacionController(_logger, _evaluacionInfoRepository, _usersInfoRepository);

            List <everisapi.API.Models.EvaluacionInfoDto> evaluacionesInfoDto = null;

            mockRepository.Setup(r => r.GetEvaluationInfoAndPage(It.IsAny <int>(), It.IsAny <int>())).Returns(evaluacionesInfoDto);

            //Act
            var okResult = _controller.GetEvaluacionInfoAndPage(1, 1);

            //Assert
            Assert.IsType <NotFoundResult>(okResult);
        }
예제 #3
0
        public void GetEvaluacionInfoAndPage_WhenCalled_ReturnsOkResult()
        {
            //Arrange
            _controller = new EvaluacionController(_logger, _evaluacionInfoRepository, _usersInfoRepository);

            var evaluaciones = new  List <everisapi.API.Models.EvaluacionInfoDto> {
                new everisapi.API.Models.EvaluacionInfoDto {
                    Id = 1, Fecha = new DateTime()
                }
            };

            mockRepository.Setup(r => r.GetEvaluationInfoAndPage(It.IsAny <int>(), It.IsAny <int>())).Returns(evaluaciones);

            //Act
            var okResult = _controller.GetEvaluacionInfoAndPage(1, 1);

            //Assert
            Assert.IsType <OkObjectResult>(okResult);
        }