Esempio n. 1
0
        public void Start(int quizId)
        {
            log.Debug("Initiate live quiz start, quizId: " + quizId);

            _quiz.Start(quizId);
            QuizQuestion firstQuestion = _quiz.GetCurrentQuestion(quizId);

            LiveQuizModelView question = MapQuizToViewModel(firstQuestion);

            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);
            }
        }
Esempio n. 2
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));
 }