21 lines
469 B
C#
21 lines
469 B
C#
using System;
|
|
using System.IO;
|
|
using DotnetStandardStreams;
|
|
|
|
namespace DotnetStandardStreamsTests.Testables;
|
|
|
|
public class TestableConsoleOutputTarget : ConsoleOutputTarget, IDisposable
|
|
{
|
|
private readonly TextWriter _previousOutWriter;
|
|
public TestableConsoleOutputTarget(TextWriter outWriter) : base()
|
|
{
|
|
_previousOutWriter = System.Console.Out;
|
|
System.Console.SetOut(outWriter);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
System.Console.SetOut(_previousOutWriter);
|
|
}
|
|
}
|