예제 #1
0
        public void ValidationTest()
        {
            // Default construction should pass.
            Assert.DoesNotThrow(() => this.uut.Validate());

            // Null, empty, or whitespace command should fail.
            this.uut.Command = null;
            Assert.Throws <ValidationException>(() => this.uut.Validate());
            this.uut = new UserListBotConfig();

            this.uut.Command = string.Empty;
            Assert.Throws <ValidationException>(() => this.uut.Validate());
            this.uut = new UserListBotConfig();

            this.uut.Command = "   ";
            Assert.Throws <ValidationException>(() => this.uut.Validate());
            this.uut = new UserListBotConfig();

            // Negative cooldown should fail.
            this.uut.Cooldown = -1;
            Assert.Throws <ValidationException>(() => this.uut.Validate());
            this.uut = new UserListBotConfig();

            // Zero cooldown should not.
            this.uut.Cooldown = 0;;
            Assert.DoesNotThrow(() => this.uut.Validate());
            this.uut = new UserListBotConfig();
        }
예제 #2
0
        public void GoodConfigTest()
        {
            UserListBotConfig xmlConfig = XmlLoader.LoadConfig(Path.Combine(testFilesPath, "GoodConfig.xml"));

            Assert.AreEqual("!command", xmlConfig.Command);
            Assert.AreEqual(0, xmlConfig.Cooldown);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
0
 public void TestSetup()
 {
     this.uut = new UserListBotConfig();
 }