~a-schlapsi/nunit-3.0/linux-makefile

« back to all changes in this revision

Viewing changes to src/framework/Internal/EventListenerTextWriter.cs

  • Committer: Andreas Schlapsi
  • Date: 2010-01-23 23:14:05 UTC
  • mfrom: (18.1.137 work)
  • Revision ID: a.schlapsi@gmx.at-20100123231405-17deqoh18nfnbq1j
Merged with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
// ***********************************************************************
23
23
 
24
 
namespace NUnit.Core
 
24
using NUnit.Framework.Api;
 
25
 
 
26
namespace NUnit.Framework.Internal
25
27
{
26
28
        using System;
27
29
        using System.IO;
28
30
        using System.Text;
29
31
 
 
32
    /// <summary>
 
33
    /// EventListenerTextWriter is a TextWriter that channels output to
 
34
    /// the TestOutput method of an ITestListener.
 
35
    /// </summary>
30
36
        public class EventListenerTextWriter : TextWriter
31
37
        {
32
38
                private ITestListener eventListener;
33
39
                private TestOutputType type;
34
40
 
 
41
        /// <summary>
 
42
        /// Initializes a new instance of the <see cref="EventListenerTextWriter"/> class.
 
43
        /// </summary>
 
44
        /// <param name="eventListener">The event listener.</param>
 
45
        /// <param name="type">The type.</param>
35
46
                public EventListenerTextWriter( ITestListener eventListener, TestOutputType type )
36
47
                {
37
48
                        this.eventListener = eventListener;
38
49
                        this.type = type;
39
50
                }
 
51
 
 
52
        /// <summary>
 
53
        /// Writes the specified char.
 
54
        /// </summary>
 
55
        /// <param name="aChar">A char.</param>
40
56
                override public void Write(char aChar)
41
57
                {
42
58
                        this.eventListener.TestOutput( new TestOutput( aChar.ToString(), this.type ) );
43
59
                }
44
60
 
 
61
        /// <summary>
 
62
        /// Writes the specified string.
 
63
        /// </summary>
 
64
        /// <param name="aString">A string.</param>
45
65
                override public void Write(string aString)
46
66
                {
47
67
                        this.eventListener.TestOutput( new TestOutput( aString, this.type ) );
48
68
                }
49
69
 
 
70
        /// <summary>
 
71
        /// Writes the specified string followed by a NewLine.
 
72
        /// </summary>
 
73
        /// <param name="aString">A string.</param>
50
74
                override public void WriteLine(string aString)
51
75
                {
52
76
                        this.eventListener.TestOutput( new TestOutput( aString + this.NewLine, this.type ) );
53
77
                }
54
78
 
 
79
        /// <summary>
 
80
        /// When overridden in a derived class, returns the <see cref="T:System.Text.Encoding"/> in which the output is written.
 
81
        /// </summary>
 
82
        /// <value></value>
 
83
        /// <returns>
 
84
        /// The Encoding in which the output is written.
 
85
        /// </returns>
55
86
                override public System.Text.Encoding Encoding
56
87
                {
57
88
                        get { return Encoding.Default; }
63
94
        /// </summary>
64
95
    //public class BufferedEventListenerTextWriter : TextWriter
65
96
    //{
66
 
    //    private ITestListener eventListener;
 
97
    //    private ITestListener listener;
67
98
    //    private TestOutputType type;
68
99
    //    private const int MAX_BUFFER = 1024;
69
100
    //    private StringBuilder sb = new StringBuilder( MAX_BUFFER );
70
101
 
71
 
    //    public BufferedEventListenerTextWriter( ITestListener eventListener, TestOutputType type )
 
102
    //    public BufferedEventListenerTextWriter( ITestListener listener, TestOutputType type )
72
103
    //    {
73
 
    //        this.eventListener = eventListener;
 
104
    //        this.listener = listener;
74
105
    //        this.type = type;
75
106
    //    }
76
107
 
117
148
    //            lock( sb )
118
149
    //            {
119
150
    //                TestOutput output = new TestOutput(sb.ToString(), this.type);
120
 
    //                this.eventListener.TestOutput( output );
 
151
    //                this.listener.TestOutput( output );
121
152
    //                sb.Length = 0;
122
153
    //            }
123
154
    //        }