Catch console input-output
<p>I have a console application that reads input from console and writes output to console. I need to write another program that should run the first one, mock the console input for it and grab the output. Can you please provide a way of investigation for this problem?</p>

<p>The (very easy) example of console application code:</p>

<pre><code>string input = Console.ReadLine();
int value = int.Parse(input);
Console.WriteLine(value * value);
</code></pre>
