public void ProcessTestResults(Array results) { _testResults = new List<TestResult>(); foreach (PSObject result in results) { var describe = result.Properties["Describe"].Value as string; if (!HandleParseError(result, describe)) { break; } var context = result.Properties["Context"].Value as string; var name = result.Properties["Name"].Value as string; if (string.IsNullOrEmpty(context)) context = "No Context"; // Skip test cases we aren't trying to run var testCase = TestCases.FirstOrDefault(m => m.FullyQualifiedName == string.Format("{0}.{1}.{2}", describe, context, name)); if (testCase == null) continue; var testResult = new TestResult(testCase); testResult.Outcome = GetOutcome(result.Properties["Result"].Value as string); var stackTraceString = result.Properties["StackTrace"].Value as string; var errorString = result.Properties["FailureMessage"].Value as string; testResult.ErrorStackTrace = stackTraceString; testResult.ErrorMessage = errorString; _testResults.Add(testResult); } }
public void ProcessTestResults(Array results) { TestResults = new List <TestResult>(); foreach (object obj in results) { SMA.PSObject psobject = (SMA.PSObject)obj; string describe = psobject.Properties["Describe"].Value as string; if (!HandleParseError(psobject, describe)) { break; } string context = psobject.Properties["Context"].Value as string; string name = psobject.Properties["Name"].Value as string; if (string.IsNullOrEmpty(context)) { context = "No Context"; } TestCase testCase = TestCases.FirstOrDefault(m => m.FullyQualifiedName == $"{describe}.{context}.{name}"); if (testCase != null) { TestResult testResult = new TestResult(testCase); testResult.Outcome = GetOutcome(psobject.Properties["Result"].Value as string); string errorStackTrace = psobject.Properties["StackTrace"].Value as string; string errorMessage = psobject.Properties["FailureMessage"].Value as string; testResult.ErrorStackTrace = errorStackTrace; testResult.ErrorMessage = errorMessage; TestResults.Add(testResult); } } }