This repository was archived by the owner on Jul 18, 2024. It is now read-only.
forked from JetBrains/teamcity-csharp-interactive
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTestResult.cs
99 lines (80 loc) · 2.62 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
// ReSharper disable ClassNeverInstantiated.Global
// ReSharper disable NotAccessedPositionalProperty.Global
// ReSharper disable ReturnTypeCanBeEnumerable.Local
namespace HostApi;
using System.Diagnostics;
using System.Text;
[Target]
[DebuggerTypeProxy(typeof(TestResultDebugView))]
public readonly record struct TestResult(
TestState State,
string Name,
string FlowId,
string SuiteName,
string FullyQualifiedName,
string DisplayName,
string ResultDisplayName,
string Message,
string Details,
TimeSpan Duration,
IReadOnlyList<Output> Output,
string Source,
string CodeFilePath,
Guid Id,
Uri? ExecutorUri,
int? LineNumber)
{
public TestResult(TestState state, string name)
: this(
state,
name,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
TimeSpan.Zero,
Array.Empty<Output>(),
string.Empty,
string.Empty,
Guid.Empty,
default,
default)
{ }
public override string ToString()
{
var sb = new StringBuilder();
if (!string.IsNullOrWhiteSpace(SuiteName))
{
sb.Append(SuiteName);
sb.Append(": ");
}
sb.Append(DisplayName);
sb.Append(" is ");
sb.Append(State.ToString().ToLowerInvariant());
sb.Append('.');
return sb.ToString();
}
[SuppressMessage("ReSharper", "UnusedMember.Local")]
private class TestResultDebugView(TestResult testResult)
{
public TestState State => testResult.State;
public string Name => testResult.Name;
public string SuiteName => testResult.SuiteName;
public string FullyQualifiedName => testResult.FullyQualifiedName;
public string DisplayName => testResult.DisplayName;
public string ResultDisplayName => testResult.ResultDisplayName;
public string Message => testResult.Message;
public string Details => testResult.Details;
public TimeSpan Duration => testResult.Duration;
[DebuggerBrowsable(DebuggerBrowsableState.Collapsed)]
public IReadOnlyList<Output> Output => testResult.Output;
public string Source => testResult.Source;
public string CodeFilePath => testResult.CodeFilePath;
public Guid Id => testResult.Id;
public Uri? ExecutorUri => testResult.ExecutorUri;
public int? LineNumber => testResult.LineNumber;
}
}