public void ComposeScriptPath_WithoutTokens_ConcatenatesParamsAndFiles() { var tokenReplacer = new TokenReplacer(); tokenReplacer.AddStringToken("foo", "bar"); var result = ScriptAction.ComposeScriptParameters("--myparam", new[] { @"C:\file1.pdf" }, tokenReplacer); Assert.AreEqual("--myparam \"C:\\file1.pdf\"", result); }
public void ComposeScriptPath_WithTokensInParams_ReplacesTokens() { var tokenReplacer = new TokenReplacer(); tokenReplacer.AddStringToken("foo", "bar"); var result = ScriptAction.ComposeScriptParameters("--myparam <foo>", new[] { @"C:\file1.pdf" }, tokenReplacer); Assert.AreEqual("--myparam bar \"C:\\file1.pdf\"", result); }
private string ComposeSampleCommand(string scriptPath, string additionalParams) { if ((string.IsNullOrEmpty(scriptPath)) || (scriptPath.Trim().Length == 0)) { return(""); } //TokenReplacer tokenReplacer = TokenHelper.TokenReplacerWithPlaceHolders; string scriptCall = Path.GetFileName(ScriptAction.ComposeScriptPath(scriptPath, _tokenReplacer)); if (!string.IsNullOrEmpty(additionalParams)) { scriptCall += " " + ScriptAction.ComposeScriptParameters(additionalParams, new[] { @"C:\File1.pdf", @"C:\File2.pdf" }, _tokenReplacer); } else { scriptCall += @" C:\File1.pdf C:\File2.pdf"; } return(scriptCall); }