void TestMessage(string message, MessageModel expectedMsg, MessageBuilderSettings settings = null, string assertFailMessage = null) { var builder = new MessageBuilder(); if (settings != null) { builder.Settings = settings; } builder.TimeStamp = DateTime.MinValue; builder.AppendMessage(message); var actualMsg = builder.ToMessage(); string assertFailMessagePrefix = String.Empty; if (assertFailMessage != null) { assertFailMessagePrefix = assertFailMessage + ": "; } Assert.AreEqual(expectedMsg.GetType(), actualMsg.GetType(), assertFailMessagePrefix + "The message type does not match"); Assert.AreEqual(expectedMsg.MessageParts.Count, actualMsg.MessageParts.Count, assertFailMessagePrefix + "The number of message parts do not match"); for (int i = 0; i < expectedMsg.MessageParts.Count; i++) { Assert.AreEqual(expectedMsg.MessageParts[i].GetType(), actualMsg.MessageParts[i].GetType(), assertFailMessagePrefix + "The type of the message part does not match"); } Assert.AreEqual(expectedMsg, actualMsg, assertFailMessagePrefix + "The message objects are not equal"); }
public MessageBuilderSettings(MessageBuilderSettings settings) { if (settings == null) { throw new ArgumentNullException("settings"); } UserPatterns = new List<MessagePatternModel>(settings.UserPatterns); Patterns = new List<MessagePatternModel>(settings.Patterns); NickColors = settings.NickColors; StripFormattings = settings.StripFormattings; StripColors = settings.StripColors; HighlightColor = settings.HighlightColor; HighlightWords = settings.HighlightWords; }
public MessageBuilderSettings(MessageBuilderSettings settings) { if (settings == null) { throw new ArgumentNullException("settings"); } UserPatterns = new List <MessagePatternModel>(settings.UserPatterns); Patterns = new List <MessagePatternModel>(settings.Patterns); NickColors = settings.NickColors; StripFormattings = settings.StripFormattings; StripColors = settings.StripColors; HighlightColor = settings.HighlightColor; HighlightWords = settings.HighlightWords; }
public MessageBuilder() { Message = new MessageModel(); Settings = new MessageBuilderSettings(); }