<PackageReference Include="NUnit" Version="4.5.1" />

NUnit.Framework.Internal.Execution.TextCapture

public class TextCapture : TextWriter
The TextCapture class intercepts console output and writes it to the current execution context, unless it corresponds with an ad-hoc test context. In an ad-hoc context, the output is written to a default destination, normally the original destination of the intercepted output.
namespace NUnit.Framework.Internal.Execution { public class TextCapture : TextWriter { public TextCapture(TextWriter defaultWriter); } }