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"); } }
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"); } }
public void ParseInputBackupRestoreTest() { Assert.Throws <ArgumentException>( delegate { CommandArguments.Parse("Input.cs", "/b", "/r"); }); }
public void ParseInputBackupInvalidTest() { Assert.Throws <ArgumentException>( delegate { CommandArguments.Parse("Input.cs", "/bakup"); }); }
public void ParseUnknownFlagTest() { Assert.Throws <ArgumentException>( delegate { CommandArguments.Parse("Input.cs", "/z"); }); }
public void ParseNullArrayTest() { Assert.Throws <ArgumentException>( delegate { CommandArguments.Parse(null); }); }
public void ParseNullArgTest() { Assert.Throws <ArgumentException>( delegate { CommandArguments.Parse("Input.cs", null); }); }
public void ParseEmptyArrayTest() { Assert.Throws <ArgumentException>( delegate { CommandArguments.Parse(new string[] { }); }); }
public void ParseInputTraceInvalidTest() { Assert.Throws <ArgumentException>( delegate { CommandArguments.Parse("Input.cs", "/trce"); }); }
public void ParseInputOutputExtraneousTest() { Assert.Throws <ArgumentException>( delegate { CommandArguments.Parse("Input.cs", "Output.cs", "Extraneous.cs"); }); }
public void ParseEmptyArgTest() { Assert.Throws <ArgumentException>( delegate { CommandArguments.Parse("Input.cs", string.Empty); }); }
public void ParseInputConfigurationInvalidTest() { Assert.Throws <ArgumentException>( delegate { CommandArguments.Parse("Input.cs", "/confguration"); }); }
public void RunNullLoggerTest() { Assert.Throws <ArgumentNullException>( delegate { Program.Run(null, CommandArguments.Parse("Input.cs")); }); }
public void ParseInputConfigurationFileEmptyTest() { Assert.Throws <ArgumentException>( delegate { CommandArguments.Parse("Input.cs", "/c:"); }); }
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"); }
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"); }
public void ParseInputOutputRestoreTest() { CommandArguments.Parse("Input.cs", "Output.cs", "/r"); }
public void ParseInputBackupRestoreTest() { CommandArguments.Parse("Input.cs", "/b", "/r"); }
public void ParseInputBackupInvalidTest() { CommandArguments.Parse("Input.cs", "/bakup"); }
public void ParseUnknownFlagTest() { CommandArguments.Parse("Input.cs", "/z"); }
public void ParseNullArrayTest() { CommandArguments.Parse(null); }
public void ParseNullArgTest() { CommandArguments.Parse("Input.cs", null); }
public void ParseEmptyArrayTest() { CommandArguments.Parse(new string[] {}); }
public void ParseInputTraceInvalidTest() { CommandArguments.Parse("Input.cs", "/trce"); }
public void RunNullLoggerTest() { Program.Run(null, CommandArguments.Parse("Input.cs")); }
public void ParseInputConfigurationEmptyFlagTest() { CommandArguments.Parse("Input.cs", "/"); }
public void ParseInputConfigurationFileEmptyTest() { CommandArguments.Parse("Input.cs", "/c:"); }
public void ParseEmptyArgTest() { CommandArguments.Parse("Input.cs", string.Empty); }
/// <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)); }
public void ParseInputRestoreInvalidTest() { CommandArguments.Parse("Input.cs", "/resore"); }