/// <summary>
        /// Führt ein PS Skript aus und liefert die dabei aufgetretenen Fehler und
        /// in die Pipeline geschriebene Objekte.
        /// </summary>
        protected ExecutionResult RunScript(string script,
                                            Func <string, string> promptForValueFunc   = null,
                                            Dictionary <string, object> variables      = null,
                                            PromptForPasswordHandler promptForPassword = null)
        {
            HostCommunicationAdapter communicationAdapter = new HostCommunicationAdapter()
            {
                OnPromptForValue    = promptForValueFunc,
                OnPromptForPassword = promptForPassword
            };

            var executer = new ScriptExecuter
            {
                CommunicationAdapter = communicationAdapter,
                Variables            = variables
            };

            if (_assemblyToTest != null)
            {
                executer.Assemblies = new List <Assembly>(new[] { _assemblyToTest });
            }



            return(executer.Execute(script));
        }
Esempio n. 2
0
 public TestEnvironmentHost(HostCommunicationAdapter communicationAdapter, Action <string> hostOutput)
 {
     _testEnvironmentUserInterface = new TestEnvironmentUserInterface(communicationAdapter, hostOutput);
 }
 internal TestEnvironmentUserInterface(HostCommunicationAdapter communicationAdapter, Action <string> hostOutput)
 {
     _communicationAdapter = communicationAdapter ?? throw new ArgumentNullException(nameof(communicationAdapter));
     _hostOutput           = hostOutput;
 }