I am using .Net6 + Xunit + Fluent Assertions and am trying to format the exception display that is output to console when an exception is encountered. (what I really want to see is the Data
property on the Exception
)
In my program itself I add a handler to AppDomain.UnhandledException
, but in the tests, this does not change the output at all.
I've looked for an alternative way of setting a custom formatter for exceptions, but I haven't found a way, neither in Fluent Assertions nor Xunit.
Is there any way to format exception output in tests?