about summary refs log tree commit diff
path: root/IrcTokens/Tests/StatefulDecoderTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'IrcTokens/Tests/StatefulDecoderTests.cs')
-rw-r--r--IrcTokens/Tests/StatefulDecoderTests.cs30
1 files changed, 10 insertions, 20 deletions
diff --git a/IrcTokens/Tests/StatefulDecoderTests.cs b/IrcTokens/Tests/StatefulDecoderTests.cs
index e0c2143..3e6a078 100644
--- a/IrcTokens/Tests/StatefulDecoderTests.cs
+++ b/IrcTokens/Tests/StatefulDecoderTests.cs
@@ -20,7 +20,7 @@ namespace IrcTokens.Tests
         public void TestPartial()
         {
             var lines = _decoder.Push("PRIVMSG ");
-            Assert.AreEqual(new List<string>(), lines);
+            Assert.AreEqual(0, lines.Count);
 
             lines = _decoder.Push("#channel hello\r\n");
             Assert.AreEqual(1, lines.Count);
@@ -32,8 +32,7 @@ namespace IrcTokens.Tests
         [TestMethod]
         public void TestMultiple()
         {
-            _decoder.Push("PRIVMSG #channel1 hello\r\n");
-            var lines = _decoder.Push("PRIVMSG #channel2 hello\r\n");
+            var lines = _decoder.Push("PRIVMSG #channel1 hello\r\nPRIVMSG #channel2 hello\r\n");
             Assert.AreEqual(2, lines.Count);
 
             var line1 = new Line("PRIVMSG #channel1 hello");
@@ -45,21 +44,21 @@ namespace IrcTokens.Tests
         [TestMethod]
         public void TestEncoding()
         {
-            var iso8859 = Encoding.GetEncodings().Single(ei => ei.Name == "iso-8859-1");
+            var iso8859 = Encoding.GetEncoding("iso-8859-1");
             _decoder = new StatefulDecoder {Encoding = iso8859};
-            var lines = _decoder.Push("PRIVMSG #channel :hello Č\r\n");
-            var line = new Line("PRIVMSG #channel :hello Č");
-            Assert.AreEqual(line, lines[0]);
+            var lines = _decoder.Push(iso8859.GetBytes("PRIVMSG #channel :hello Ç\r\n"));
+            var line = new Line("PRIVMSG #channel :hello Ç");
+            Assert.IsTrue(line.Equals(lines[0]));
         }
 
         [TestMethod]
         public void TestEncodingFallback()
         {
-            var latin1 = Encoding.GetEncodings().Single(ei => ei.Name == "latin-1");
-            _decoder = new StatefulDecoder {Fallback = latin1};
-            var lines = _decoder.Push("PRIVMSG #channel hélló\r\n");
+            var latin1 = Encoding.GetEncoding("iso-8859-1");
+            _decoder = new StatefulDecoder {Encoding = null, Fallback = latin1};
+            var lines = _decoder.Push(latin1.GetBytes("PRIVMSG #channel hélló\r\n"));
             Assert.AreEqual(1, lines.Count);
-            Assert.AreEqual(new Line("PRIVMSG #channel hélló"), lines[0]);
+            Assert.IsTrue(new Line("PRIVMSG #channel hélló").Equals(lines[0]));
         }
 
         [TestMethod]
@@ -84,14 +83,5 @@ namespace IrcTokens.Tests
             _decoder.Clear();
             Assert.AreEqual(string.Empty, _decoder.Pending);
         }
-
-        [TestMethod]
-        public void TestTagEncodingMismatch()
-        {
-            _decoder.Push("@asd=á ");
-            var lines = _decoder.Push("PRIVMSG #chan :á\r\n");
-            Assert.AreEqual("á", lines[0].Params[0]);
-            Assert.AreEqual("á", lines[0].Tags["asd"]);
-        }
     }
 }