示例#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");
        }
示例#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();
        }
示例#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>();
        }