Skip to content

Instantly share code, notes, and snippets.

@seesharper
Created March 4, 2016 13:35
Show Gist options
  • Select an option

  • Save seesharper/00523e2c9ba45d5fb77f to your computer and use it in GitHub Desktop.

Select an option

Save seesharper/00523e2c9ba45d5fb77f to your computer and use it in GitHub Desktop.
Capture Xunit20 output
public static class TestOutputHelper
{
private static readonly AsyncLocal<ITestOutputHelper> CurrentTestOutputHelper
= new AsyncLocal<ITestOutputHelper>();
public static void Capture(this ITestOutputHelper outputHelper)
{
CurrentTestOutputHelper.Value = outputHelper;
}
public static ITestOutputHelper Current => CurrentTestOutputHelper.Value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment