开发者

How to stop Msunit testing to stop console logging?

开发者 https://www.devze.com 2023-01-29 22:21 出处:网络
I am currently working with the MSunit framework with Visual Studio. But when I was running the tests, I think there is a huge console logging, due to which it is affecting the 开发者_开发问答performa

I am currently working with the MSunit framework with Visual Studio. But when I was running the tests, I think there is a huge console logging, due to which it is affecting the 开发者_开发问答performance and gives System Out of Memory Exception.

How can I turn off the console logging with the MS unit?


How can I turn off the console logging with the MS unit?

Hotfix:

Create a global static variable

 public static bool IsLoggingEnabled=false;

Put

 if (IsLoggingEnabled) ConsoleWriteXXX

in front of every Console.WriteXXX. By setting the variable you can enable or disable logging.

In the long run you should use Common.Logging or Log4Net to do your logging and to fine-tune the amount of logging you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号