Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display a console window in C# Unit Test?

I want to be able to display a console window at will in my C# unit tests that I can later address in my code to print statements to. is there a system command to support for this? My intention is debug purposes but I don't want to use log4net or some other text/xml file for accomplishing that.

like image 964
fifamaniac04 Avatar asked Dec 12 '12 20:12

fifamaniac04


People also ask

What does console C mean?

In computer technology, a console can mean different things depending on the context. It usually means a combination of a display monitor and an input device, usually a keyboard and mouse pair, which allows a user to input commands and receive visual output from a computer or computer system.

What is getconsolewindow?

Retrieves the window handle used by the console associated with the calling process.


1 Answers

Just use Console.WriteLine. Every unit test runner that I've used has captured console output automatically - you don't need an actual console window for that.

like image 169
Jon Skeet Avatar answered Sep 19 '22 16:09

Jon Skeet