Can I write into the console in a unit test? If yes, why doesn't the console window open?

前端 未结 12 1097
长情又很酷
长情又很酷 2020-12-04 13:32

I have a test project in Visual Studio. I use Microsoft.VisualStudio.TestTools.UnitTesting.

I add this line in one of my unit tests:

Console.W         


        
12条回答
  •  没有蜡笔的小新
    2020-12-04 14:29

    Someone commented about this apparently new functionality in Visual Studio 2013. I wasn't sure what he meant at first, but now that I do, I think it deserves its own answer.

    We can use Console.WriteLine normally and the output is displayed, just not in the Output window, but in a new window after we click "Output" in the test details.

提交回复
热议问题