Exemplo n.º 1
0
        public void DefaultSettingsTest()
        {
            HttpServerConfig defaultConfig = new HttpServerConfig();
            HttpServerConfig loadedConfig  = XmlLoader.LoadConfig(this.sampleConfigPath);

            Assert.AreEqual(defaultConfig, loadedConfig);
        }
Exemplo n.º 2
0
        public void DefaultTest()
        {
            NewVersionNotifierConfig defaultConfig = new NewVersionNotifierConfig();
            NewVersionNotifierConfig sampleConfig  = XmlLoader.LoadConfig(this.sampleConfigPath);

            Assert.AreEqual(defaultConfig, sampleConfig);
        }
Exemplo n.º 3
0
        public void GoodConfigTest()
        {
            UserListBotConfig xmlConfig = XmlLoader.LoadConfig(Path.Combine(testFilesPath, "GoodConfig.xml"));

            Assert.AreEqual("!command", xmlConfig.Command);
            Assert.AreEqual(0, xmlConfig.Cooldown);
        }
Exemplo n.º 4
0
        public void EmptyFileCreatesDefaultConfig()
        {
            NewVersionNotifierConfig defaultConfig = new NewVersionNotifierConfig();
            NewVersionNotifierConfig emptyConfig   = XmlLoader.LoadConfig(Path.Combine(testFilesPath, "Empty.xml"));

            Assert.AreEqual(defaultConfig, emptyConfig);
        }
Exemplo n.º 5
0
 public void XmlLoadValidationErrorTest()
 {
     Assert.Throws <ValidationException>(() =>
                                         XmlLoader.LoadConfig(
                                             Path.Combine(quoteBotTestDir, "TestFiles", "EmptyStringConfig.xml")
                                             )
                                         );
 }
Exemplo n.º 6
0
        public void BadRootTest()
        {
            WelcomeBotConfig expectedConfig = new WelcomeBotConfig();

            string xmlFile = Path.Combine(this.testFileDir, "BadRoot.xml");

            Assert.Throws <XmlException>(() => XmlLoader.LoadConfig(xmlFile));
        }
Exemplo n.º 7
0
 public void XmlLoadValidationBadRoot()
 {
     Assert.Throws <XmlException>(() =>
                                  XmlLoader.LoadConfig(
                                      Path.Combine(quoteBotTestDir, "TestFiles", "BadRootConfig.xml")
                                      )
                                  );
 }
Exemplo n.º 8
0
        public void EmptyXmlTest()
        {
            WelcomeBotConfig expectedConfig = new WelcomeBotConfig();

            string           xmlFile      = Path.Combine(this.testFileDir, "EmptyConfig.xml");
            WelcomeBotConfig actualConfig = XmlLoader.LoadConfig(xmlFile);

            Assert.AreEqual(expectedConfig, actualConfig);
        }
Exemplo n.º 9
0
        public void EmptyValueTest()
        {
            UserListBotConfig defaultConfig = new UserListBotConfig();

            UserListBotConfig xmlConfig = XmlLoader.LoadConfig(Path.Combine(testFilesPath, "BlankConfig.xml"));

            Assert.AreEqual(defaultConfig.Command, xmlConfig.Command);
            Assert.AreEqual(defaultConfig.Cooldown, xmlConfig.Cooldown);
        }
Exemplo n.º 10
0
        public void DefaultConfigTest()
        {
            WelcomeBotConfig expectedConfig = new WelcomeBotConfig();

            string           xmlFile      = Path.Combine(this.sampleConfigDir, "SampleWelcomeBotConfig.xml");
            WelcomeBotConfig actualConfig = XmlLoader.LoadConfig(xmlFile);

            Assert.AreEqual(expectedConfig, actualConfig);
        }
Exemplo n.º 11
0
        public void DefaultConfigTest()
        {
            QuoteBotConfig defaultConfig = new QuoteBotConfig();
            QuoteBotConfig loadedConfig  = XmlLoader.LoadConfig(
                Path.Combine(quoteBotPluginDir, "Config", "SampleQuoteBotConfig.xml")
                );

            Assert.AreEqual(defaultConfig, loadedConfig);
        }
Exemplo n.º 12
0
        public void ValidFileTest()
        {
            NewVersionNotifierConfig expectedConfig = new NewVersionNotifierConfig()
            {
                Message = "Test Message"
            };
            NewVersionNotifierConfig emptyConfig = XmlLoader.LoadConfig(Path.Combine(testFilesPath, "ValidFile.xml"));

            Assert.AreEqual(expectedConfig, emptyConfig);
        }
Exemplo n.º 13
0
        public void DefaultValueTest()
        {
            string path = Path.Combine(TestHelpers.PluginDir, "UserListBot", "Config", "SampleUserListBotConfig.xml");

            UserListBotConfig defaultConfig = new UserListBotConfig();

            UserListBotConfig xmlConfig = XmlLoader.LoadConfig(path);

            Assert.AreEqual(defaultConfig.Command, xmlConfig.Command);
            Assert.AreEqual(defaultConfig.Cooldown, xmlConfig.Cooldown);
        }
Exemplo n.º 14
0
        public void LoadTest()
        {
            HttpServerConfig expectedConfig = new HttpServerConfig
            {
                Port = 80
            };

            HttpServerConfig actualConfig = XmlLoader.LoadConfig(Path.Combine(this.testFilesDir, "GoodConfig.xml"));

            Assert.AreEqual(expectedConfig, actualConfig);
        }
Exemplo n.º 15
0
        public void GoodConfigTest()
        {
            WelcomeBotConfig expectedConfig = new WelcomeBotConfig
            {
                EnableJoinMessages  = false,
                EnableKickMessages  = false,
                EnablePartMessages  = false,
                KarmaBotIntegration = true
            };

            string           xmlFile      = Path.Combine(this.testFileDir, "GoodConfig.xml");
            WelcomeBotConfig actualConfig = XmlLoader.LoadConfig(xmlFile);

            Assert.AreEqual(expectedConfig, actualConfig);
        }
Exemplo n.º 16
0
        public void XmlLoadTest()
        {
            QuoteBotConfig expectedConfig = new QuoteBotConfig();

            expectedConfig.AddCommand    = @"^@quote\s+add\s+\<(?<user>\S+)\>\s+(?<quote>.+)";
            expectedConfig.DeleteCommand = @"^@quote\s+delete\s+(?<id>\d+)";
            expectedConfig.RandomCommand = @"^@quote\s+random";
            expectedConfig.GetCommand    = @"^@quote\s+(get)?\s*(?<id>\d+)";

            QuoteBotConfig loadedConfig = XmlLoader.LoadConfig(
                Path.Combine(quoteBotTestDir, "TestFiles", "GoodConfig.xml")
                );

            Assert.AreEqual(expectedConfig, loadedConfig);
        }
Exemplo n.º 17
0
 public void IncorrectXmlRoot()
 {
     Assert.Throws <XmlException>(
         () => XmlLoader.LoadConfig(Path.Combine(testFilesPath, "BadRoot.xml"))
         );
 }
Exemplo n.º 18
0
 public void FileNotFoundTest()
 {
     Assert.Throws <FileNotFoundException>(() => XmlLoader.LoadConfig("lol"));
 }
Exemplo n.º 19
0
        public void BadRootTest()
        {
            string filePath = Path.Combine(this.testFilesDir, "BadRoot.xml");

            Assert.Throws <XmlException>(() => XmlLoader.LoadConfig(filePath));
        }