Ejemplo n.º 1
0
 public void TestPrev()
 {
     facade.Start(1);
     facade.Next(1);
     facade.Next(1);
     Assert.AreEqual(questions[2], facade.GetCurrentQuestion(1));
     Assert.AreEqual(3, facade.GetCurrentQuestionIndex(1));
     Assert.AreEqual(3, facade.GetTotalQuestions(1));
     facade.Prev(1);
     Assert.AreEqual(questions[1], facade.GetCurrentQuestion(1));
     Assert.AreEqual(2, facade.GetCurrentQuestionIndex(1));
     Assert.AreEqual(3, facade.GetTotalQuestions(1));
     facade.Prev(1);
     Assert.AreEqual(questions[0], facade.GetCurrentQuestion(1));
     Assert.AreEqual(1, facade.GetCurrentQuestionIndex(1));
     Assert.AreEqual(3, facade.GetTotalQuestions(1));
     facade.Prev(1);
     Assert.AreEqual(questions[0], facade.GetCurrentQuestion(1));
     Assert.AreEqual(1, facade.GetCurrentQuestionIndex(1));
     Assert.AreEqual(3, facade.GetTotalQuestions(1));
 }
Ejemplo n.º 2
0
        public void Prev(int quizId)
        {
            log.Debug("Trigger previous question: " + quizId);

            _quiz.Prev(quizId);
            QuizQuestion currentQuestion = _quiz.GetCurrentQuestion(quizId);

            LiveQuizModelView question = MapQuizToViewModel(currentQuestion);

            Clients.All.setQuestion(quizId, JsonConvert.SerializeObject(question));
            log.Debug("Broadcast question: " + JsonConvert.SerializeObject(question));

            if (question != null)
            {
                string stats = _quiz.GetAnswerStatistic(question.QuestionID);
                Clients.All.setStats(quizId, stats);
                log.Debug("Broadcast answer statistic: " + stats);
            }
        }