public void AnswerRecived(ChatMessage message) { if (ChatMessage != null) { ChatMessage(message); } }
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); }
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); }