diff options
author | Ben Harris <ben@tilde.team> | 2020-04-22 16:28:51 -0400 |
---|---|---|
committer | Ben Harris <ben@tilde.team> | 2020-04-22 16:28:51 -0400 |
commit | 933a4f85604e21445c9bac8272d64cf3e6f65e00 (patch) | |
tree | 5b300ca37beff5cf11ed67a8b6e3550d24cf18a3 /IrcTokens/Tests/FormatTests.cs | |
parent | 338763fde71ba2dc0de8ea5e2437d24ee365874b (diff) |
rename to IrcSharp
also tidy up formatting with vs tools
Diffstat (limited to 'IrcTokens/Tests/FormatTests.cs')
-rw-r--r-- | IrcTokens/Tests/FormatTests.cs | 150 |
1 files changed, 0 insertions, 150 deletions
diff --git a/IrcTokens/Tests/FormatTests.cs b/IrcTokens/Tests/FormatTests.cs deleted file mode 100644 index a804c1d..0000000 --- a/IrcTokens/Tests/FormatTests.cs +++ /dev/null @@ -1,150 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.Collections.Generic; - -namespace IrcTokens.Tests -{ - [TestClass] - public class FormatTests - { - [TestMethod] - public void TestTags() - { - var line = new Line - { - Command = "PRIVMSG", - Params = new List<string> {"#channel", "hello"}, - Tags = new Dictionary<string, string> {{"id", "\\" + " " + ";" + "\r\n"}} - }.Format(); - - Assert.AreEqual("@id=\\\\\\s\\:\\r\\n PRIVMSG #channel hello", line); - } - - [TestMethod] - public void TestMissingTag() - { - var line = new Line - { - Command = "PRIVMSG", - Params = new List<string> {"#channel", "hello"} - }.Format(); - - Assert.AreEqual("PRIVMSG #channel hello", line); - } - - [TestMethod] - public void TestNullTag() - { - var line = new Line - { - Command = "PRIVMSG", - Params = new List<string> {"#channel", "hello"}, - Tags = new Dictionary<string, string> {{"a", null}} - }.Format(); - - Assert.AreEqual("@a PRIVMSG #channel hello", line); - } - - [TestMethod] - public void TestEmptyTag() - { - var line = new Line - { - Command = "PRIVMSG", - Params = new List<string> {"#channel", "hello"}, - Tags = new Dictionary<string, string> {{"a", ""}} - }.Format(); - - Assert.AreEqual("@a PRIVMSG #channel hello", line); - } - - [TestMethod] - public void TestSource() - { - var line = new Line - { - Command = "PRIVMSG", - Params = new List<string> {"#channel", "hello"}, - Source = "nick!user@host" - }.Format(); - - Assert.AreEqual(":nick!user@host PRIVMSG #channel hello", line); - } - - [TestMethod] - public void TestCommandLowercase() - { - var line = new Line {Command = "privmsg"}.Format(); - Assert.AreEqual("privmsg", line); - } - - [TestMethod] - public void TestCommandUppercase() - { - var line = new Line {Command = "PRIVMSG"}.Format(); - Assert.AreEqual("PRIVMSG", line); - } - - [TestMethod] - public void TestTrailingSpace() - { - var line = new Line - { - Command = "PRIVMSG", - Params = new List<string> {"#channel", "hello world"} - }.Format(); - - Assert.AreEqual("PRIVMSG #channel :hello world", line); - } - - [TestMethod] - public void TestTrailingNoSpace() - { - var line = new Line - { - Command = "PRIVMSG", - Params = new List<string> {"#channel", "helloworld"} - }.Format(); - - Assert.AreEqual("PRIVMSG #channel helloworld", line); - } - - [TestMethod] - public void TestTrailingDoubleColon() - { - var line = new Line - { - Command = "PRIVMSG", - Params = new List<string> {"#channel", ":helloworld"} - }.Format(); - - Assert.AreEqual("PRIVMSG #channel ::helloworld", line); - } - - [TestMethod] - public void TestInvalidNonLastSpace() - { - Assert.ThrowsException<ArgumentException>(() => - { - new Line - { - Command = "USER", - Params = new List<string> {"user", "0 *", "real name"} - }.Format(); - }); - } - - [TestMethod] - public void TestInvalidNonLastColon() - { - Assert.ThrowsException<ArgumentException>(() => - { - new Line - { - Command = "PRIVMSG", - Params = new List<string> {":#channel", "hello"} - }.Format(); - }); - } - } -} |