diff options
author | Ben Harris <ben@tilde.team> | 2020-04-28 00:35:52 -0400 |
---|---|---|
committer | Ben Harris <ben@tilde.team> | 2020-04-28 00:35:52 -0400 |
commit | 80afa2c0aec37b7f98cc22615417c36672e695da (patch) | |
tree | 63ca3e309a5daa5093e54bdfdb493115c7a3d942 /IrcTokens/Tests/Format.cs | |
parent | 933a4f85604e21445c9bac8272d64cf3e6f65e00 (diff) |
tidy up, work on stateful
Diffstat (limited to 'IrcTokens/Tests/Format.cs')
-rw-r--r-- | IrcTokens/Tests/Format.cs | 60 |
1 files changed, 17 insertions, 43 deletions
diff --git a/IrcTokens/Tests/Format.cs b/IrcTokens/Tests/Format.cs index 64f974a..8ef5344 100644 --- a/IrcTokens/Tests/Format.cs +++ b/IrcTokens/Tests/Format.cs @@ -1,6 +1,6 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; +using System; using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace IrcTokens.Tests { @@ -13,8 +13,8 @@ namespace IrcTokens.Tests var line = new Line { Command = "PRIVMSG", - Params = new List<string> { "#channel", "hello" }, - Tags = new Dictionary<string, string> { { "id", "\\" + " " + ";" + "\r\n" } } + 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); @@ -23,11 +23,7 @@ namespace IrcTokens.Tests [TestMethod] public void TestMissingTag() { - var line = new Line - { - Command = "PRIVMSG", - Params = new List<string> { "#channel", "hello" } - }.Format(); + var line = new Line {Command = "PRIVMSG", Params = new List<string> {"#channel", "hello"}}.Format(); Assert.AreEqual("PRIVMSG #channel hello", line); } @@ -38,8 +34,8 @@ namespace IrcTokens.Tests var line = new Line { Command = "PRIVMSG", - Params = new List<string> { "#channel", "hello" }, - Tags = new Dictionary<string, string> { { "a", null } } + Params = new List<string> {"#channel", "hello"}, + Tags = new Dictionary<string, string> {{"a", null}} }.Format(); Assert.AreEqual("@a PRIVMSG #channel hello", line); @@ -51,8 +47,8 @@ namespace IrcTokens.Tests var line = new Line { Command = "PRIVMSG", - Params = new List<string> { "#channel", "hello" }, - Tags = new Dictionary<string, string> { { "a", "" } } + Params = new List<string> {"#channel", "hello"}, + Tags = new Dictionary<string, string> {{"a", ""}} }.Format(); Assert.AreEqual("@a PRIVMSG #channel hello", line); @@ -63,9 +59,7 @@ namespace IrcTokens.Tests { var line = new Line { - Command = "PRIVMSG", - Params = new List<string> { "#channel", "hello" }, - Source = "nick!user@host" + Command = "PRIVMSG", Params = new List<string> {"#channel", "hello"}, Source = "nick!user@host" }.Format(); Assert.AreEqual(":nick!user@host PRIVMSG #channel hello", line); @@ -74,25 +68,21 @@ namespace IrcTokens.Tests [TestMethod] public void TestCommandLowercase() { - var line = new Line { Command = "privmsg" }.Format(); + var line = new Line {Command = "privmsg"}.Format(); Assert.AreEqual("privmsg", line); } [TestMethod] public void TestCommandUppercase() { - var line = new Line { Command = "PRIVMSG" }.Format(); + 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(); + var line = new Line {Command = "PRIVMSG", Params = new List<string> {"#channel", "hello world"}}.Format(); Assert.AreEqual("PRIVMSG #channel :hello world", line); } @@ -100,11 +90,7 @@ namespace IrcTokens.Tests [TestMethod] public void TestTrailingNoSpace() { - var line = new Line - { - Command = "PRIVMSG", - Params = new List<string> { "#channel", "helloworld" } - }.Format(); + var line = new Line {Command = "PRIVMSG", Params = new List<string> {"#channel", "helloworld"}}.Format(); Assert.AreEqual("PRIVMSG #channel helloworld", line); } @@ -112,11 +98,7 @@ namespace IrcTokens.Tests [TestMethod] public void TestTrailingDoubleColon() { - var line = new Line - { - Command = "PRIVMSG", - Params = new List<string> { "#channel", ":helloworld" } - }.Format(); + var line = new Line {Command = "PRIVMSG", Params = new List<string> {"#channel", ":helloworld"}}.Format(); Assert.AreEqual("PRIVMSG #channel ::helloworld", line); } @@ -126,11 +108,7 @@ namespace IrcTokens.Tests { Assert.ThrowsException<ArgumentException>(() => { - new Line - { - Command = "USER", - Params = new List<string> { "user", "0 *", "real name" } - }.Format(); + new Line {Command = "USER", Params = new List<string> {"user", "0 *", "real name"}}.Format(); }); } @@ -139,11 +117,7 @@ namespace IrcTokens.Tests { Assert.ThrowsException<ArgumentException>(() => { - new Line - { - Command = "PRIVMSG", - Params = new List<string> { ":#channel", "hello" } - }.Format(); + new Line {Command = "PRIVMSG", Params = new List<string> {":#channel", "hello"}}.Format(); }); } } |