IRC parsing, tokenization, and state handling in C#

Fix decoder tests

+4 -4
+1 -1
IrcTokens/StatefulDecoder.cs
··· 60 60 _buffer = _buffer == null ? Array.Empty<byte>() : _buffer.Concat(data.Take(bytesReceived)).ToArray(); 61 61 62 62 var listLines = _buffer.Split((byte) '\n').Select(l => l.Trim((byte) '\r')).ToList(); 63 - _buffer = listLines.Last(); 63 + _buffer = listLines.LastOrDefault() ?? Array.Empty<byte>(); 64 64 65 65 var decodeLines = new List<Line>(); 66 66 foreach (var line in listLines.SkipLast(1).Select(l => l.ToArray()))
+2 -2
IrcTokens/Tests/StatefulDecoder.cs
··· 66 66 public void TestEmpty() 67 67 { 68 68 var lines = _decoder.Push(string.Empty); 69 - Assert.IsNull(lines); 69 + Assert.AreEqual(0, lines.Count); 70 70 } 71 71 72 72 [TestMethod] ··· 74 74 { 75 75 _decoder.Push("PRIVMSG #channel hello"); 76 76 var lines = _decoder.Push(string.Empty); 77 - Assert.IsNull(lines); 77 + Assert.AreEqual(0, lines.Count); 78 78 } 79 79 80 80 [TestMethod]
+1 -1
README.md
··· 25 25 26 26 ### stateful 27 27 28 - see the full example in [Sample/Client.cs](Sample/Client.cs) 28 + see the full example in [TokensSample/Client.cs](TokensSample/Client.cs) 29 29 30 30 public class Client 31 31 {