Inheritance: IChatApi
Exemple #1
0
        public void PoseAQuestion_NullQuestionItem_ThrowsException()
        {
            IChatApi        chatapi     = new StubChatApi();
            QuizComunicator comunicator = new QuizComunicator(chatapi);

            comunicator.PoseAQuestion(null);
        }
        public void PoseAQuestion_NullQuestionItem_ThrowsException()
        {
            IChatApi chatapi = new StubChatApi();
            QuizComunicator comunicator = new QuizComunicator(chatapi);

            comunicator.PoseAQuestion(null);
        }
        public void PoseAQuestion_OneQuestion_OnePost()
        {
            QuestionItem questionItem = new QuestionItem { Question = "Name", Answer = "Alex" };
            IChatApi chatapi = new StubChatApi();
            QuizComunicator comunicator = new QuizComunicator(chatapi);

            comunicator.PoseAQuestion(questionItem);

            Assert.AreEqual(1, chatapi.PostCount);
        }
        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);
        }
Exemple #6
0
        public void PoseAQuestion_OneQuestion_OnePost()
        {
            QuestionItem questionItem = new QuestionItem {
                Question = "Name", Answer = "Alex"
            };
            IChatApi        chatapi     = new StubChatApi();
            QuizComunicator comunicator = new QuizComunicator(chatapi);

            comunicator.PoseAQuestion(questionItem);

            Assert.AreEqual(1, chatapi.PostCount);
        }
Exemple #7
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);
        }
Exemple #8
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);
        }