How can I write output from a unit test?

后端 未结 15 988
误落风尘
误落风尘 2020-11-28 20:56

Any call in my unit tests to either Debug.Write(line) or Console.Write(Line) simply gets skipped over while debugging and the output is never print

15条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 21:44

    Are you sure you're running your unit tests in Debug? Debug.WriteLine won't be called in Release builds.

    Two options to try are:

    • Trace.WriteLine(), which is built into release builds as well as debug

    • Undefine DEBUG in your build settings for the unit test

提交回复
热议问题