private void PlugIn1_EditorPaintLanguageElement(EditorPaintLanguageElementEventArgs ea) {
            if (!_HighlightingEnabled)
                return;
            LanguageElement element = ea.LanguageElement;
            if (_LinesChanged.ContainsKey(element.StartLine))
                return;

            if (IsUndisposedLocal(element))
                ea.PaintArgs.OverlayText(element.Name, element.NameRange.Start, Color.Red);
        }
        private void ApprovalTestsPlugin_EditorPaintLanguageElement(EditorPaintLanguageElementEventArgs ea)
        {
            LanguageElement element = ea.LanguageElement;

            if (IsApproveCall(element) && element.ElementType == LanguageElementType.MethodCall)
            {
                var approvalFiles = new ApprovalArtifacts(element.GetMethod());
                Color lineColor = GetColorForApproval(approvalFiles.TestStatus);

                SourceRange range = element.Range;
                ea.PaintArgs.DrawLine(range.Start.Line, range.Start.Offset, range.End.Offset - range.Start.Offset, lineColor,
                                      LineStyle.SolidUnderline);
            }
        }
Exemple #3
0
        private void PlugIn1_EditorPaintLanguageElement(EditorPaintLanguageElementEventArgs ea)
        {
            if (!_HighlightingEnabled)
            {
                return;
            }
            LanguageElement element = ea.LanguageElement;

            if (_LinesChanged.ContainsKey(element.StartLine))
            {
                return;
            }

            if (IsUndisposedLocal(element))
            {
                ea.PaintArgs.OverlayText(element.Name, element.NameRange.Start, Color.Red);
            }
        }
        /// <summary>
        /// Put up the action tile
        /// redraw the test attribute
        /// Draw the parsed error text if we can
        /// </summary>
        private void PlugIn1_EditorPaintLanguageElement(EditorPaintLanguageElementEventArgs ea)
        {
            Attribute testAttribute = GetTestAttributeForLanguageElement(ea.LanguageElement);

            if (testAttribute != null)
            {
                UnitTestDetail testData = FindDataForTest(testAttribute);
                if (testData != null)
                {
                    if (ea.LanguageElement.ElementType == LanguageElementType.Attribute)
                    {
                        DrawTestRunnerIcon(ea.PaintArgs, testData);
                        RedrawTestAttribute(ea.PaintArgs, testData);
                    }
                    else
                    {
                        DrawError(ea, testData.Result);
                    }
                }
            }
        }
 /// <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>
        /// 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>
        /// Put up the action tile
        /// redraw the test attribute
        /// Draw the parsed error text if we can
        /// </summary>
        private void PlugIn1_EditorPaintLanguageElement(EditorPaintLanguageElementEventArgs ea)
        {
			Attribute testAttribute = GetTestAttributeForLanguageElement(ea.LanguageElement);
			if (testAttribute != null)
			{
				UnitTestDetail testData = FindDataForTest(testAttribute);
				if (testData != null)
				{
					if (ea.LanguageElement.ElementType == LanguageElementType.Attribute)
					{
						DrawTestRunnerIcon(ea.PaintArgs, testData);
						RedrawTestAttribute(ea.PaintArgs, testData);
					}
					else
					{
						DrawError(ea, testData.Result);
					}
				}
			}
        }
 private void Colorizer_Plugin_EditorPaintLanguageElement(EditorPaintLanguageElementEventArgs ea)
 {
 }