2010-06-03 Jb Evain <jbevain@novell.com>
[mcs.git] / nunit24 / NUnitCore / interfaces / TestSuiteResult.cs
blobaf2c69a8f673952102567bd431e733bfa93a4098
1 // ****************************************************************
2 // This is free software licensed under the NUnit license. You
3 // may obtain a copy of the license as well as information regarding
4 // copyright ownership at http://nunit.org/?p=license&r=2.4.
5 // ****************************************************************
7 namespace NUnit.Core
9 using System;
10 using System.Collections;
12 /// <summary>
13 /// TestSuiteResult represents the result of running a
14 /// TestSuite. It adds a set of child results to the
15 /// base TestResult class.
16 /// </summary>
17 ///
18 [Serializable]
19 public class TestSuiteResult : TestResult
21 private ArrayList results = new ArrayList();
23 /// <summary>
24 /// Construct a TestSuiteResult from a test and a name
25 /// </summary>
26 /// <param name="test"></param>
27 /// <param name="name"></param>
28 public TestSuiteResult(TestInfo test, string name)
29 : base(test, name) { }
31 /// <summary>
32 /// Construct a TestSuite result from a string
33 ///
34 /// This overload is used for testing
35 /// </summary>
36 /// <param name="testSuiteString"></param>
37 public TestSuiteResult(string testSuiteString)
38 : base(null, testSuiteString) { }
40 /// <summary>
41 /// Add a child result to a TestSuiteResult
42 /// </summary>
43 /// <param name="result">The child result to be added</param>
44 public void AddResult(TestResult result)
46 results.Add(result);
48 if( this.ResultState == ResultState.Success &&
49 result.ResultState != ResultState.Success )
51 this.Failure( "Child test failed", null, FailureSite.Child );
55 /// <summary>
56 /// Gets a list of the child results of this TestSUiteResult
57 /// </summary>
58 public IList Results
60 get { return results; }
63 /// <summary>
64 /// Accepts a ResultVisitor
65 /// </summary>
66 /// <param name="visitor">The visitor</param>
67 public override void Accept(ResultVisitor visitor)
69 visitor.Visit(this);