示例#1
0
        public void ParseInputConfigurationTest()
        {
            string[][] argsList =
            {
                new string[] { "Input.cs", "/c:c:\\temp\\MyConfig.xml"             },
                new string[] { "Input.cs", "/C:c:\\temp\\MyConfig.xml"             },
                new string[] { "Input.cs", "/configuration:c:\\temp\\MyConfig.xml" },
                new string[] { "Input.cs", "/Configuration:c:\\temp\\MyConfig.xml" },
                new string[] { "Input.cs", "/CONFIGURATION:c:\\temp\\MyConfig.xml" }
            };

            foreach (string[] args in argsList)
            {
                CommandArguments commandArgs = CommandArguments.Parse(args);

                Assert.AreEqual(
                    "c:\\temp\\MyConfig.xml",
                    commandArgs.Configuration,
                    "Unexpected value for Configuration");
                Assert.AreEqual("Input.cs", commandArgs.Input, "Unexpected value for Input");
                Assert.IsNull(commandArgs.Output, "Unexpected value for Output");
                Assert.IsFalse(commandArgs.Backup, "Unexpected value for Backup");
                Assert.IsFalse(commandArgs.Restore, "Unexpected value for Restore");
                Assert.IsFalse(commandArgs.Trace, "Unexpected value for Trace");
            }
        }
示例#2
0
        public void ParseInputBackupTest()
        {
            string[][] argsList =
            {
                new string[] { "Input.cs", "/b"      },
                new string[] { "Input.cs", "-b"      },
                new string[] { "Input.cs", "/B"      },
                new string[] { "Input.cs", "/backup" },
                new string[] { "Input.cs", "/Backup" },
                new string[] { "Input.cs", "/BACKUP" },
                new string[] { "Input.cs", "-BACKUP" }
            };

            foreach (string[] args in argsList)
            {
                CommandArguments commandArgs = CommandArguments.Parse(args);

                Assert.IsNull(commandArgs.Configuration, "Unexpected value for Configuration");
                Assert.AreEqual("Input.cs", commandArgs.Input, "Unexpected value for Input");
                Assert.IsNull(commandArgs.Output, "Unexpected value for Output");
                Assert.IsTrue(commandArgs.Backup, "Unexpected value for Backup");
                Assert.IsFalse(commandArgs.Restore, "Unexpected value for Restore");
                Assert.IsFalse(commandArgs.Trace, "Unexpected value for Trace");
            }
        }
示例#3
0
 public void ParseInputBackupRestoreTest()
 {
     Assert.Throws <ArgumentException>(
         delegate
     {
         CommandArguments.Parse("Input.cs", "/b", "/r");
     });
 }
示例#4
0
 public void ParseInputBackupInvalidTest()
 {
     Assert.Throws <ArgumentException>(
         delegate
     {
         CommandArguments.Parse("Input.cs", "/bakup");
     });
 }
示例#5
0
 public void ParseUnknownFlagTest()
 {
     Assert.Throws <ArgumentException>(
         delegate
     {
         CommandArguments.Parse("Input.cs", "/z");
     });
 }
示例#6
0
 public void ParseNullArrayTest()
 {
     Assert.Throws <ArgumentException>(
         delegate
     {
         CommandArguments.Parse(null);
     });
 }
示例#7
0
 public void ParseNullArgTest()
 {
     Assert.Throws <ArgumentException>(
         delegate
     {
         CommandArguments.Parse("Input.cs", null);
     });
 }
示例#8
0
 public void ParseEmptyArrayTest()
 {
     Assert.Throws <ArgumentException>(
         delegate
     {
         CommandArguments.Parse(new string[] { });
     });
 }
示例#9
0
 public void ParseInputTraceInvalidTest()
 {
     Assert.Throws <ArgumentException>(
         delegate
     {
         CommandArguments.Parse("Input.cs", "/trce");
     });
 }
示例#10
0
 public void ParseInputOutputExtraneousTest()
 {
     Assert.Throws <ArgumentException>(
         delegate
     {
         CommandArguments.Parse("Input.cs", "Output.cs", "Extraneous.cs");
     });
 }
示例#11
0
 public void ParseEmptyArgTest()
 {
     Assert.Throws <ArgumentException>(
         delegate
     {
         CommandArguments.Parse("Input.cs", string.Empty);
     });
 }
示例#12
0
 public void ParseInputConfigurationInvalidTest()
 {
     Assert.Throws <ArgumentException>(
         delegate
     {
         CommandArguments.Parse("Input.cs", "/confguration");
     });
 }
示例#13
0
 public void RunNullLoggerTest()
 {
     Assert.Throws <ArgumentNullException>(
         delegate
     {
         Program.Run(null, CommandArguments.Parse("Input.cs"));
     });
 }
示例#14
0
 public void ParseInputConfigurationFileEmptyTest()
 {
     Assert.Throws <ArgumentException>(
         delegate
     {
         CommandArguments.Parse("Input.cs", "/c:");
     });
 }
示例#15
0
        public void ParseInputTest()
        {
            CommandArguments commandArgs = CommandArguments.Parse("Input.cs");

            Assert.IsNull(commandArgs.Configuration, "Unexpected value for Configuration");
            Assert.AreEqual("Input.cs", commandArgs.Input, "Unexpected value for Input");
            Assert.IsNull(commandArgs.Output, "Unexpected value for Output");
            Assert.IsFalse(commandArgs.Backup, "Unexpected value for Backup");
            Assert.IsFalse(commandArgs.Restore, "Unexpected value for Restore");
            Assert.IsFalse(commandArgs.Trace, "Unexpected value for Trace");
        }
示例#16
0
        public void ParseMultipleTest()
        {
            CommandArguments commandArgs = CommandArguments.Parse(
                "Input.cs", "/b", "/CONFIGURATION:c:\\temp\\MyConfig.xml", "/t");

            Assert.AreEqual(
                "c:\\temp\\MyConfig.xml",
                commandArgs.Configuration,
                "Unexpected value for Configuration");
            Assert.AreEqual("Input.cs", commandArgs.Input, "Unexpected value for Input");
            Assert.IsNull(commandArgs.Output, "Unexpected value for Output");
            Assert.IsTrue(commandArgs.Backup, "Unexpected value for Backup");
            Assert.IsFalse(commandArgs.Restore, "Unexpected value for Restore");
            Assert.IsTrue(commandArgs.Trace, "Unexpected value for Trace");
        }
示例#17
0
 public void ParseInputOutputRestoreTest()
 {
     CommandArguments.Parse("Input.cs", "Output.cs", "/r");
 }
示例#18
0
 public void ParseInputBackupRestoreTest()
 {
     CommandArguments.Parse("Input.cs", "/b", "/r");
 }
示例#19
0
 public void ParseInputBackupInvalidTest()
 {
     CommandArguments.Parse("Input.cs", "/bakup");
 }
示例#20
0
 public void ParseUnknownFlagTest()
 {
     CommandArguments.Parse("Input.cs", "/z");
 }
示例#21
0
 public void ParseNullArrayTest()
 {
     CommandArguments.Parse(null);
 }
示例#22
0
 public void ParseNullArgTest()
 {
     CommandArguments.Parse("Input.cs", null);
 }
示例#23
0
 public void ParseEmptyArrayTest()
 {
     CommandArguments.Parse(new string[] {});
 }
示例#24
0
 public void ParseInputTraceInvalidTest()
 {
     CommandArguments.Parse("Input.cs", "/trce");
 }
示例#25
0
 public void RunNullLoggerTest()
 {
     Program.Run(null, CommandArguments.Parse("Input.cs"));
 }
示例#26
0
 public void ParseInputConfigurationEmptyFlagTest()
 {
     CommandArguments.Parse("Input.cs", "/");
 }
示例#27
0
 public void ParseInputConfigurationFileEmptyTest()
 {
     CommandArguments.Parse("Input.cs", "/c:");
 }
示例#28
0
 public void ParseEmptyArgTest()
 {
     CommandArguments.Parse("Input.cs", string.Empty);
 }
示例#29
0
        /// <summary>
        /// Arranges using the specified args and logger.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="args">The command args.</param>
        /// <returns>True if succesful, otherwise false.</returns>
        private bool Arrange(TestLogger logger, params string[] args)
        {
            CommandArguments commandArgs = CommandArguments.Parse(args);

            return(Program.Run(logger, commandArgs));
        }
示例#30
0
 public void ParseInputRestoreInvalidTest()
 {
     CommandArguments.Parse("Input.cs", "/resore");
 }