public void GlobalScope_PopReport_ClosesOutputStream() { var globalScope = new GlobalScope(); using (var textWriter = new StubTextWriter()) // Note that this textwriter neither StdOut nor StdErr { var report = new Report() { OutputStream = textWriter }; globalScope.ReportStack.Push(report); globalScope.ReportStack.Push(report); Assert.False(textWriter.IsClosed); globalScope.PopReport(); Assert.True(textWriter.IsClosed); } }