···23232424### stateful
25252626-see the full example in [Examples/Tokens/Client.cs](Examples/Tokens/Client.cs)
2626+see the full example in [Examples/Tokens/Client.cs](../Examples/Tokens/Client.cs)
27272828 public class Client
2929 {
+13-32
IrcTokens/Tests/Format.cs
···1010 [TestMethod]
1111 public void TestTags()
1212 {
1313- var line = new Line
1313+ var line = new Line("PRIVMSG", "#channel", "hello")
1414 {
1515- Command = "PRIVMSG",
1616- Params = new List<string> {"#channel", "hello"},
1717- Tags = new Dictionary<string, string> {{"id", "\\" + " " + ";" + "\r\n"}}
1515+ Tags = new Dictionary<string, string> {{"id", "\\" + " " + ";" + "\r\n"}}
1816 }.Format();
19172018 Assert.AreEqual("@id=\\\\\\s\\:\\r\\n PRIVMSG #channel hello", line);
···2321 [TestMethod]
2422 public void TestMissingTag()
2523 {
2626- var line = new Line {Command = "PRIVMSG", Params = new List<string> {"#channel", "hello"}}.Format();
2424+ var line = new Line("PRIVMSG", "#channel", "hello").Format();
27252826 Assert.AreEqual("PRIVMSG #channel hello", line);
2927 }
···3129 [TestMethod]
3230 public void TestNullTag()
3331 {
3434- var line = new Line
3535- {
3636- Command = "PRIVMSG",
3737- Params = new List<string> {"#channel", "hello"},
3838- Tags = new Dictionary<string, string> {{"a", null}}
3939- }.Format();
3232+ var line = new Line("PRIVMSG", "#channel", "hello") {Tags = new Dictionary<string, string> {{"a", null}}}
3333+ .Format();
40344135 Assert.AreEqual("@a PRIVMSG #channel hello", line);
4236 }
···4438 [TestMethod]
4539 public void TestEmptyTag()
4640 {
4747- var line = new Line
4848- {
4949- Command = "PRIVMSG",
5050- Params = new List<string> {"#channel", "hello"},
5151- Tags = new Dictionary<string, string> {{"a", ""}}
5252- }.Format();
4141+ var line = new Line("PRIVMSG", "#channel", "hello") {Tags = new Dictionary<string, string> {{"a", ""}}}
4242+ .Format();
53435444 Assert.AreEqual("@a PRIVMSG #channel hello", line);
5545 }
···5747 [TestMethod]
5848 public void TestSource()
5949 {
6060- var line = new Line
6161- {
6262- Command = "PRIVMSG", Params = new List<string> {"#channel", "hello"}, Source = "nick!user@host"
6363- }.Format();
5050+ var line = new Line("PRIVMSG", "#channel", "hello") {Source = "nick!user@host"}.Format();
64516552 Assert.AreEqual(":nick!user@host PRIVMSG #channel hello", line);
6653 }
···8269 [TestMethod]
8370 public void TestTrailingSpace()
8471 {
8585- var line = new Line {Command = "PRIVMSG", Params = new List<string> {"#channel", "hello world"}}.Format();
7272+ var line = new Line("PRIVMSG", "#channel", "hello world").Format();
86738774 Assert.AreEqual("PRIVMSG #channel :hello world", line);
8875 }
···9077 [TestMethod]
9178 public void TestTrailingNoSpace()
9279 {
9393- var line = new Line {Command = "PRIVMSG", Params = new List<string> {"#channel", "helloworld"}}.Format();
8080+ var line = new Line("PRIVMSG", "#channel", "helloworld").Format();
94819582 Assert.AreEqual("PRIVMSG #channel helloworld", line);
9683 }
···9885 [TestMethod]
9986 public void TestTrailingDoubleColon()
10087 {
101101- var line = new Line {Command = "PRIVMSG", Params = new List<string> {"#channel", ":helloworld"}}.Format();
8888+ var line = new Line("PRIVMSG", "#channel", ":helloworld").Format();
1028910390 Assert.AreEqual("PRIVMSG #channel ::helloworld", line);
10491 }
···10693 [TestMethod]
10794 public void TestInvalidNonLastSpace()
10895 {
109109- Assert.ThrowsException<ArgumentException>(() =>
110110- {
111111- new Line {Command = "USER", Params = new List<string> {"user", "0 *", "real name"}}.Format();
112112- });
9696+ Assert.ThrowsException<ArgumentException>(() => { new Line("USER", "user", "0 *", "real name").Format(); });
11397 }
1149811599 [TestMethod]
116100 public void TestInvalidNonLastColon()
117101 {
118118- Assert.ThrowsException<ArgumentException>(() =>
119119- {
120120- new Line {Command = "PRIVMSG", Params = new List<string> {":#channel", "hello"}}.Format();
121121- });
102102+ Assert.ThrowsException<ArgumentException>(() => { new Line("PRIVMSG", ":#channel", "hello").Format(); });
122103 }
123104 }
124105}