Example #1
0
        /// <summary>
        /// Determines whether this instance can handle the specified message in the room.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="room">The room.</param>
        /// <returns>
        ///   <c>true</c> if this instance can handle the specified room; otherwise, <c>false</c>.
        /// </returns>
        private bool CanHandle(Message message, Room room)
        {
            var canHandle = message.Body != null;

            // Check message is not one-on-one message
            if (!room.IsChat)
            {
                // Check message is addressed to this bot
                if (!NicknameService.IsAddressedToMe(message))
                {
                    canHandle = false;
                }

                // Strip Bot name from message
                if (message.Body == null)
                {
                    return(false);
                }

                var index = message.Body.IndexOf(" ");
                message.Body = message.Body.Substring(index + 1);
            }

            return(canHandle);
        }
Example #2
0
 public void SetUp()
 {
     service = Create<NicknameService>();
 }
Example #3
0
 public void SetUp()
 {
     service = Create <NicknameService>();
 }