When testing a console application and run the method Console.Clear(); NUnit's console generates the exception System.IO.Exception. This work at MonoDevelop Test Console and don't work at NUnit Console and Resharper Console.
Code Example:
using System;
using System.IO;
using NUnit.Framework;
namespace NUnitConsoleBug
{
[TestFixture]
public class NUnitConsole
{
[Test]
public void TestConsoleWriteLine()
{
//This work!
var sw = new StringWriter(); Console.SetOut(sw); Console.WriteLine("Test WriteLine{0}", Environment.NewLine); Assert.IsTrue(sw.ToString().Contains(string.Format("Test WriteLine{0}", Environment.NewLine))); sw.Dispose();
}
[Test]
public void TestConsoleClear()
{
//This dont work!
var sw = new StringWriter(); Console.SetOut(sw); Assert.DoesNotThrow(Console.Clear); sw.Dispose();
}
}
}
When testing a console application and run the method Console.Clear(); NUnit's console generates the exception System. IO.Exception. This work at MonoDevelop Test Console and don't work at NUnit Console and Resharper Console.
Code Example:
using System;
using System.IO;
using NUnit.Framework;
namespace NUnitConsoleBug eLine()
Console. SetOut( sw);
Console. WriteLine( "Test WriteLine{0}", Environment. NewLine) ;
Assert. IsTrue( sw.ToString( ).Contains( string. Format( "Test WriteLine{0}", Environment. NewLine) ));
sw. Dispose( );
{
[TestFixture]
public class NUnitConsole
{
[Test]
public void TestConsoleWrit
{
//This work!
var sw = new StringWriter();
}
[Test]
Console. SetOut( sw);
Assert. DoesNotThrow( Console. Clear);
sw. Dispose( );
public void TestConsoleClear()
{
//This dont work!
var sw = new StringWriter();
}
}
}