/// <summary> /// Draw the parsed error text at the end of the method causing the test failure /// </summary> private void DrawError(EditorPaintLanguageElementEventArgs ea, TestResult testResult) { if (testResult.Status == TestStatus.Failed) { FailureData failure = testResult.Failure; if (failure.FailingStatement != null) { int errorTextStartCol = failure.FailingStatement.EndOffset + 5; if (string.IsNullOrEmpty(failure.Expected)) {// not an equal comparison ea.PaintArgs.OverlayText("<------- Test failed here", failure.FailingStatement.StartLine, errorTextStartCol, FailedColor); } else if (failure.ActualDiffersAt < 0) { ea.PaintArgs.OverlayText(string.Format("Expected: {0} Actual: {1}", failure.Expected, failure.Actual), failure.FailingStatement.StartLine, errorTextStartCol, FailedColor); } else { int start = errorTextStartCol; string correctPortion = string.Format("Expected: {0} Actual: {1}", failure.Expected, failure.Actual.Substring(0, failure.ActualDiffersAt)); ea.PaintArgs.OverlayText(correctPortion, failure.FailingStatement.StartLine, start, FailedColor); ea.PaintArgs.OverlayText(failure.Actual.Substring(failure.ActualDiffersAt), failure.FailingStatement.StartLine, start + correctPortion.Length, Color.Red); } } } }
/// <summary> /// Initializes a new instance of the TestResult class. /// </summary> public TestResult() { Status = TestStatus.Unknown; Failure = new FailureData(); }