~sircmpwn/ChatSharp

c2a9c53ac8f6f8cf68a9dc122e7688890678e89b — Drew DeVault 4 years ago 0ec65c9 + f653863 master
Merge pull request #97 from RockyTV/caps

Fix some bugs
M ChatSharp/Handlers/ServerHandlers.cs => ChatSharp/Handlers/ServerHandlers.cs +1 -1
@@ 24,7 24,7 @@ namespace ChatSharp.Handlers
                }
                // TODO: Consider doing this differently
                // TODO: Allow users to specify other things to handle
                if (value != null)
                if (!string.IsNullOrEmpty(value))
                {
                    switch (key.ToUpper())
                    {

M ChatSharp/IrcMessage.cs => ChatSharp/IrcMessage.cs +2 -1
@@ 52,7 52,8 @@ namespace ChatSharp
                foreach (string rawTag in rawTags.Split(';'))
                {
                    var replacedTag = rawTag.Replace(@"\:", ";");
                    KeyValuePair<string, string> tag = new KeyValuePair<string, string>(replacedTag, string.Empty);
                    // The spec declares `@a=` as a tag with an empty value, while `@b;` as a tag with a null value
                    KeyValuePair<string, string> tag = new KeyValuePair<string, string>(replacedTag, null);

                    if (replacedTag.Contains("="))
                    {

M ChatSharp/Timestamp.cs => ChatSharp/Timestamp.cs +1 -1
@@ 28,7 28,7 @@ namespace ChatSharp
            if (!compatibility)
            {
                DateTime parsedDate;
                if (!DateTime.TryParseExact(date, @"yyyy-MM-dd\THH:mm:ss.fff\Z", CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out parsedDate))
                if (!DateTime.TryParse(date, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out parsedDate))
                    throw new ArgumentException("The date string was provided in an invalid format.", date);

                Date = parsedDate;

M ChatSharpTests/IrcMessageTests.cs => ChatSharpTests/IrcMessageTests.cs +12 -0
@@ 83,6 83,18 @@ namespace ChatSharp.Tests
        }

        [TestMethod]
        public void NewValidMessage_TagsNoValue()
        {
            IrcMessage fromMessage = new IrcMessage("@a=;b :nick!ident@host.com PRIVMSG me :Hello");
            KeyValuePair<string, string>[] compareTags = new KeyValuePair<string, string>[]
            {
                new KeyValuePair<string, string>("a", ""),
                new KeyValuePair<string, string>("b", null),
            };
            CollectionAssert.AreEqual(fromMessage.Tags, compareTags);
        }

        [TestMethod]
        public void Timestamp_CompareISOString()
        {
            IrcMessage[] messages = {