示例#1
0
        public async Task PrevNextSearch_Test()
        {
            var guid = Guid.NewGuid().ToString("N").Substring(0, 6);

            await CreateCompleteSurvey(guid, new [] { "Q1", "Q2", "Q3", "Q4" });

            var survey = await _surveyAppService.GetSurvey(guid);

            var firstOrDefault = survey.Answers.FirstOrDefault(a => a.QuestionText == "Q3");

            if (firstOrDefault != null)
            {
                var check = _surveyAppService.GetQuestion(survey.Id, firstOrDefault.Id);
                check.NextQuestion.ShouldBe(4);
                check.PrevQuestion.ShouldBe(2);


                var secondCheck = _surveyAppService.GetQuestion(survey.Id, check.NextQuestion);
                secondCheck.NextQuestion.ShouldBe(0);
                secondCheck.PrevQuestion.ShouldBe(3);
            }
        }
示例#2
0
        public ActionResult GetNextQuestion(int questionId, int surveyId)
        {
            var question = _surveyAppService.GetQuestion(surveyId, questionId);

            return(View(question));
        }