diff options
Diffstat (limited to 'IrcTokens/Tests')
-rw-r--r-- | IrcTokens/Tests/Format.cs (renamed from IrcTokens/Tests/FormatTests.cs) | 36 | ||||
-rw-r--r-- | IrcTokens/Tests/Hostmask.cs (renamed from IrcTokens/Tests/HostmaskTests.cs) | 12 | ||||
-rw-r--r-- | IrcTokens/Tests/Parser.cs (renamed from IrcTokens/Tests/ParserTests.cs) | 10 | ||||
-rw-r--r-- | IrcTokens/Tests/StatefulDecoder.cs (renamed from IrcTokens/Tests/StatefulDecoderTests.cs) | 17 | ||||
-rw-r--r-- | IrcTokens/Tests/StatefulEncoder.cs (renamed from IrcTokens/Tests/StatefulEncoderTests.cs) | 11 | ||||
-rw-r--r-- | IrcTokens/Tests/Tokenization.cs (renamed from IrcTokens/Tests/TokenizationTests.cs) | 14 |
6 files changed, 49 insertions, 51 deletions
diff --git a/IrcTokens/Tests/FormatTests.cs b/IrcTokens/Tests/Format.cs index a804c1d..64f974a 100644 --- a/IrcTokens/Tests/FormatTests.cs +++ b/IrcTokens/Tests/Format.cs @@ -5,16 +5,16 @@ using System.Collections.Generic; namespace IrcTokens.Tests { [TestClass] - public class FormatTests + public class Format { [TestMethod] public void TestTags() { var line = new Line { - Command = "PRIVMSG", - Params = new List<string> {"#channel", "hello"}, - Tags = new Dictionary<string, string> {{"id", "\\" + " " + ";" + "\r\n"}} + 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); @@ -25,8 +25,8 @@ namespace IrcTokens.Tests { var line = new Line { - Command = "PRIVMSG", - Params = new List<string> {"#channel", "hello"} + Command = "PRIVMSG", + Params = new List<string> { "#channel", "hello" } }.Format(); Assert.AreEqual("PRIVMSG #channel hello", line); @@ -38,8 +38,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 +51,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); @@ -64,7 +64,7 @@ namespace IrcTokens.Tests var line = new Line { Command = "PRIVMSG", - Params = new List<string> {"#channel", "hello"}, + Params = new List<string> { "#channel", "hello" }, Source = "nick!user@host" }.Format(); @@ -74,14 +74,14 @@ 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); } @@ -91,7 +91,7 @@ namespace IrcTokens.Tests var line = new Line { Command = "PRIVMSG", - Params = new List<string> {"#channel", "hello world"} + Params = new List<string> { "#channel", "hello world" } }.Format(); Assert.AreEqual("PRIVMSG #channel :hello world", line); @@ -103,7 +103,7 @@ namespace IrcTokens.Tests var line = new Line { Command = "PRIVMSG", - Params = new List<string> {"#channel", "helloworld"} + Params = new List<string> { "#channel", "helloworld" } }.Format(); Assert.AreEqual("PRIVMSG #channel helloworld", line); @@ -115,7 +115,7 @@ namespace IrcTokens.Tests var line = new Line { Command = "PRIVMSG", - Params = new List<string> {"#channel", ":helloworld"} + Params = new List<string> { "#channel", ":helloworld" } }.Format(); Assert.AreEqual("PRIVMSG #channel ::helloworld", line); @@ -129,7 +129,7 @@ namespace IrcTokens.Tests new Line { Command = "USER", - Params = new List<string> {"user", "0 *", "real name"} + Params = new List<string> { "user", "0 *", "real name" } }.Format(); }); } @@ -142,7 +142,7 @@ namespace IrcTokens.Tests new Line { Command = "PRIVMSG", - Params = new List<string> {":#channel", "hello"} + Params = new List<string> { ":#channel", "hello" } }.Format(); }); } diff --git a/IrcTokens/Tests/HostmaskTests.cs b/IrcTokens/Tests/Hostmask.cs index 78b8a54..51bc182 100644 --- a/IrcTokens/Tests/HostmaskTests.cs +++ b/IrcTokens/Tests/Hostmask.cs @@ -3,12 +3,12 @@ namespace IrcTokens.Tests { [TestClass] - public class HostmaskTests + public class Hostmask { [TestMethod] public void TestHostmask() { - var hostmask = new Hostmask("nick!user@host"); + var hostmask = new IrcTokens.Hostmask("nick!user@host"); Assert.AreEqual("nick", hostmask.NickName); Assert.AreEqual("user", hostmask.UserName); Assert.AreEqual("host", hostmask.HostName); @@ -17,7 +17,7 @@ namespace IrcTokens.Tests [TestMethod] public void TestNoHostName() { - var hostmask = new Hostmask("nick!user"); + var hostmask = new IrcTokens.Hostmask("nick!user"); Assert.AreEqual("nick", hostmask.NickName); Assert.AreEqual("user", hostmask.UserName); Assert.IsNull(hostmask.HostName); @@ -26,7 +26,7 @@ namespace IrcTokens.Tests [TestMethod] public void TestNoUserName() { - var hostmask = new Hostmask("nick@host"); + var hostmask = new IrcTokens.Hostmask("nick@host"); Assert.AreEqual("nick", hostmask.NickName); Assert.IsNull(hostmask.UserName); Assert.AreEqual("host", hostmask.HostName); @@ -35,7 +35,7 @@ namespace IrcTokens.Tests [TestMethod] public void TestOnlyNickName() { - var hostmask = new Hostmask("nick"); + var hostmask = new IrcTokens.Hostmask("nick"); Assert.AreEqual("nick", hostmask.NickName); Assert.IsNull(hostmask.UserName); Assert.IsNull(hostmask.HostName); @@ -45,7 +45,7 @@ namespace IrcTokens.Tests public void TestHostmaskFromLine() { var line = new Line(":nick!user@host PRIVMSG #channel hello"); - var hostmask = new Hostmask("nick!user@host"); + var hostmask = new IrcTokens.Hostmask("nick!user@host"); Assert.AreEqual(hostmask.ToString(), line.Hostmask.ToString()); Assert.AreEqual("nick", line.Hostmask.NickName); Assert.AreEqual("user", line.Hostmask.UserName); diff --git a/IrcTokens/Tests/ParserTests.cs b/IrcTokens/Tests/Parser.cs index ad734cf..df70b92 100644 --- a/IrcTokens/Tests/ParserTests.cs +++ b/IrcTokens/Tests/Parser.cs @@ -1,15 +1,15 @@ -using System.Collections.Generic; +using IrcTokens.Tests.Data; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; using System.Globalization; using System.IO; -using IrcTokens.Tests.Data; -using Microsoft.VisualStudio.TestTools.UnitTesting; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; namespace IrcTokens.Tests { [TestClass] - public class ParserTests + public class Parser { private static T LoadYaml<T>(string path) { @@ -46,7 +46,7 @@ namespace IrcTokens.Tests { Command = atoms.Verb, Params = atoms.Params, - Source = atoms.Source ?? null, + Source = atoms.Source, Tags = atoms.Tags }.Format(); diff --git a/IrcTokens/Tests/StatefulDecoderTests.cs b/IrcTokens/Tests/StatefulDecoder.cs index 3e6a078..209a6cf 100644 --- a/IrcTokens/Tests/StatefulDecoderTests.cs +++ b/IrcTokens/Tests/StatefulDecoder.cs @@ -1,19 +1,18 @@ -using System.Collections.Generic; -using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; namespace IrcTokens.Tests { [TestClass] - public class StatefulDecoderTests + public class StatefulDecoder { - private StatefulDecoder _decoder; + private IrcTokens.StatefulDecoder _decoder; [TestInitialize] public void TestInitialize() { - _decoder = new StatefulDecoder(); + _decoder = new IrcTokens.StatefulDecoder(); } [TestMethod] @@ -26,7 +25,7 @@ namespace IrcTokens.Tests Assert.AreEqual(1, lines.Count); var line = new Line("PRIVMSG #channel hello"); - CollectionAssert.AreEqual(new List<Line> {line}, lines); + CollectionAssert.AreEqual(new List<Line> { line }, lines); } [TestMethod] @@ -45,7 +44,7 @@ namespace IrcTokens.Tests public void TestEncoding() { var iso8859 = Encoding.GetEncoding("iso-8859-1"); - _decoder = new StatefulDecoder {Encoding = iso8859}; + _decoder = new IrcTokens.StatefulDecoder { Encoding = iso8859 }; var lines = _decoder.Push(iso8859.GetBytes("PRIVMSG #channel :hello Ç\r\n")); var line = new Line("PRIVMSG #channel :hello Ç"); Assert.IsTrue(line.Equals(lines[0])); @@ -55,7 +54,7 @@ namespace IrcTokens.Tests public void TestEncodingFallback() { var latin1 = Encoding.GetEncoding("iso-8859-1"); - _decoder = new StatefulDecoder {Encoding = null, Fallback = latin1}; + _decoder = new IrcTokens.StatefulDecoder { Encoding = null, Fallback = latin1 }; var lines = _decoder.Push(latin1.GetBytes("PRIVMSG #channel hélló\r\n")); Assert.AreEqual(1, lines.Count); Assert.IsTrue(new Line("PRIVMSG #channel hélló").Equals(lines[0])); diff --git a/IrcTokens/Tests/StatefulEncoderTests.cs b/IrcTokens/Tests/StatefulEncoder.cs index 477b38d..e3ed70d 100644 --- a/IrcTokens/Tests/StatefulEncoderTests.cs +++ b/IrcTokens/Tests/StatefulEncoder.cs @@ -1,18 +1,17 @@ -using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; namespace IrcTokens.Tests { [TestClass] - public class StatefulEncoderTests + public class StatefulEncoder { - private StatefulEncoder _encoder; + private IrcTokens.StatefulEncoder _encoder; [TestInitialize] public void TestInitialize() { - _encoder = new StatefulEncoder(); + _encoder = new IrcTokens.StatefulEncoder(); } [TestMethod] @@ -64,7 +63,7 @@ namespace IrcTokens.Tests public void TestEncoding() { var iso8859 = Encoding.GetEncoding("iso-8859-1"); - _encoder = new StatefulEncoder {Encoding = iso8859}; + _encoder = new IrcTokens.StatefulEncoder { Encoding = iso8859 }; _encoder.Push(new Line("PRIVMSG #channel :hello Ç")); CollectionAssert.AreEqual(iso8859.GetBytes("PRIVMSG #channel :hello Ç\r\n"), _encoder.PendingBytes); } diff --git a/IrcTokens/Tests/TokenizationTests.cs b/IrcTokens/Tests/Tokenization.cs index 6d8a69d..c4970ed 100644 --- a/IrcTokens/Tests/TokenizationTests.cs +++ b/IrcTokens/Tests/Tokenization.cs @@ -1,10 +1,10 @@ -using System.Collections.Generic; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; namespace IrcTokens.Tests { [TestClass] - public class TokenizationTests + public class Tokenization { [TestMethod] public void TestTagsMissing() @@ -87,14 +87,14 @@ namespace IrcTokens.Tests public void TestParamsTrailing() { var line = new Line("PRIVMSG #channel :hello world"); - CollectionAssert.AreEqual(new List<string> {"#channel", "hello world"}, line.Params); + CollectionAssert.AreEqual(new List<string> { "#channel", "hello world" }, line.Params); } [TestMethod] public void TestParamsOnlyTrailing() { var line = new Line("PRIVMSG :hello world"); - CollectionAssert.AreEqual(new List<string> {"hello world"}, line.Params); + CollectionAssert.AreEqual(new List<string> { "hello world" }, line.Params); } [TestMethod] @@ -109,10 +109,10 @@ namespace IrcTokens.Tests public void TestAllTokens() { var line = new Line("@id=123 :nick!user@host PRIVMSG #channel :hello world"); - CollectionAssert.AreEqual(new Dictionary<string, string> {{"id", "123"}}, line.Tags); + CollectionAssert.AreEqual(new Dictionary<string, string> { { "id", "123" } }, line.Tags); Assert.AreEqual("nick!user@host", line.Source); Assert.AreEqual("PRIVMSG", line.Command); - CollectionAssert.AreEqual(new List<string> {"#channel", "hello world"}, line.Params); + CollectionAssert.AreEqual(new List<string> { "#channel", "hello world" }, line.Params); } } } |