public static void AcceptCallsVisitIncludeDirectiveMethodOfSyntaxNodeVisitor() { var visitor = Substitute.For<SyntaxNodeVisitor>(); var directive = new IncludeDirective(new DirectiveBlockStart(0), new DirectiveName(4, "include"), new Attribute[0], new BlockEnd(12)); directive.Accept(visitor); visitor.Received().VisitIncludeDirective(directive); }
public static void ValidateReturnsErrorWhenFileAttributeIsNotSpecified() { var directive = new IncludeDirective(new DirectiveBlockStart(0), new DirectiveName(4, "include"), new Attribute[0], new BlockEnd(12)); TemplateError error = directive.Validate().Single(); Assert.Contains("File", error.Message, StringComparison.OrdinalIgnoreCase); }
public static void GetDescriptionReturnsDescriptionOfDirective() { var directive = new IncludeDirective(new DirectiveBlockStart(0), new DirectiveName(4, "include"), new Attribute[0], new BlockEnd(12)); string description; Span applicableTo; Assert.True(directive.TryGetDescription(4, out description, out applicableTo)); Assert.Contains("text from another file", description, StringComparison.OrdinalIgnoreCase); }
public static void AcceptCallsVisitIncludeDirectiveMethodOfSyntaxNodeVisitor() { var visitor = Substitute.For <SyntaxNodeVisitor>(); var directive = new IncludeDirective(new DirectiveBlockStart(0), new DirectiveName(4, "include"), new Attribute[0], new BlockEnd(12)); directive.Accept(visitor); visitor.Received().VisitIncludeDirective(directive); }
public static void FileReturnsValueOfFileAttribute() { var directive = new IncludeDirective( new DirectiveBlockStart(0), new DirectiveName(4, "include"), new[] { new Attribute(new AttributeName(12, "file"), new Equals(16), new DoubleQuote(17), new AttributeValue(18, "template.tt"), new DoubleQuote(29)) }, new BlockEnd(30)); Assert.Equal("template.tt", directive.File); }
public static void VisitIncludeDirectiveCallsVisitDirectiveToAllowProcessingAllDirectivesPolymorphically() { var visitor = Substitute.ForPartsOf <SyntaxNodeVisitor>(); var includeDirective = new IncludeDirective(new DirectiveBlockStart(0), new DirectiveName(0, "include"), Enumerable.Empty <Attribute>(), new BlockEnd(0)); visitor.VisitIncludeDirective(includeDirective); visitor.Received().VisitDirective(includeDirective); Assert.Equal(typeof(Directive), typeof(IncludeDirective).BaseType); }
public static void GetDescriptionReturnsDescriptionOfNameAttribute() { var directive = new IncludeDirective( new DirectiveBlockStart(0), new DirectiveName(4, "include"), new[] { new Attribute(new AttributeName(12, "file"), new Equals(16), new DoubleQuote(17), new AttributeValue(18, "template.tt"), new DoubleQuote(29)) }, new BlockEnd(30)); string description; Span applicableTo; Assert.True(directive.TryGetDescription(12, out description, out applicableTo)); Assert.Contains("path to the included file", description, StringComparison.OrdinalIgnoreCase); }
public static void VisitIncludeDirectiveCallsVisitDirectiveToAllowProcessingAllDirectivesPolymorphically() { var visitor = Substitute.ForPartsOf<SyntaxNodeVisitor>(); var includeDirective = new IncludeDirective(new DirectiveBlockStart(0), new DirectiveName(0, "include"), Enumerable.Empty<Attribute>(), new BlockEnd(0)); visitor.VisitIncludeDirective(includeDirective); visitor.Received().VisitDirective(includeDirective); Assert.Equal(typeof(Directive), typeof(IncludeDirective).BaseType); }
public static void FileReturnsEmptyStringWhenFileAttributeIsNotSpecified() { var directive = new IncludeDirective(new DirectiveBlockStart(0), new DirectiveName(4, "include"), new Attribute[0], new BlockEnd(12)); Assert.Equal(string.Empty, directive.File); }
protected internal virtual void VisitIncludeDirective(IncludeDirective node) { this.VisitDirective(node); }