private static DTestResult FromXTestResult(XTestResult tr, Func <string, string> rebaseCFP) { return(new DTestResult { DisplayName = tr.DisplayName, ErrorMessage = tr.FailureInfo == FSharpOption <XTestFailureInfo> .None ? null : tr.FailureInfo.Value.Message.Item, ErrorStackTrace = tr.FailureInfo == FSharpOption <XTestFailureInfo> .None ? null : CallStackToString(tr.FailureInfo.Value.CallStack.Item), Outcome = FromXTestOutcome(tr.Outcome), TestCase = FromXTestCase(tr.TestCase) }); }
private static void NoteTestResults(PerTestIdDResults testResults, XTestResult tr, Func <string, string> rebaseCFP) { LogInfo("Noting Test Result: {0} - {1}", tr.DisplayName, tr.Outcome); var testId = new TestId( FilePath.NewFilePath(tr.TestCase.Source), new DocumentLocation( FilePath.NewFilePath(tr.TestCase.CodeFilePath), DocumentCoordinate.NewDocumentCoordinate(tr.TestCase.LineNumber))); var results = testResults.GetOrAdd(testId, _ => new ConcurrentBag <DTestResult>()); results.Add(FromXTestResult(tr, rebaseCFP)); }
private static void RebaseCallStackDocumentReferences(Func <string, string> rebaseCFP, XTestResult tr) { if (tr.FailureInfo == FSharpOption <XTestFailureInfo> .None) { return; } Func <XErrorStackFrame, XErrorStackFrame> rebaseFI = sf => { if (sf.IsXErrorParsedFrame) { var psf = (sf as XErrorStackFrame.XErrorParsedFrame); return(XErrorStackFrame.NewXErrorParsedFrame(psf.Item1, rebaseCFP(psf.Item2), psf.Item3)); } else { return(sf); } }; tr.FailureInfo.Value.CallStack = XErrorStackTrace.NewXErrorStackTrace(tr.FailureInfo.Value.CallStack?.Item.Select(rebaseFI).ToArray()); tr.FailureInfo = new FSharpOption <XTestFailureInfo>(tr.FailureInfo.Value); }
private static void NoteTestFailureInfo(PerDocumentLocationTestFailureInfo pdtfi, XTestResult tr) { LogInfo("Noting Test Failure Info: {0} - {1}", tr.DisplayName, tr.Outcome); TestFailureInfoExtensions.create(tr) .Aggregate( pdtfi, (acc, e) => { acc .GetOrAdd(e.Item1, _ => new ConcurrentBag <TestFailureInfo>()) .Add(e.Item2); return(acc); }); }