private void ParseRange(PlatformAttribute attribute, string stackTrace) { Start = new SourceRange(attribute.StartLine, attribute.StartOffset); string assertLocation = ExtractLineAndColumnData(stackTrace); End = new SourceRange(ParseLineNumber(assertLocation), ParseColumnNumber(assertLocation)); }
public ArrowDescription(PlatformAttribute attribute, Method method, TestResult result, MessageLimiter textConditioner) { ParseRange(attribute, result.StackTrace); ParseMessage(result.Message, textConditioner); Test = method; }
private static AssignmentExpression GetTheArg(DevExpress.CodeRush.StructuralParser.Attribute AttributeFact) { AssignmentExpression TheArg = null; ExpressionCollection factArguments = AttributeFact.Arguments; AssignmentExpression Arg = factArguments[0] as AssignmentExpression; if (Arg.LeftSide.Name.ToLower() == "DisplayName".ToLower()) { TheArg = Arg; } return(TheArg); }
private void CreateAttributeShadeAdornment(DecorateLanguageElementEventArgs args, DevExpress.CodeRush.StructuralParser.Attribute attribute, Method target, TestStatus status) { if (ShadeAttribute && status != TestStatus.Pending && status != TestStatus.PassedWithChanges && status != TestStatus.FailedWithChanges) { SourceRange shadedArea = new SourceRange( attribute.Parent.Range.Start, new SourcePoint(attribute.Range.End.Line, target.NameRange.End.Offset - 1)); args.AddAdornment(new TestAttributeShaderAdornmentDocumentAdornment(shadedArea, status, AttributeColors)); } }
public string GetAssociationName() { Attribute attribute = property.FindAttribute(typeof(AssociationAttribute)); if (attribute.ArgumentCount > 0) { var expression = attribute.Arguments[0] as PrimitiveExpression; if (expression != null && expression.IsStringLiteral && expression.TestValue is string) { return(expression.TestValue.ToString()); } } return(null); }
private void CreateErrorArrowAdornment(DecorateLanguageElementEventArgs args, DevExpress.CodeRush.StructuralParser.Attribute attribute, Method target, TestMethod test) { if (test.Status == TestStatus.Failure && DrawArrowToAssert) { ArrowDescription visibleArrow = new ArrowDescription( attribute, target, test.TestResults[0], new MessageLimiter(ShortenLongStrings, MaxContextLength, ConvertEscapeCharacters)); args.AddAdornment( new FailedTestInspectorDocumentAdornment( new DocPoint(attribute.StartLine, attribute.StartOffset), new DocPoint(visibleArrow.End.Start.Line, visibleArrow.End.Start.Offset), this, visibleArrow)); } }
private void PlugIn1_DecorateLanguageElement(object sender, DecorateLanguageElementEventArgs args) { LanguageElement element = args.LanguageElement; if (element.ElementType == LanguageElementType.Attribute) { DevExpress.CodeRush.StructuralParser.Attribute attribute = (DevExpress.CodeRush.StructuralParser.Attribute)element; if (attribute.TargetNode.ElementType == LanguageElementType.Method) { Method target = (Method)attribute.TargetNode; TestMethodCollection tests = CodeRush.UnitTests.Tests; foreach (TestMethod test in tests) { if (target.Location == test.FullName) { CreateErrorArrowAdornment(args, attribute, target, test); CreateAttributeShadeAdornment(args, attribute, target, test.Status); //OverlayErrorNextToAssert(ea, test); } } } } }
/// <summary> /// Adds the linking attribute. /// </summary> /// <param name="contractClass">The contract class.</param> private void AddLinkingAttribute(Class contractClass) { Contract.Requires(contractClass != null, "contractClass must not be null."); var typeOfExp = new TypeOfExpression(new TypeReferenceExpression(this.InterfaceName)); var attribute = new CustomAttribute() { Name = ContractClassFor }; if (attribute.Arguments != null) { attribute.Arguments.Add(typeOfExp); } var section = new AttributeSection(); if (section.AttributeCollection != null) { section.AttributeCollection.Add(attribute); } contractClass.AddAttributeSection(section); }