1 #region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
2 /************************************************************************************
4 ' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
5 ' Copyright © 2000-2003 Philip A. Craig
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
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:
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.
19 ' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
20 ' or Copyright © 2000-2003 Philip A. Craig
22 ' 2. Altered source versions must be plainly marked as such, and must not be
23 ' misrepresented as being the original software.
25 ' 3. This notice may not be removed or altered from any source distribution.
27 '***********************************************************************************/
35 /// Summary description for TestResult.
39 public abstract class TestResult
44 /// True if the test executed
46 private bool executed;
49 /// True if the test was marked as a failure
51 private bool isFailure;
54 /// True if the setup failed: This means SetUp for a test case,
55 /// or TestFixtureSetUp for a fixture.
57 private bool setupFailure;
60 /// The elapsed time for executing this test
65 /// The name of the test
70 /// The test that this result pertains to
75 /// The stacktrace at the point of failure
77 private string stackTrace;
80 /// Description of this test
82 private string description;
85 /// Message giving the reason for failure
87 protected string messageString;
90 /// Number of asserts executed by this test
92 private int assertCount;
96 #region Protected Constructor
98 protected TestResult(ITest test, string name)
103 this.description = test.Description;
112 get { return executed; }
113 set { executed = value; }
116 public virtual bool AllTestsExecuted
118 get { return executed; }
121 public virtual string Name
131 public virtual bool IsSuccess
133 get { return !(isFailure); }
136 public virtual bool IsFailure
138 get { return isFailure; }
139 set { isFailure = value; }
142 public bool SetupFailure
144 get { return setupFailure; }
145 set { setupFailure = value; }
148 public virtual string Description
150 get { return description; }
151 set { description = value; }
160 public string Message
162 get { return messageString; }
165 public virtual string StackTrace
177 public int AssertCount
179 get { return assertCount; }
180 set { assertCount = value; }
185 #region Public Methods
187 public void NotRun(string reason)
189 this.executed = false;
190 this.messageString = reason;
193 public void Failure(string message, string stackTrace )
195 Failure( message, stackTrace, false );
198 public void Failure(string message, string stackTrace, bool setupFailure)
200 this.executed = true;
201 this.isFailure = true;
202 this.messageString = message;
203 this.stackTrace = stackTrace;
204 this.setupFailure = setupFailure;
209 public abstract void Accept(ResultVisitor visitor);