How to write output in the [ClassInitialize()] of a Unit Test class?

前端 未结 3 797
广开言路
广开言路 2021-01-11 16:36

I am writing some unit tests for the persistence layer of my C#.NET application. Before and after the tests of a test class execute, I want to do some cleaning up to

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-11 17:11

    You can see the Console output on each test if you double-click the test method in the Test Results pane. It is also present in the .trx xml results file.

    In addition, if you specify the "Define DEBUG constant", you can use the System.Diagnostics.Debug.WriteLine("ClassInitialize Method invoked, yeah."); .. which will end up in the "Output" pane.

提交回复
热议问题