Ejemplo n.º 1
0
        public void ComposeScriptPath_WithUnkownToken_ReturnsValidFilename()
        {
            var tokenReplacer = new TokenReplacer();

            var result = ScriptAction.ComposeScriptPath(@"C:\Test\<unknown>", tokenReplacer);

            Assert.AreEqual(@"C:\Test\_unknown_", result);
        }
Ejemplo n.º 2
0
        public void ComposeScriptPath_WithTokenReplacer_ReplacesTokens()
        {
            var tokenReplacer = new TokenReplacer();

            tokenReplacer.AddStringToken("foo", "bar");

            var result = ScriptAction.ComposeScriptPath(@"C:\Test\<foo>", tokenReplacer);

            Assert.AreEqual(@"C:\Test\bar", result);
        }
Ejemplo n.º 3
0
        public void ComposeScript_PathGetFullPathThrowsExpection_DoNotThrowExcpetion_PathRemains()
        {
            _path.GetFullPath(Arg.Any <string>()).Throws(new Exception());
            var path = "inputPATH";

            Assert.DoesNotThrow(() =>
            {
                path = _scriptAction.ComposeScriptPath(path, new TokenReplacer());
            });
            Assert.AreEqual("inputPATH", path, "Path did not remain");
        }
Ejemplo n.º 4
0
        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);
        }