diff options
Diffstat (limited to 'mcs/nunit/src/NUnitCore/TestDecorator.cs')
-rw-r--r-- | mcs/nunit/src/NUnitCore/TestDecorator.cs | 125 |
1 files changed, 70 insertions, 55 deletions
diff --git a/mcs/nunit/src/NUnitCore/TestDecorator.cs b/mcs/nunit/src/NUnitCore/TestDecorator.cs index 02753912350..eded1c24ba5 100644 --- a/mcs/nunit/src/NUnitCore/TestDecorator.cs +++ b/mcs/nunit/src/NUnitCore/TestDecorator.cs @@ -1,56 +1,71 @@ -namespace NUnit.Extensions {
+namespace NUnit.Extensions
+{
+ using System;
+ using NUnit.Framework;
- using System;
-
- using NUnit.Framework;
-
- /// <summary>A Decorator for Tests.</summary>
- /// <remarks>Use TestDecorator as the base class
- /// for defining new test decorators. TestDecorator subclasses
- /// can be introduced to add behaviour before or after a test
- /// is run.</remarks>
- public class TestDecorator: Assertion, ITest {
- /// <summary>
- ///
- /// </summary>
- protected readonly ITest fTest;
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- public TestDecorator(ITest test) {
- fTest= test;
- }
-
- /// <summary>The basic run behaviour.</summary>
- public void BasicRun(TestResult result) {
- fTest.Run(result);
- }
- /// <summary>
- ///
- /// </summary>
- public virtual int CountTestCases {
- get { return fTest.CountTestCases; }
- }
- /// <summary>
- ///
- /// </summary>
- public ITest GetTest {
- get { return fTest; }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="result"></param>
- public virtual void Run(TestResult result) {
- BasicRun(result);
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public override string ToString() {
- return fTest.ToString();
- }
- }
-}
+ /// <summary>A Decorator for Tests.</summary>
+ /// <remarks>Use TestDecorator as the base class
+ /// for defining new test decorators. TestDecorator subclasses
+ /// can be introduced to add behaviour before or after a test
+ /// is run.</remarks>
+ public class TestDecorator: Assertion, ITest
+ {
+ /// <summary>
+ /// A reference to the test that is being decorated
+ /// </summary>
+ protected readonly ITest fTest;
+ /// <summary>
+ /// Creates a decorator for the supplied test
+ /// </summary>
+ /// <param name="test">The test to be decorated</param>
+ public TestDecorator(ITest test)
+ {
+ if(test!= null)
+ {
+ this.fTest= test;
+ }
+ else
+ throw new ArgumentNullException("test");
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="result"></param>
+ public virtual void Run(TestResult result)
+ {
+ this.BasicRun(result);
+ }
+ /// <summary>The basic run behaviour.</summary>
+ public void BasicRun(TestResult result)
+ {
+ this.fTest.Run(result);
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ public virtual int CountTestCases
+ {
+ get { return fTest.CountTestCases; }
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ public ITest GetTest
+ {
+ get { return fTest; }
+ }
+ //public string Name
+ //{
+ // get{return fTest.Name;}
+ //}
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ return fTest.ToString();
+ }
+ }
+}
\ No newline at end of file |