/// <summary> /// Создает директиву на основе шаблона /// </summary> public Directive(TemplateDirective templateDirective) : this() { ADNoFile = templateDirective.ADNoFile; ADType = templateDirective.ADType; Applicability = templateDirective.Applicability; ATAChapter = templateDirective.ATAChapter ?? new AtaChapter { ItemId = -1 }; Cost = templateDirective.Cost; Description = templateDirective.Description; DirectiveType = templateDirective.DirectiveType; EngineeringOrders = templateDirective.EngineeringOrders; EngineeringOrderFile = templateDirective.EngineeringOrderFile; Highlight = templateDirective.Highlight; HiddenRemarks = templateDirective.HiddenRemarks; KitRequired = templateDirective.KitRequired; ManHours = templateDirective.ManHours; NDTType = templateDirective.NDTType; Paragraph = templateDirective.Paragraph; Remarks = templateDirective.Remarks; ServiceBulletinNo = templateDirective.ServiceBulletinNo; ServiceBulletinFile = templateDirective.ServiceBulletinFile; Title = templateDirective.Title; _threshold = templateDirective.Threshold; WorkType = templateDirective.DirectiveWorkType; }
public static void NodeReturnsNullWhenPositionIsOutsideOfAttributeValue() { var directive = new TemplateDirective( new DirectiveBlockStart(0), new DirectiveName(4, "template"), new[] { new Attribute(new AttributeName(13, "debug"), new Equals(18), new DoubleQuote(19), new AttributeValue(20, string.Empty), new DoubleQuote(20)) }, new BlockEnd(22)); var builder = new TemplateCompletionBuilder(19); builder.Visit(directive); Assert.Null(builder.Node); }
public static void CompletionReturnsNullWhenPositionIsInsideValueOfUnrecognizedAttribute() { // <#@ template debug="" #> var directive = new TemplateDirective( new DirectiveBlockStart(0), new DirectiveName(4, "template"), new[] { new Attribute(new AttributeName(13, "foo"), new Equals(16), new DoubleQuote(17), new AttributeValue(18, string.Empty), new DoubleQuote(18)) }, new BlockEnd(20)); var builder = new TemplateCompletionBuilder(18); builder.Visit(directive); Assert.Null(builder.Completions); }
public static void CompletionsReturnsWellKnownValuesWhenPositionIsWithinAttributeValue() { // <#@ template debug="" #> var directive = new TemplateDirective( new DirectiveBlockStart(0), new DirectiveName(4, "template"), new[] { new Attribute(new AttributeName(13, "debug"), new Equals(18), new DoubleQuote(19), new AttributeValue(20, string.Empty), new DoubleQuote(20)) }, new BlockEnd(22)); var builder = new TemplateCompletionBuilder(20); builder.Visit(directive); Assert.NotNull(builder.Completions); Assert.Equal("false", builder.Completions[0].DisplayText, StringComparer.OrdinalIgnoreCase); Assert.Equal("true", builder.Completions[1].DisplayText, StringComparer.OrdinalIgnoreCase); }
public static void CompletionsReturnsAttributeValuesWithDescriptions() { // <#@ template debug="" #> var directive = new TemplateDirective( new DirectiveBlockStart(0), new DirectiveName(4, "template"), new[] { new Attribute(new AttributeName(13, "debug"), new Equals(18), new DoubleQuote(19), new AttributeValue(20, string.Empty), new DoubleQuote(20)) }, new BlockEnd(22)); var builder = new TemplateCompletionBuilder(20); builder.Visit(directive); foreach (Completion completion in builder.Completions) { Assert.False(string.IsNullOrEmpty(completion.Description), completion.DisplayText + " completion should have a description."); } }