Exemple #1
0
        public async Task Verify_GetSurvey()
        {
            // Arrange
            var    surveyId      = 4;
            string surveyName    = "Survey 4";
            var    sample_survey = GetSurvey();
            var    mockRepo      = new Mock <CompassDBContext>();

            mockRepo.SetupAllProperties();
            mockRepo.Setup(repo => repo.GetSurveyAsync(surveyId))
            .ReturnsAsync(sample_survey);
            var controller = new SurveysController(mockRepo.Object);
            // Act
            var result = await controller.GetSurvey(4);

            // Assert
            var actionResult = Assert.IsType <ActionResult <Questions> >(result);

            Assert.IsType <NotFoundObjectResult>(actionResult.Result);
            var okResult = Assert.IsType <OkObjectResult>(result);
        }