コード例 #1
0
 public void TestStart()
 {
     Assert.IsNull(facade.GetCurrentQuestion(1));
     Assert.AreEqual(0, facade.GetCurrentQuestionIndex(1));
     facade.Start(1);
     Assert.AreEqual(questions[0], facade.GetCurrentQuestion(1));
     Assert.AreEqual(1, facade.GetCurrentQuestionIndex(1));
     Assert.AreEqual(3, facade.GetTotalQuestions(1));
 }
コード例 #2
0
        private LiveQuizModelView MapQuizToViewModel(QuizQuestion question)
        {
            if (question == null)
            {
                return(null);
            }

            LiveQuizModelView questionModel = new LiveQuizModelView();

            questionModel.QuestionID = question.QuizQuestionID;
            questionModel.Title      = question.Title;
            foreach (var c in question.QuizChoices.OrderBy(x => x.QuizChoiceID))
            {
                QuizChoiceModelView choice = new QuizChoiceModelView();
                choice.ChoiceID = c.QuizChoiceID;
                choice.Choice   = c.Choice;
                questionModel.Choice.Add(choice);
            }
            questionModel.TotalQuestions       = _quiz.GetTotalQuestions(question.Quiz.QuizID);
            questionModel.CurrentQuestionIndex = _quiz.GetCurrentQuestionIndex(question.Quiz.QuizID);

            return(questionModel);
        }