Exemplo n.º 1
0
        public void GoodTest()
        {
            string path = Path.Combine(TestHelpers.PluginDir, "CapsWatcher", "Config", "SampleCapsWatcherConfig.xml");

            CapsWatcherConfig config = XmlLoader.LoadCapsWatcherConfig(path);

            Assert.AreEqual(3, config.Messages.Count);
            Assert.AreEqual("LOUD NOISES!", config.Messages[0]);
            Assert.AreEqual("@{%user%}: shhhhhhhhhh!", config.Messages[1]);
            Assert.AreEqual("Contrary to popular belief, caps lock is not cruise control for cool :/", config.Messages[2]);
        }
        public void BadXmlTests()
        {
            Assert.Throws <ValidationException>(
                () => XmlLoader.LoadCapsWatcherConfig(Path.Combine(testFilesPath, "EmptyMessage.xml"))
                );

            Assert.Throws <ValidationException>(
                () => XmlLoader.LoadCapsWatcherConfig(Path.Combine(testFilesPath, "NoMessages.xml"))
                );

            Assert.Throws <XmlException>(
                () => XmlLoader.LoadCapsWatcherConfig(Path.Combine(testFilesPath, "BadRoot.xml"))
                );
        }
 public void FileNotFoundTest()
 {
     Assert.Throws <FileNotFoundException>(() => XmlLoader.LoadCapsWatcherConfig("derp.xml"));
 }