Beispiel #1
0
        public void WebApiGetQuestionsIntegrationTest()
        {
            //Act
            var result        = GeographyQuestionsAccess.GetGeographyQuestions();
            var questionnaire = JsonConvert.DeserializeObject <Questionnaire>(result);

            //Assert

            questionnaire.QuestionnaireTitle.ShouldBeEquivalentTo("Geography Questions");
            questionnaire.QuestionsText[0].ShouldBeEquivalentTo("What is the capital of Cuba?");
            questionnaire.QuestionsText[1].ShouldBeEquivalentTo("What is the capital of France?");
            questionnaire.QuestionsText[2].ShouldBeEquivalentTo("What is the capital of Poland?");
            questionnaire.QuestionsText[3].ShouldBeEquivalentTo("What is the capital of Germany?");
        }
Beispiel #2
0
        public ViewResult Index()
        {
            var result = GeographyQuestionsAccess.GetGeographyQuestions <Questionnairre>();

            List <Question> questionList = new List <Question>();

            foreach (var questionText in result.QuestionsText)
            {
                Question newQuestion = new Question {
                    QuestionText = questionText
                };
                questionList.Add(newQuestion);
            }
            QuestionnaireViewModel questionnaireViewModel = new QuestionnaireViewModel
            {
                QuestionnaireTitle = result.QuestionnaireTitle,
                Questions          = questionList
            };

            return(View(questionnaireViewModel));
        }