diff options
Diffstat (limited to 'IRCTokens/Tests/Parser.cs')
-rw-r--r-- | IRCTokens/Tests/Parser.cs | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/IRCTokens/Tests/Parser.cs b/IRCTokens/Tests/Parser.cs deleted file mode 100644 index a560793..0000000 --- a/IRCTokens/Tests/Parser.cs +++ /dev/null @@ -1,55 +0,0 @@ -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 Parser - { - private static T LoadYaml<T>(string path) - { - var deserializer = new DeserializerBuilder() - .WithNamingConvention(CamelCaseNamingConvention.Instance) - .Build(); - - return deserializer.Deserialize<T>(File.ReadAllText(path)); - } - - [TestMethod] - public void Split() - { - foreach (var test in LoadYaml<SplitModel>("Tests/Data/msg-split.yaml").Tests) - { - var tokens = new Line(test.Input); - var atoms = test.Atoms; - - Assert.AreEqual(atoms.Verb.ToUpper(CultureInfo.InvariantCulture), tokens.Command, - $"command failed on: '{test.Input}'"); - Assert.AreEqual(atoms.Source, tokens.Source, $"source failed on: '{test.Input}'"); - CollectionAssert.AreEqual(atoms.Tags, tokens.Tags, $"tags failed on: '{test.Input}'"); - CollectionAssert.AreEqual(atoms.Params ?? new List<string>(), tokens.Params, - $"params failed on: '{test.Input}'"); - } - } - - [TestMethod] - public void Join() - { - foreach (var test in LoadYaml<JoinModel>("Tests/Data/msg-join.yaml").Tests) - { - var atoms = test.Atoms; - var line = new Line - { - Command = atoms.Verb, Params = atoms.Params, Source = atoms.Source, Tags = atoms.Tags - }.Format(); - - Assert.IsTrue(test.Matches.Contains(line), test.Description); - } - } - } -} |