about summary refs log tree commit diff
path: root/IRCTokens/Tests/StatefulDecoder.cs
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2020-11-10 18:35:21 -0500
committerBen Harris <ben@tilde.team>2020-11-10 18:35:21 -0500
commit35bbd30c2506b3d0b18397ef1443fb18c0d893d6 (patch)
tree893862078b9045fbfb73296a0290d16f245b2c2c /IRCTokens/Tests/StatefulDecoder.cs
parentb8e2634193eef0b7a4db417144fe7f38a5140c3b (diff)
Move tests to a separate project
Diffstat (limited to 'IRCTokens/Tests/StatefulDecoder.cs')
-rw-r--r--IRCTokens/Tests/StatefulDecoder.cs88
1 files changed, 0 insertions, 88 deletions
diff --git a/IRCTokens/Tests/StatefulDecoder.cs b/IRCTokens/Tests/StatefulDecoder.cs
deleted file mode 100644
index 4da7690..0000000
--- a/IRCTokens/Tests/StatefulDecoder.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-using System.Collections.Generic;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace IRCTokens.Tests
-{
-    [TestClass]
-    public class StatefulDecoder
-    {
-        private IRCTokens.StatefulDecoder _decoder;
-
-        [TestInitialize]
-        public void Initialize()
-        {
-            _decoder = new IRCTokens.StatefulDecoder();
-        }
-
-        [TestMethod]
-        public void Partial()
-        {
-            var lines = _decoder.Push("PRIVMSG ");
-            Assert.AreEqual(0, lines.Count);
-
-            lines = _decoder.Push("#channel hello\r\n");
-            Assert.AreEqual(1, lines.Count);
-
-            var line = new Line("PRIVMSG #channel hello");
-            CollectionAssert.AreEqual(new List<Line> {line}, lines);
-        }
-
-        [TestMethod]
-        public void Multiple()
-        {
-            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");
-            var line2 = new Line("PRIVMSG #channel2 hello");
-            Assert.AreEqual(line1, lines[0]);
-            Assert.AreEqual(line2, lines[1]);
-        }
-
-        [TestMethod]
-        public void EncodingIso8859()
-        {
-            var iso8859 = Encoding.GetEncoding("iso-8859-1");
-            _decoder = new IRCTokens.StatefulDecoder {Encoding = iso8859};
-            var bytes = iso8859.GetBytes("PRIVMSG #channel :hello Ç\r\n");
-            var lines = _decoder.Push(bytes, bytes.Length);
-            var line  = new Line("PRIVMSG #channel :hello Ç");
-            Assert.IsTrue(line.Equals(lines[0]));
-        }
-
-        [TestMethod]
-        public void EncodingFallback()
-        {
-            var latin1 = Encoding.GetEncoding("iso-8859-1");
-            _decoder = new IRCTokens.StatefulDecoder {Encoding = null, Fallback = latin1};
-            var bytes = latin1.GetBytes("PRIVMSG #channel hélló\r\n");
-            var lines = _decoder.Push(bytes, bytes.Length);
-            Assert.AreEqual(1, lines.Count);
-            Assert.IsTrue(new Line("PRIVMSG #channel hélló").Equals(lines[0]));
-        }
-
-        [TestMethod]
-        public void Empty()
-        {
-            var lines = _decoder.Push(string.Empty);
-            Assert.AreEqual(0, lines.Count);
-        }
-
-        [TestMethod]
-        public void BufferUnfinished()
-        {
-            _decoder.Push("PRIVMSG #channel hello");
-            var lines = _decoder.Push(string.Empty);
-            Assert.AreEqual(0, lines.Count);
-        }
-
-        [TestMethod]
-        public void Clear()
-        {
-            _decoder.Push("PRIVMSG ");
-            _decoder.Clear();
-            Assert.AreEqual(string.Empty, _decoder.Pending);
-        }
-    }
-}