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); }
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); }
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); }