From 70715eb3a3350e3c9f7af5892340f4d398a4480a Mon Sep 17 00:00:00 2001 From: ekhatko Date: Tue, 18 Mar 2014 13:01:15 +0400 Subject: [PATCH] gitignore hiden TestResultProvider fixed --- .gitignore | 1 - TestResultProvider.cs | 77 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 TestResultProvider.cs diff --git a/.gitignore b/.gitignore index bdc3535..da55380 100644 --- a/.gitignore +++ b/.gitignore @@ -93,7 +93,6 @@ AppPackages/ [Oo]bj sql TestResults -[Tt]est[Rr]esult* *.Cache ClientBin [Ss]tyle[Cc]op.* diff --git a/TestResultProvider.cs b/TestResultProvider.cs new file mode 100644 index 0000000..c14b5ab --- /dev/null +++ b/TestResultProvider.cs @@ -0,0 +1,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 possibleOutcomes = new List() + { + "Aborted", + "Blocked", + "Error", + "Failed", + "Inconclusive", + "None", + "NotApplicable", + "NotExecuted", + "Passed", + "Paused", + "Timeout", + "Unspecified", + "Warning" + }; + + private IList possibleFailureTypes = new List() + { + "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; } + } +}