예제 #1
0
 public void AnswerRecived(ChatMessage message)
 {
     if (ChatMessage != null)
     {
         ChatMessage(message);
     }
 }
예제 #2
0
        public void OnChatMessageReceived_OneQuestionandIncorrectAnswer_NotifyWrongAnswer()
        {
            QuestionItem questionItem1 = new QuestionItem { Question = "Name1", Answer = "Alex1" };
            StubChatApi chatapi = new StubChatApi();
            QuizComunicator comunicator = new QuizComunicator(chatapi);
            comunicator.PoseAQuestion(questionItem1);

            ChatMessage message = new ChatMessage { Username = "******", Message = "SOMETHING INCORRECT" };
            chatapi.AnswerRecived(message);

            Assert.AreEqual("Wrong Answer!", chatapi.LastMessage);
        }
예제 #3
0
        public void OnChatMessageReceived_OneQuestionandCorrectAnswer_QuestionAnswered()
        {
            QuestionItem questionItem1 = new QuestionItem { Question = "Name1", Answer = "Alex1" };
            StubChatApi chatapi = new StubChatApi();
            QuizComunicator comunicator = new QuizComunicator(chatapi);
            comunicator.PoseAQuestion(questionItem1);

            ChatMessage message = new ChatMessage {Username = "******", Message = "Alex1"};
            chatapi.AnswerRecived(message);

            Assert.IsTrue(comunicator.IsQuestionAnswered);
        }