public void DefaultSettingsTest() { HttpServerConfig defaultConfig = new HttpServerConfig(); HttpServerConfig loadedConfig = XmlLoader.LoadConfig(this.sampleConfigPath); Assert.AreEqual(defaultConfig, loadedConfig); }
public void DefaultTest() { NewVersionNotifierConfig defaultConfig = new NewVersionNotifierConfig(); NewVersionNotifierConfig sampleConfig = XmlLoader.LoadConfig(this.sampleConfigPath); Assert.AreEqual(defaultConfig, sampleConfig); }
public void GoodConfigTest() { UserListBotConfig xmlConfig = XmlLoader.LoadConfig(Path.Combine(testFilesPath, "GoodConfig.xml")); Assert.AreEqual("!command", xmlConfig.Command); Assert.AreEqual(0, xmlConfig.Cooldown); }
public void EmptyFileCreatesDefaultConfig() { NewVersionNotifierConfig defaultConfig = new NewVersionNotifierConfig(); NewVersionNotifierConfig emptyConfig = XmlLoader.LoadConfig(Path.Combine(testFilesPath, "Empty.xml")); Assert.AreEqual(defaultConfig, emptyConfig); }
public void XmlLoadValidationErrorTest() { Assert.Throws <ValidationException>(() => XmlLoader.LoadConfig( Path.Combine(quoteBotTestDir, "TestFiles", "EmptyStringConfig.xml") ) ); }
public void BadRootTest() { WelcomeBotConfig expectedConfig = new WelcomeBotConfig(); string xmlFile = Path.Combine(this.testFileDir, "BadRoot.xml"); Assert.Throws <XmlException>(() => XmlLoader.LoadConfig(xmlFile)); }
public void XmlLoadValidationBadRoot() { Assert.Throws <XmlException>(() => XmlLoader.LoadConfig( Path.Combine(quoteBotTestDir, "TestFiles", "BadRootConfig.xml") ) ); }
public void EmptyXmlTest() { WelcomeBotConfig expectedConfig = new WelcomeBotConfig(); string xmlFile = Path.Combine(this.testFileDir, "EmptyConfig.xml"); WelcomeBotConfig actualConfig = XmlLoader.LoadConfig(xmlFile); Assert.AreEqual(expectedConfig, actualConfig); }
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); }
public void DefaultConfigTest() { WelcomeBotConfig expectedConfig = new WelcomeBotConfig(); string xmlFile = Path.Combine(this.sampleConfigDir, "SampleWelcomeBotConfig.xml"); WelcomeBotConfig actualConfig = XmlLoader.LoadConfig(xmlFile); Assert.AreEqual(expectedConfig, actualConfig); }
public void DefaultConfigTest() { QuoteBotConfig defaultConfig = new QuoteBotConfig(); QuoteBotConfig loadedConfig = XmlLoader.LoadConfig( Path.Combine(quoteBotPluginDir, "Config", "SampleQuoteBotConfig.xml") ); Assert.AreEqual(defaultConfig, loadedConfig); }
public void ValidFileTest() { NewVersionNotifierConfig expectedConfig = new NewVersionNotifierConfig() { Message = "Test Message" }; NewVersionNotifierConfig emptyConfig = XmlLoader.LoadConfig(Path.Combine(testFilesPath, "ValidFile.xml")); Assert.AreEqual(expectedConfig, emptyConfig); }
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); }
public void LoadTest() { HttpServerConfig expectedConfig = new HttpServerConfig { Port = 80 }; HttpServerConfig actualConfig = XmlLoader.LoadConfig(Path.Combine(this.testFilesDir, "GoodConfig.xml")); Assert.AreEqual(expectedConfig, actualConfig); }
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); }
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); }
public void IncorrectXmlRoot() { Assert.Throws <XmlException>( () => XmlLoader.LoadConfig(Path.Combine(testFilesPath, "BadRoot.xml")) ); }
public void FileNotFoundTest() { Assert.Throws <FileNotFoundException>(() => XmlLoader.LoadConfig("lol")); }
public void BadRootTest() { string filePath = Path.Combine(this.testFilesDir, "BadRoot.xml"); Assert.Throws <XmlException>(() => XmlLoader.LoadConfig(filePath)); }