This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / mcs / nunit20 / core / TestResult.cs
1 #region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
2 /************************************************************************************
3 '
4 ' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
5 ' Copyright © 2000-2003 Philip A. Craig
6 '
7 ' This software is provided 'as-is', without any express or implied warranty. In no 
8 ' event will the authors be held liable for any damages arising from the use of this 
9 ' software.
10
11 ' Permission is granted to anyone to use this software for any purpose, including 
12 ' commercial applications, and to alter it and redistribute it freely, subject to the 
13 ' following restrictions:
14 '
15 ' 1. The origin of this software must not be misrepresented; you must not claim that 
16 ' you wrote the original software. If you use this software in a product, an 
17 ' acknowledgment (see the following) in the product documentation is required.
18 '
19 ' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
20 ' or Copyright © 2000-2003 Philip A. Craig
21 '
22 ' 2. Altered source versions must be plainly marked as such, and must not be 
23 ' misrepresented as being the original software.
24 '
25 ' 3. This notice may not be removed or altered from any source distribution.
26 '
27 '***********************************************************************************/
28 #endregion
29
30 namespace NUnit.Core
31 {
32         using System;
33
34         /// <summary>
35         /// Summary description for TestResult.
36         /// </summary>
37         /// 
38         [Serializable]
39         public abstract class TestResult
40         {
41                 private bool executed;
42                 private bool isFailure; 
43                 private double time;
44                 private string name;
45                 private ITest test;
46                 private string stackTrace;
47                 private string description;
48                 protected string messageString;
49                 private int assertCount;
50
51                 protected TestResult(ITest test, string name)
52                 {
53                         this.name = name;
54                         this.test = test;
55                         if(test != null)
56                                 this.description = test.Description;
57                 }
58
59                 public bool Executed 
60                 {
61                         get { return executed; }
62                         set { executed = value; }
63                 }
64
65                 public virtual bool AllTestsExecuted
66                 {
67                         get { return executed; }
68                 }
69
70                 public virtual string Name
71                 {
72                         get{ return name;}
73                 }
74
75                 public ITest Test
76                 {
77                         get{ return test;}
78                 }
79
80                 public virtual bool IsSuccess
81                 {
82                         get { return !(isFailure); }
83                 }
84                 
85                 public virtual bool IsFailure
86                 {
87                         get { return isFailure; }
88                         set { isFailure = value; }
89                 }
90
91                 public virtual string Description
92                 {
93                         get { return description; }
94                         set { description = value; }
95                 }
96
97                 public double Time 
98                 {
99                         get{ return time; }
100                         set{ time = value; }
101                 }
102
103                 public string Message
104                 {
105                         get { return messageString; }
106                 }
107
108                 public virtual string StackTrace
109                 {
110                         get 
111                         { 
112                                 return stackTrace;
113                         }
114                         set 
115                         {
116                                 stackTrace = value;
117                         }
118                 }
119
120                 public int AssertCount
121                 {
122                         get { return assertCount; }
123                         set { assertCount = value; }
124                 }
125
126                 public abstract void NotRun(string message);
127
128                 public abstract void Accept(ResultVisitor visitor);
129         }
130 }