public void TestMessageParsing(MessageTest data) { var message = IRCMessage.Parse(data.Input); var atoms = data.Atoms; Assert.Equal(atoms.Source ?? "", message.Source); Assert.Equal(atoms.Verb.ToUpperInvariant(), message.Verb); Assert.Equal(atoms.Params ?? (IEnumerable <string>)ImmutableArray <string> .Empty, message.Parameters); Assert.Equal(atoms.Tags, message.Tags, new NullFriendlyDictionaryComparer()); }
public void TestMessageToString(MessageTest data) { var atoms = data.Atoms; if (atoms.Tags != null) { foreach (var key in atoms.Tags.Keys.ToArray()) { if (atoms.Tags[key] == null) { atoms.Tags[key] = ""; } } } var message = new IRCMessage( atoms.Tags?.ToImmutableDictionary() ?? ImmutableDictionary <string, string> .Empty, atoms.Source ?? "", atoms.Verb, atoms.Params?.ToImmutableArray() ?? ImmutableArray <string> .Empty) .ToString(); Assert.Contains(message, data.Matches, StringComparer.OrdinalIgnoreCase); }