Beispiel #1
0
        public bool Validate(CarrotCommandLine cmds)
        {
            bool hasUserName = cmds.ContainsKey(CommandLineArguments.BunnyUser);
            bool hasPasswd   = cmds.ContainsKey(CommandLineArguments.BunnyPwd);

            if (cmds.ContainsKey(CommandLineArguments.Bunny))
            {
                if (hasUserName && !hasPasswd)
                {
                    throw new ArgumentException("Bamboo Build Bunny service password must be specified.");
                }
                if (!hasUserName && hasPasswd)
                {
                    throw new ArgumentException("Bamboo Build Bunny service username must be specified.");
                }
                if (!hasUserName && !hasPasswd)
                {
                    throw new ArgumentException("Bamboo Build Bunny service usename and password must be specified.");
                }
            }
            else
            {
                if (hasUserName || hasPasswd)
                {
                    throw new ArgumentException("Bamboo Build Bunny service URL is not specified.");
                }
            }
            return(true);
        }
Beispiel #2
0
 public void ParseNonexistentCommandLineParameter()
 {
     try
     {
         // changed -seq to -sew
         CarrotCommandLine cmd = new CarrotCommandLine(Args(
                                                           "-sew http:\\sequrl -bunny http:\\bunyyurl.json -bunnyuser username -bunnypasswd password -updatefolder \\\\updateserver\\updatefolder"));
     }
     catch (NotSupportedException)
     {
         // nothing
     }
 }
Beispiel #3
0
        public void CommandLineValidatorTest()
        {
            var cmdline = new CarrotCommandLine(Args(
                                                    "-seq http:\\sequrl -bunnyuser username -bunnypasswd password"));

            try
            {
                cmdline.Validate();
            }
            catch (ArgumentException)
            {
                // nothing
            }
            Assert.IsTrue(new CarrotCommandLine(Args(ValidCommandLine)).Validate());
        }
Beispiel #4
0
        public void TestBunnyValidationRule()
        {
            var cmdline = new CarrotCommandLine(Args(
                                                    "-seq http:\\sequrl -bunnyuser username -bunnypasswd password"));
            var rule = new CommandLineBunnySettingsValidationRule();

            try
            {
                rule.Validate(cmdline);
            }
            catch (ArgumentException)
            {
                // nothing
            }
        }
Beispiel #5
0
        public void ParseValidCommandLineTest()
        {
            CarrotCommandLine cmd = new CarrotCommandLine(Args(
                                                              "-seq http:\\sequrl -bunny http:\\bunyyurl.json -bunnyuser username -bunnypasswd password -updatefolder \\\\updateserver\\updatefolder"));

            Assert.IsTrue(cmd.ContainsKey(CommandLineArguments.Seq));
            Assert.IsTrue(cmd[CommandLineArguments.Seq].Equals("http:\\sequrl"));
            Assert.IsTrue(cmd.ContainsKey(CommandLineArguments.Bunny));
            Assert.IsTrue(cmd[CommandLineArguments.Bunny].Equals("http:\\bunyyurl.json"));
            Assert.IsTrue(cmd.ContainsKey(CommandLineArguments.BunnyUser));
            Assert.IsTrue(cmd[CommandLineArguments.BunnyUser].Equals("username"));
            Assert.IsTrue(cmd.ContainsKey(CommandLineArguments.BunnyPwd));
            Assert.IsTrue(cmd[CommandLineArguments.BunnyPwd].Equals("password"));
            Assert.IsTrue(cmd.ContainsKey(CommandLineArguments.UpdateFolder));
            Assert.IsTrue(cmd[CommandLineArguments.UpdateFolder].Equals("\\\\updateserver\\updatefolder"));
        }