-
Notifications
You must be signed in to change notification settings - Fork 3
/
TestResult.cs
115 lines (103 loc) · 2.88 KB
/
TestResult.cs
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
namespace Atc.XUnit;
/// <summary>
/// TestResult.
/// </summary>
public class TestResult
{
/// <summary>
/// Initializes a new instance of the <see cref="TestResult"/> class.
/// </summary>
/// <param name="text">The text.</param>
public TestResult(string text)
{
IsError = false;
IndentLevel = 0;
Text = text;
}
/// <summary>
/// Initializes a new instance of the <see cref="TestResult"/> class.
/// </summary>
/// <param name="indentLevel">The indent level.</param>
/// <param name="text">The text.</param>
public TestResult(int indentLevel, string text)
{
if (indentLevel < 0)
{
indentLevel = 1;
}
IsError = true;
IndentLevel = indentLevel;
Text = text;
}
/// <summary>
/// Initializes a new instance of the <see cref="TestResult"/> class.
/// </summary>
/// <param name="isError">if set to <c>true</c> [is error].</param>
/// <param name="indentLevel">The indent level.</param>
/// <param name="text">The text.</param>
public TestResult(bool isError, int indentLevel, string text)
{
if (indentLevel < 0)
{
indentLevel = 1;
}
IsError = isError;
IndentLevel = indentLevel;
Text = text;
}
/// <summary>
/// Initializes a new instance of the <see cref="TestResult"/> class.
/// </summary>
/// <param name="indentLevel">The indent level.</param>
/// <param name="text">The text.</param>
/// <param name="subLines">The sub lines.</param>
public TestResult(int indentLevel, string text, List<string> subLines)
{
if (indentLevel < 0)
{
indentLevel = 1;
}
IsError = true;
IndentLevel = indentLevel;
Text = text;
SubLines = subLines;
}
/// <summary>
/// Gets a value indicating whether this instance is error.
/// </summary>
/// <value>
/// <c>true</c> if this instance is error; otherwise, <c>false</c>.
/// </value>
public bool IsError { get; }
/// <summary>
/// Gets the indent level.
/// </summary>
/// <value>
/// The indent level.
/// </value>
public int IndentLevel { get; }
/// <summary>
/// Gets the text.
/// </summary>
/// <value>
/// The text.
/// </value>
public string Text { get; }
/// <summary>
/// Gets the sub lines.
/// </summary>
/// <value>
/// The sub lines.
/// </value>
public List<string>? SubLines { get; }
/// <summary>
/// Converts to string.
/// </summary>
/// <returns>
/// A string that represents this instance.
/// </returns>
public override string ToString()
{
return $"{nameof(IsError)}: {IsError}, {nameof(IndentLevel)}: {IndentLevel}, {nameof(Text)}: {Text}, {nameof(SubLines)}: {SubLines?.Count}";
}
}