Esempio n. 1
0
        static public void CaptureToTest(ITestOutputHelper output, Action handler)
        {
            var oldOut = Console.Out;
            var oldErr = Console.Error;
            var writer = new TestOutputWrite(output);

            Console.SetOut(writer);
            Console.SetError(writer);
            try
            {
                handler();
            }
            finally
            {
                Console.SetError(oldErr);
                Console.SetOut(oldOut);
            }
        }
Esempio n. 2
0
 static public void CaptureToTest(this ITestOutputHelper output, Action handler)
 {
     TestOutputWrite.CaptureToTest(output, handler);
 }