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
A different variant of the cause/solution:
My issue was that I was not getting an output because I was writing the result set from an asynchronous LINQ call to the console in a loop in an asynchronous context:
var p = _context.Payment.Where(pp => pp.applicationNumber.Trim() == "12345");
p.ForEachAsync(payment => Console.WriteLine(payment.Amount));
And so the test was not writing to the console before the console object was cleaned up by the runtime (when running only one test).
The solution was to convert the result set to a list first, so I could use the non-asynchronous version of forEach():
var p = _context.Payment.Where(pp => pp.applicationNumber.Trim() == "12345").ToList();
p.ForEachAsync(payment =>Console.WriteLine(payment.Amount));