C# – How to unit test code that reads and writes to the console

When you’re unit testing code that uses the console IO methods, you’ll need a way to automate the input and a way to capture the output. There are two ways to do this: Redirect the console IO. Wrap the console IO method calls and mock out the wrapper. In this article, I’ll show how to … Read more