Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            string scriptName = "testrun.ps1";

            string scriptFullFilename = Path.Combine(Environment.CurrentDirectory, "..\\..\\", scriptName);

            scriptFullFilename = Path.GetFullPath(scriptFullFilename);
            if (File.Exists(scriptFullFilename))
            {
                TestRunspace testRunspace = new TestRunspace(scriptFullFilename);
                testRunspace.Execute();

                TestPowershell testPowershell = new TestPowershell(scriptFullFilename);
                testPowershell.AddParameter("From the powershell object");
                testPowershell.Execute();

                testPowershell = new TestPowershell(scriptFullFilename);
                testPowershell.AddParameter("From the asynchronous powershell object");
                testPowershell.ExecuteAsynchronously();
            }
            else
            {
                Console.WriteLine("Script file \"{0}\" does not exist", scriptFullFilename);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string scriptName = "testrun.ps1";

            string scriptFullFilename = Path.Combine(Environment.CurrentDirectory, "..\\..\\", scriptName);

            scriptFullFilename = Path.GetFullPath(scriptFullFilename);
            if (File.Exists(scriptFullFilename))
            {
                TestRunspace testRunspace = new TestRunspace(scriptFullFilename);
                testRunspace.Execute();
            }
            else
            {
                Console.WriteLine("Script file \"{0}\" does not exist", scriptFullFilename);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a new pipeline with the given command.
 /// </summary>
 /// <param name="command">The command to invoke.</param>
 /// <returns>A new <see cref="Pipeline"/> that must be disposed.</returns>
 protected static Pipeline CreatePipeline(string command)
 {
     return(TestRunspace.CreatePipeline(command));
 }