How can I write output from a unit test?

后端 未结 15 969
误落风尘
误落风尘 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:39

    Try using:

    Console.WriteLine()

    The call to Debug.WriteLine will only be made during when DEBUG is defined.

    Other suggestions are to use: Trace.WriteLine as well, but I haven't tried this.

    There is also an option (not sure if Visual Studio 2008 has it), but you can still Use Debug.WriteLine when you run the test with Test With Debuggeroption in the IDE.

提交回复
热议问题