PageRenderTime 22ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/NUnit/interfaces/TestOutput.cs

#
C# | 92 lines | 40 code | 9 blank | 43 comment | 0 complexity | 01cc873f6938786b105d604a37bfaf25 MD5 | raw file
 1// ****************************************************************
 2// Copyright 2007, Charlie Poole
 3// This is free software licensed under the NUnit license. You may
 4// obtain a copy of the license at http://nunit.org
 5// ****************************************************************
 6namespace NUnit.Core
 7{
 8	using System;
 9
10    /// <summary>
11    /// The TestOutput class holds a unit of output from 
12    /// a test to either stdOut or stdErr
13    /// </summary>
14	[Serializable]
15	public class TestOutput
16	{
17		string text;
18		TestOutputType type;
19
20        /// <summary>
21        /// Construct with text and an ouput destination type
22        /// </summary>
23        /// <param name="text">Text to be output</param>
24        /// <param name="type">Destination of output</param>
25		public TestOutput(string text, TestOutputType type)
26		{
27			this.text = text;
28			this.type = type;
29		}
30
31        /// <summary>
32        /// Return string representation of the object for debugging
33        /// </summary>
34        /// <returns></returns>
35		public override string ToString()
36		{
37			return type + ": " + text;
38		}
39
40        /// <summary>
41        /// Get the text 
42        /// </summary>
43		public string Text
44		{
45			get
46			{
47				return this.text;
48			}
49		}
50
51        /// <summary>
52        /// Get the output type
53        /// </summary>
54		public TestOutputType Type
55		{
56			get
57			{
58				return this.type;
59			}
60		}
61	}
62
63    /// <summary>
64    /// Enum representing the output destination
65    /// It uses combinable flags so that a given
66    /// output control can accept multiple types
67    /// of output. Normally, each individual
68    /// output uses a single flag value.
69    /// </summary>
70	public enum TestOutputType
71	{
72        /// <summary>
73        /// Send output to stdOut
74        /// </summary>
75		Out, 
76        
77        /// <summary>
78        /// Send output to stdErr
79        /// </summary>
80        Error,
81
82		/// <summary>
83		/// Send output to Trace
84		/// </summary>
85		Trace,
86
87		/// <summary>
88		/// Send output to Log
89		/// </summary>
90		Log
91	}
92}