blob: 7d768b494bac64c4997ba09fca61effb25ecb189 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
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>Constructs a TestFailure with the given test and
/// exception.</summary>
public TestFailure(ITest theFailedTest, Exception theThrownException) {
failedTest= theFailedTest;
thrownException= theThrownException;
}
/// <value>Gets the failed test.</value>
public ITest FailedTest {
get { return failedTest; }
}
/// <value>True if it's a failure, false if error.</value>
public bool IsFailure {
get { return thrownException is AssertionFailedError; }
}
/// <value>Gets the thrown exception.</value>
public Exception ThrownException {
get { return thrownException; }
}
/// <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();
}
}
}
|