Beispiel #1
0
        public void GetAllAssessments_WhenThrowException_ReturnStatusCode()
        {
            //Arrange
            _controller = new ProyectosController(_logger, _userInfoRepository);
            mockRepository.Setup(r => r.GetAllAssessments()).Throws(new Exception());

            //Act
            var okResult = _controller.GetAllAssessments();

            //Assert
            Assert.IsType <ObjectResult>(okResult);
        }
Beispiel #2
0
        public void GetAllAssessments_WhenCalled_ReturnOkResult()
        {
            //Arrange
            _controller = new ProyectosController(_logger, _userInfoRepository);

            var assessmentEntities = new List <everisapi.API.Entities.AssessmentEntity>()
            {
                new everisapi.API.Entities.AssessmentEntity {
                    AssessmentName = "Assessment 1"
                },
                new everisapi.API.Entities.AssessmentEntity {
                    AssessmentName = "Assessment 2"
                }
            };

            mockRepository.Setup(r => r.GetAllAssessments()).Returns(assessmentEntities);

            //Act
            var okResult = _controller.GetAllAssessments();

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