How to stop Msunit testing to stop console logging?
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.
精彩评论