Exemplo n.º 1
0
        public void TypesShouldMatchForIndexAsync()
        {
            //Arrange

            var questionnaireController = new QuestionnaireController();

            //Act
            var responseType = questionnaireController.IndexAsync().Result.ViewData.Model.GetType().Name;

            //Assert -Check if return type is correct
            responseType.Should().Be("QuestionnaireViewModel");
        }
Exemplo n.º 2
0
        public void ShouldGetQuestionsAsync()
        {
            //Arrange

            var questionnaireController = new QuestionnaireController();

            //Act
            var responseModel = (QuestionnaireViewModel)questionnaireController.IndexAsync().Result.ViewData.Model;

            //Assert -Check if return type is correct
            responseModel.Questions.Should().NotBeNullOrEmpty();
        }
Exemplo n.º 3
0
        public void IndexAsyncShouldHaveFourQuestionsAndOneTitle()
        {
            //Arrange

            var questionnaireController = new QuestionnaireController();

            //Act
            var returnedModel = (QuestionnaireViewModel)questionnaireController.IndexAsync().Result.ViewData.Model;

            //Assert -Check if return type is correct
            returnedModel.Questions.Should().NotBeNullOrEmpty();
            returnedModel.Questions.Count.ShouldBeEquivalentTo(4);
            returnedModel.QuestionnaireTitle.Should().NotBeNull();
            returnedModel.QuestionnaireTitle.Should().NotBeEmpty(); //this would fail if it was a list so title is only one entity
            returnedModel.QuestionnaireTitle.Should().BeOfType <string>();
        }