2011-06-18 19:43:04 |
Juan José Montes de Oca Arbós |
description |
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 GUI Console, NUnit Console no GUI and don't work at NUnit GUI Console and Resharper GUI 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();
}
}
} |
|