← Back to team overview

nunit-core team mailing list archive

[Bug 797150] [NEW] Console.Clear(); throw System.IO.Exception

 

Public bug reported:

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();
        }
    }
}

** Affects: nunitv2
     Importance: Undecided
         Status: New


** Tags: console console.clear

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/797150

Title:
  Console.Clear(); throw System.IO.Exception

Status in NUnit V2 Test Framework:
  New

Bug 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();
          }
      }
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/797150/+subscriptions


Follow ups

References