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

前端 未结 3 804
广开言路
广开言路 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:06

    The trace output from a ClassInitialize and ClassCleanup appears in the result summary.

    You can access it by doing the following

    1. Open the Test Results windw [ Test -> Windows -> Test Results ]
    2. There should be a link named "Test run completed" on the top left corner of the [Test Results] window.
    3. Click the clink
    4. It should open a window with the header "Result Summary" and it will show the debug trace created during ClassInitialize and ClassCleanup

提交回复
热议问题