public void OnSendMessage_WhenIsACommonMessage_ShouldNotCallQueueIntegration()
        {
            //Assert
            var expectedNumberOfTimesQueueIntegrationWasCalled = 0;
            var request = new MessageRequest
            {
                User    = "******",
                Message = "A message"
            };

            //Call
            _controller.SendRequest(request);
            var numberOfTimesQueueIntegrationWasCalled = Mock.GetTimesCalled(() => _queueIntegration.PublishMessage(Arg.AnyString));

            Assert.AreEqual(expectedNumberOfTimesQueueIntegrationWasCalled, numberOfTimesQueueIntegrationWasCalled);
        }
Example #2
0
        /// <summary>
        /// Handles the commands the users post in the chat
        /// </summary>
        private void HandleCommandMessage(MessageRequest chatMessage)
        {
            if (chatMessage.Message.StartsWith('/'))
            {
                ValidateCommandValueAttribuition(chatMessage);

                var commandParts = chatMessage.Message.Split('=');
                if (IsValidCommand(commandParts))
                {
                    _queueIntegration.PublishMessage(commandParts[1]);
                }
            }
        }