title: How to give user input to custom powershell cmdlets from another project
body: <p>I have a separate test project to test my cmdlets project that has calls like :</p>
  
  <pre><code>pSCmdletObject.InvokeCommand.InvokeScript("Write-Host " + outputString); and
  pSCmdletObject.InvokeCommand.InvokeScript("Read-Host");
  </code></pre>
  
  <p>I have used the PSHostUserInterface, PSRawUserInterface, PSHost implementation examples given in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0\Samples\sysmgmt\WindowsPowerShell\csharp\Host03</p>
  
  <p>Here is the problem :</p>
  
  <p>TestClass.cs   (of the Test project) :</p>
  
  <pre><code>using (Runspace runSpace = RunspaceFactory.CreateRunspace(new Host(new TestClass())))
  {
      runSpace.Open();
  
      using (Pipeline pipeline = runSpace.CreatePipeline())
      {
          pipeline.Commands.Add("CustomCommand-Get");
          var output = pipeline.Invoke();   //&lt;&lt;&lt; (1)
      }
  }
  </code></pre>
  
  <p>At "(1)" when "Invoke" is called, the "CustomCommand" implementation written in the actual project is called. In the "CustomCommand"'s "ProcessRecord()" of the actual cmdlets project, when "Read-Host" is called, the project just waits for input which I currently can't provide because I am unable to find a way to that. My test project has the Invoke call and I want to avoid using the console. I want to somehow hard-code the inputs according to the test cases as the actual Custom Cmdlet project is an entirely different project that can run independently on its own. Can this be done? If so, how? Any other way to achieve this?</p>
  
  <p>Thanks in advance</p>