25 lines
543 B
C#
25 lines
543 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Text;
|
|
using DotnetStreams;
|
|
|
|
namespace DotnetStreamsTests.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);
|
|
}
|
|
}
|
|
}
|