diff options
Diffstat (limited to 'mcs/nunit/src/NUnitCore/TestFailure.cs')
-rw-r--r-- | mcs/nunit/src/NUnitCore/TestFailure.cs | 87 |
1 files changed, 49 insertions, 38 deletions
diff --git a/mcs/nunit/src/NUnitCore/TestFailure.cs b/mcs/nunit/src/NUnitCore/TestFailure.cs index 7d768b494ba..4dad5bd02bd 100644 --- a/mcs/nunit/src/NUnitCore/TestFailure.cs +++ b/mcs/nunit/src/NUnitCore/TestFailure.cs @@ -1,44 +1,55 @@ -namespace NUnit.Framework {
-
- using System;
- using System.Diagnostics;
- using System.IO;
- using System.Text;
+namespace NUnit.Framework
+{
+ using System;
+ using System.Diagnostics;
+ using System.IO;
+ using System.Text;
- /// <summary>A <c>TestFailure</c> collects a failed test together with
- /// the caught exception.</summary>
- /// <seealso cref="TestResult"/>
- public class TestFailure {
- private readonly ITest failedTest;
- private readonly Exception thrownException;
+ /// <summary>
+ /// A <c>TestFailure</c> collects a failed test together with
+ /// the caught exception.
+ /// </summary>
+ /// <seealso cref="TestResult"/>
+ public class TestFailure : MarshalByRefObject
+ {
+ private readonly ITest fFailedTest;
+ private readonly Exception fThrownException;
- /// <summary>Constructs a TestFailure with the given test and
- /// exception.</summary>
- public TestFailure(ITest theFailedTest, Exception theThrownException) {
- failedTest= theFailedTest;
- thrownException= theThrownException;
- }
+ /// <summary>
+ /// Constructs a TestFailure with the given test and exception.
+ /// </summary>
+ public TestFailure(ITest theFailedTest, Exception theThrownException)
+ {
+ if(theFailedTest==null)
+ throw new ArgumentNullException("theFailedTest");
+ if(theThrownException==null)
+ throw new ArgumentNullException("theThrownException");
+ this.fFailedTest = theFailedTest;
+ this.fThrownException = theThrownException;
+ }
- /// <value>Gets the failed test.</value>
- public ITest FailedTest {
- get { return failedTest; }
- }
+ /// <value>Gets the failed test.</value>
+ public ITest FailedTest
+ {
+ get { return this.fFailedTest; }
+ }
- /// <value>True if it's a failure, false if error.</value>
- public bool IsFailure {
- get { return thrownException is AssertionFailedError; }
- }
+ /// <value>True if it's a failure, false if error.</value>
+ public bool IsFailure
+ {
+ get { return this.fThrownException is AssertionFailedError; }
+ }
- /// <value>Gets the thrown exception.</value>
- public Exception ThrownException {
- get { return thrownException; }
- }
+ /// <value>Gets the thrown exception.</value>
+ public Exception ThrownException
+ {
+ get { return this.fThrownException; }
+ }
- /// <summary>Returns a short description of the failure.</summary>
- public override string ToString() {
- StringBuilder buffer= new StringBuilder();
- buffer.Append(failedTest+": "+thrownException.Message);
- return buffer.ToString();
- }
- }
-}
+ /// <summary>Returns a short description of the failure.</summary>
+ public override string ToString()
+ {
+ return this.fFailedTest + ": " + this.fThrownException.Message;
+ }
+ }
+}
\ No newline at end of file |