diff options
Diffstat (limited to 'IrcTokens/Tests/StatefulEncoder.cs')
-rw-r--r-- | IrcTokens/Tests/StatefulEncoder.cs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/IrcTokens/Tests/StatefulEncoder.cs b/IrcTokens/Tests/StatefulEncoder.cs index e3ed70d..f2cd6c4 100644 --- a/IrcTokens/Tests/StatefulEncoder.cs +++ b/IrcTokens/Tests/StatefulEncoder.cs @@ -1,5 +1,5 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Text; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace IrcTokens.Tests { @@ -52,6 +52,19 @@ namespace IrcTokens.Tests } [TestMethod] + public void TestPopMultipleLines() + { + var line1 = new Line("PRIVMSG #channel1 hello"); + _encoder.Push(line1); + var line2 = new Line("PRIVMSG #channel2 hello"); + _encoder.Push(line2); + + var lines = _encoder.Pop(_encoder.Pending().Length); + Assert.AreEqual(2, lines.Count); + Assert.AreEqual(string.Empty, _encoder.Pending()); + } + + [TestMethod] public void TestClear() { _encoder.Push(new Line("PRIVMSG #channel hello")); @@ -63,7 +76,7 @@ namespace IrcTokens.Tests public void TestEncoding() { var iso8859 = Encoding.GetEncoding("iso-8859-1"); - _encoder = new IrcTokens.StatefulEncoder { Encoding = iso8859 }; + _encoder = new IrcTokens.StatefulEncoder {Encoding = iso8859}; _encoder.Push(new Line("PRIVMSG #channel :hello Ç")); CollectionAssert.AreEqual(iso8859.GetBytes("PRIVMSG #channel :hello Ç\r\n"), _encoder.PendingBytes); } |