From 80afa2c0aec37b7f98cc22615417c36672e695da Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Tue, 28 Apr 2020 00:35:52 -0400 Subject: tidy up, work on stateful --- IrcTokens/Tests/Format.cs | 60 ++++++++++++++--------------------------------- 1 file changed, 17 insertions(+), 43 deletions(-) (limited to 'IrcTokens/Tests/Format.cs') 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 { "#channel", "hello" }, - Tags = new Dictionary { { "id", "\\" + " " + ";" + "\r\n" } } + Params = new List {"#channel", "hello"}, + Tags = new Dictionary {{"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 { "#channel", "hello" } - }.Format(); + var line = new Line {Command = "PRIVMSG", Params = new List {"#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 { "#channel", "hello" }, - Tags = new Dictionary { { "a", null } } + Params = new List {"#channel", "hello"}, + Tags = new Dictionary {{"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 { "#channel", "hello" }, - Tags = new Dictionary { { "a", "" } } + Params = new List {"#channel", "hello"}, + Tags = new Dictionary {{"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 { "#channel", "hello" }, - Source = "nick!user@host" + Command = "PRIVMSG", Params = new List {"#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 { "#channel", "hello world" } - }.Format(); + var line = new Line {Command = "PRIVMSG", Params = new List {"#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 { "#channel", "helloworld" } - }.Format(); + var line = new Line {Command = "PRIVMSG", Params = new List {"#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 { "#channel", ":helloworld" } - }.Format(); + var line = new Line {Command = "PRIVMSG", Params = new List {"#channel", ":helloworld"}}.Format(); Assert.AreEqual("PRIVMSG #channel ::helloworld", line); } @@ -126,11 +108,7 @@ namespace IrcTokens.Tests { Assert.ThrowsException(() => { - new Line - { - Command = "USER", - Params = new List { "user", "0 *", "real name" } - }.Format(); + new Line {Command = "USER", Params = new List {"user", "0 *", "real name"}}.Format(); }); } @@ -139,11 +117,7 @@ namespace IrcTokens.Tests { Assert.ThrowsException(() => { - new Line - { - Command = "PRIVMSG", - Params = new List { ":#channel", "hello" } - }.Format(); + new Line {Command = "PRIVMSG", Params = new List {":#channel", "hello"}}.Format(); }); } } -- cgit 1.4.1