From be7ffb0d5d36f6f292bfdc779bfd903308c7b439 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 6 May 2020 10:39:59 -0400 Subject: add params Line() constructor --- IrcTokens/Tests/Format.cs | 45 +++++++++++++-------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) (limited to 'IrcTokens/Tests') diff --git a/IrcTokens/Tests/Format.cs b/IrcTokens/Tests/Format.cs index 8ef5344..69a5682 100644 --- a/IrcTokens/Tests/Format.cs +++ b/IrcTokens/Tests/Format.cs @@ -10,11 +10,9 @@ namespace IrcTokens.Tests [TestMethod] public void TestTags() { - var line = new Line + var line = new Line("PRIVMSG", "#channel", "hello") { - Command = "PRIVMSG", - Params = new List {"#channel", "hello"}, - Tags = new Dictionary {{"id", "\\" + " " + ";" + "\r\n"}} + Tags = new Dictionary {{"id", "\\" + " " + ";" + "\r\n"}} }.Format(); Assert.AreEqual("@id=\\\\\\s\\:\\r\\n PRIVMSG #channel hello", line); @@ -23,7 +21,7 @@ namespace IrcTokens.Tests [TestMethod] public void TestMissingTag() { - var line = new Line {Command = "PRIVMSG", Params = new List {"#channel", "hello"}}.Format(); + var line = new Line("PRIVMSG", "#channel", "hello").Format(); Assert.AreEqual("PRIVMSG #channel hello", line); } @@ -31,12 +29,8 @@ namespace IrcTokens.Tests [TestMethod] public void TestNullTag() { - var line = new Line - { - Command = "PRIVMSG", - Params = new List {"#channel", "hello"}, - Tags = new Dictionary {{"a", null}} - }.Format(); + var line = new Line("PRIVMSG", "#channel", "hello") {Tags = new Dictionary {{"a", null}}} + .Format(); Assert.AreEqual("@a PRIVMSG #channel hello", line); } @@ -44,12 +38,8 @@ namespace IrcTokens.Tests [TestMethod] public void TestEmptyTag() { - var line = new Line - { - Command = "PRIVMSG", - Params = new List {"#channel", "hello"}, - Tags = new Dictionary {{"a", ""}} - }.Format(); + var line = new Line("PRIVMSG", "#channel", "hello") {Tags = new Dictionary {{"a", ""}}} + .Format(); Assert.AreEqual("@a PRIVMSG #channel hello", line); } @@ -57,10 +47,7 @@ namespace IrcTokens.Tests [TestMethod] public void TestSource() { - var line = new Line - { - Command = "PRIVMSG", Params = new List {"#channel", "hello"}, Source = "nick!user@host" - }.Format(); + var line = new Line("PRIVMSG", "#channel", "hello") {Source = "nick!user@host"}.Format(); Assert.AreEqual(":nick!user@host PRIVMSG #channel hello", line); } @@ -82,7 +69,7 @@ namespace IrcTokens.Tests [TestMethod] public void TestTrailingSpace() { - var line = new Line {Command = "PRIVMSG", Params = new List {"#channel", "hello world"}}.Format(); + var line = new Line("PRIVMSG", "#channel", "hello world").Format(); Assert.AreEqual("PRIVMSG #channel :hello world", line); } @@ -90,7 +77,7 @@ namespace IrcTokens.Tests [TestMethod] public void TestTrailingNoSpace() { - var line = new Line {Command = "PRIVMSG", Params = new List {"#channel", "helloworld"}}.Format(); + var line = new Line("PRIVMSG", "#channel", "helloworld").Format(); Assert.AreEqual("PRIVMSG #channel helloworld", line); } @@ -98,7 +85,7 @@ namespace IrcTokens.Tests [TestMethod] public void TestTrailingDoubleColon() { - var line = new Line {Command = "PRIVMSG", Params = new List {"#channel", ":helloworld"}}.Format(); + var line = new Line("PRIVMSG", "#channel", ":helloworld").Format(); Assert.AreEqual("PRIVMSG #channel ::helloworld", line); } @@ -106,19 +93,13 @@ namespace IrcTokens.Tests [TestMethod] public void TestInvalidNonLastSpace() { - Assert.ThrowsException(() => - { - new Line {Command = "USER", Params = new List {"user", "0 *", "real name"}}.Format(); - }); + Assert.ThrowsException(() => { new Line("USER", "user", "0 *", "real name").Format(); }); } [TestMethod] public void TestInvalidNonLastColon() { - Assert.ThrowsException(() => - { - new Line {Command = "PRIVMSG", Params = new List {":#channel", "hello"}}.Format(); - }); + Assert.ThrowsException(() => { new Line("PRIVMSG", ":#channel", "hello").Format(); }); } } } -- cgit 1.4.1