public void MakeParameters_InvalidValues_Test(string startPath, string action, string file) { string[] args = { startPath, action, file }; var result = CommandLineParameters.MakeParameters(args); Assert.IsNull(result); }
public void GetAction_ConvertFromString_Test(string action, Action result) { string[] args = { $"-s {_tempPath}", $"-a {action}" }; var options = CommandLineParameters.MakeParameters(args); Assert.IsNotNull(options); Assert.IsTrue(options.GetAction() == result); }
public void IsConsole_Fail_Test(string console) { string[] args = { $"-s {_tempPath}", $"-a {console}" }; var options = CommandLineParameters.MakeParameters(args); Assert.IsNotNull(options); Assert.IsFalse(options.IsConsole()); }
public void IsValid_Action_Fail_Test(string action) { string[] args = { $"-s {_tempPath}", $"-a {action}" }; var options = CommandLineParameters.MakeParameters(args); Assert.IsNotNull(options); Assert.IsFalse(options.IsValid()); }
public void MakeParameters_DefaultValues_Test(string startPath) { string[] args = { startPath }; var result = CommandLineParameters.MakeParameters(args); Assert.IsNotNull(result); Assert.AreEqual("all", result.ActionStr); Assert.AreEqual("results.txt", result.ResultFile); }
public void MakeParameters_ValidValues_Test(string startPath, string action, string file) { string[] args = { startPath, action, file }; var result = CommandLineParameters.MakeParameters(args); Assert.IsNotNull(result); StringAssert.EndsWith(startPath, result.StartDirectory); StringAssert.EndsWith(action, result.ActionStr); StringAssert.EndsWith(file, result.ResultFile); }
static bool Initialize(string[] args) { var result = false; var parameters = CommandLineParameters.MakeParameters(args); if (parameters?.IsValid() == true) { try { InitializeContainer(parameters); result = true; } catch (Exception ex) { PrintMessage($"Container initialization error: {ex.Message}", ConsoleColor.Red); } } else { PrintMessage("Invalid command line arguments", ConsoleColor.Red); } return(result); }