public void AddWithPrefixedValueAdds() { var args = new PrivateArguments(); args.Add("pre=", "test Value"); Assert.AreEqual(1, args.Count); Assert.AreEqual("pre=test Value", args.ToString()); }
public void AddQuoteWithValueAdds() { var args = new PrivateArguments(); args.AddQuote("testValue"); Assert.AreEqual(1, args.Count); Assert.AreEqual("\"testValue\"", args.ToString()); }
public void AddIfWithValueDoesNotAddOnFalse() { var args = new PrivateArguments(); args.AddIf(false, "testValue"); Assert.AreEqual(0, args.Count); Assert.AreEqual(string.Empty, args.ToString()); }
public void AddIfWithValueAddsOnTrue() { var args = new PrivateArguments(); args.AddIf(true, "testValue"); Assert.AreEqual(1, args.Count); Assert.AreEqual("testValue", args.ToString()); }
public void AddIfWithAutoQuoteValueAddsOnTrue() { var args = new PrivateArguments(); args.AddIf(true, "pre=", "test Value", true); Assert.AreEqual(1, args.Count); Assert.AreEqual("pre=\"test Value\"", args.ToString()); }
public ProcessInfo(string filename, PrivateArguments arguments, string workingDirectory, ProcessPriorityClass priority, int[] successExitCodes) { this.arguments = arguments; this.Priority = priority; startInfo.FileName = StringUtil.StripQuotes(filename); startInfo.Arguments = arguments == null ? null : arguments.ToString(SecureDataMode.Private); startInfo.WorkingDirectory = StringUtil.StripQuotes(workingDirectory); startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; startInfo.RedirectStandardInput = false; RepathExecutableIfItIsInWorkingDirectory(); this.successExitCodes = successExitCodes ?? new int[] { 0 }; }
/// <summary> /// Initializes a new instance of the <see cref="ProcessInfo" /> class. /// </summary> /// <param name="filename">The filename.</param> /// <param name="arguments">The arguments.</param> /// <param name="workingDirectory">The working directory.</param> /// <param name="priority">The priority.</param> /// <param name="successExitCodes">The success exit codes.</param> /// <remarks></remarks> public ProcessInfo(string filename, PrivateArguments arguments, string workingDirectory, ProcessPriorityClass priority, int[] successExitCodes) { this.arguments = arguments; this.Priority = priority; startInfo.FileName = StringUtil.StripQuotes(filename); startInfo.Arguments = arguments == null ? null : arguments.ToString(SecureDataMode.Private); startInfo.WorkingDirectory = StringUtil.StripQuotes(workingDirectory); startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; startInfo.RedirectStandardInput = false; RepathExecutableIfItIsInWorkingDirectory(); this.successExitCodes = successExitCodes ?? new int[] { 0 }; }
public void ToStringPrivateGeneratesPublicString() { PrivateString hidden = "private"; var args = new PrivateArguments("public", hidden); Assert.AreEqual("public private", args.ToString(SecureDataMode.Private)); }
public void ToStringGeneratesPublicString() { PrivateString hidden = "private"; var args = new PrivateArguments("public", hidden); Assert.AreEqual("public " + hidden.PublicValue, args.ToString()); }
public void ConstructorWithTwoArgumentsInitialises() { var args = new PrivateArguments("first", "second"); Assert.AreEqual(2, args.Count); Assert.AreEqual("first second", args.ToString()); }
public void ConstructorWithOneArgumentInitialises() { var args = new PrivateArguments("test"); Assert.AreEqual(1, args.Count); Assert.AreEqual("test", args.ToString()); }