Can ReSharper's test runner be configure not to show Debug.WriteLine() messages?
-
22-03-2021 - |
Question
I want to omit Debug.Write/WriteLine messages from ReSharper's test runner output. Is it doable?
Solution
while (Debug.Listeners.Count > 0) Debug.Listeners.RemoveAt(0);
or more targeted (for NUnit test framework):
var nunitListener = Debug.Listeners.Cast<TraceListener>().Where(tl => tl.Name == "NUnit").FirstOrDefault();
if (nunitListener != null) Debug.Listeners.Remove(nunitListener);
Notice that though ReSharper adds its own trace listener, it is NUnit's trace listener that Test Runner shows in the output. I do not know why, but removing "NUnit" trace listener does the trick.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow