-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTestResultProvider.cs
77 lines (73 loc) · 2.5 KB
/
TestResultProvider.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace tfs_cli
{
class TestResultProvider : ITestResultProvider
{
private string _name;
private string _outcome;
private string _comment;
private string _attachment;
private string _failure_type;
private string _error_message;
private string _duration;
private IList<string> possibleOutcomes = new List<string>()
{
"Aborted",
"Blocked",
"Error",
"Failed",
"Inconclusive",
"None",
"NotApplicable",
"NotExecuted",
"Passed",
"Paused",
"Timeout",
"Unspecified",
"Warning"
};
private IList<string> possibleFailureTypes = new List<string>()
{
"KnowIssue",
"NewIssue",
"None",
"Regression",
"Unknown"
};
public TestResultProvider
(
string name,
string outcome,
string suite,
string comment,
string attach,
string failure_type,
string error_message,
string duration
)
{
_name = name;
_outcome = outcome;
_comment = comment;
_attachment = attach;
_failure_type = failure_type;
_error_message = error_message;
_duration = duration;
if (!possibleOutcomes.Contains(_outcome))
TfsCliHelper.ExitWithError(string.Format("Outcome \"{0}\" not known.\nKnow are: {1}", _outcome, possibleOutcomes.Aggregate((a, b) => a + ", " + b)));
if (!possibleFailureTypes.Contains(_failure_type))
TfsCliHelper.ExitWithError(string.Format("Failure type {0} not know.\nKnow are: {1}", _failure_type, possibleFailureTypes.Aggregate((a, b) => a + ", " + b)));
}
public string Title() { return _name; }
public string Outcome() { return _outcome; }
public string Comment() { return _comment; }
public string Attachment() { return _attachment; }
public string FailureType() { return _failure_type; }
public string ErrorMessage() { return _error_message; }
public string Duration() { return _duration; }
}
}