public static void AcceptCallsVisitDirectiveBlockStartMethodOfSyntaxNodeVisitor()
 {
     var visitor = Substitute.For<SyntaxNodeVisitor>();
     var node = new DirectiveBlockStart(default(int));
     node.Accept(visitor);
     visitor.Received().VisitDirectiveBlockStart(node);
 }
        public static void AcceptCallsVisitDirectiveBlockStartMethodOfSyntaxNodeVisitor()
        {
            var visitor = Substitute.For <SyntaxNodeVisitor>();
            var node    = new DirectiveBlockStart(default(int));

            node.Accept(visitor);
            visitor.Received().VisitDirectiveBlockStart(node);
        }
Beispiel #3
0
        public static void VisitDirectiveBlockStartCallsVisitSyntaxTokenToAllowProcessingAllSyntaxTokensPolymorphically()
        {
            var visitor             = Substitute.ForPartsOf <SyntaxNodeVisitor>();
            var directiveBlockStart = new DirectiveBlockStart(0);

            visitor.VisitDirectiveBlockStart(directiveBlockStart);
            visitor.Received().VisitSyntaxToken(directiveBlockStart);
            Assert.Equal(typeof(SyntaxToken), typeof(DirectiveBlockStart).BaseType);
        }
 public static void GetDescriptionReturnsDescriptionOfDirectiveBlockStart()
 {
     var target = new DirectiveBlockStart(0);
     string description;
     Span applicableTo;
     Assert.True(target.TryGetDescription(0, out description, out applicableTo));
     Assert.Contains("directive", description, StringComparison.OrdinalIgnoreCase);
     Assert.Equal(target.Span, applicableTo);
 }
        public static void GetDescriptionReturnsDescriptionOfDirectiveBlockStart()
        {
            var    target = new DirectiveBlockStart(0);
            string description;
            Span   applicableTo;

            Assert.True(target.TryGetDescription(0, out description, out applicableTo));
            Assert.Contains("directive", description, StringComparison.OrdinalIgnoreCase);
            Assert.Equal(target.Span, applicableTo);
        }
Beispiel #6
0
 public static void ChildNodesReturnsNodesSpecifiedInConstructor()
 {
     var start = new DirectiveBlockStart(0);
     var name = new DirectiveName(4, "template");
     var a1 = new Attribute(new AttributeName(13, "language"), new Equals(21), new DoubleQuote(22), new AttributeValue(23, "C#"), new DoubleQuote(25));
     var a2 = new Attribute(new AttributeName(27, "debug"), new Equals(32), new DoubleQuote(33), new AttributeValue(34, "True"), new DoubleQuote(38));
     var end = new BlockEnd(27);
     var directive = new TestableDirective(start, name, new[] { a1, a2 }, end);
     Assert.True(directive.ChildNodes().SequenceEqual(new SyntaxNode[] { start, name, a1, a2, end }));
 }
Beispiel #7
0
        public static void SpanStartsAtBlockStart()
        {
            DirectiveBlockStart start;
            var directive = new TestableDirective(
                start = new DirectiveBlockStart(10),
                new DirectiveName(14, "template"),
                new Attribute[0],
                new BlockEnd(23));

            Assert.Equal(start.Span.Start, directive.Span.Start);
        }
Beispiel #8
0
        public static void ChildNodesReturnsNodesSpecifiedInConstructor()
        {
            var start     = new DirectiveBlockStart(0);
            var name      = new DirectiveName(4, "template");
            var a1        = new Attribute(new AttributeName(13, "language"), new Equals(21), new DoubleQuote(22), new AttributeValue(23, "C#"), new DoubleQuote(25));
            var a2        = new Attribute(new AttributeName(27, "debug"), new Equals(32), new DoubleQuote(33), new AttributeValue(34, "True"), new DoubleQuote(38));
            var end       = new BlockEnd(27);
            var directive = new TestableDirective(start, name, new[] { a1, a2 }, end);

            Assert.True(directive.ChildNodes().SequenceEqual(new SyntaxNode[] { start, name, a1, a2, end }));
        }
Beispiel #9
0
        protected Directive(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end)
        {
            Debug.Assert(start != null, "start");
            Debug.Assert(name != null, "name");
            Debug.Assert(attributes != null, "attributes");
            Debug.Assert(end != null, "end");

            this.start = start;
            this.name = name;
            this.attributes = attributes.ToDictionary(a => a.Name, a => a, StringComparer.OrdinalIgnoreCase);
            this.end = end;
        }
Beispiel #10
0
        protected Directive(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end)
        {
            Debug.Assert(start != null, "start");
            Debug.Assert(name != null, "name");
            Debug.Assert(attributes != null, "attributes");
            Debug.Assert(end != null, "end");

            this.start      = start;
            this.name       = name;
            this.attributes = attributes.ToDictionary(a => a.Name, a => a, StringComparer.OrdinalIgnoreCase);
            this.end        = end;
        }
Beispiel #11
0
 public static Directive Create(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end)
 {
     switch (name.Text.ToUpperInvariant())
     {
         case "ASSEMBLY": return new AssemblyDirective(start, name, attributes, end);
         case "IMPORT": return new ImportDirective(start, name, attributes, end);
         case "INCLUDE": return new IncludeDirective(start, name, attributes, end);                
         case "OUTPUT": return new OutputDirective(start, name, attributes, end);
         case "PARAMETER": return new ParameterDirective(start, name, attributes, end);
         case "TEMPLATE": return new TemplateDirective(start, name, attributes, end);
         default: return new CustomDirective(start, name, attributes, end);
     }
 }
Beispiel #12
0
        public static Directive Create(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end)
        {
            switch (name.Text.ToUpperInvariant())
            {
            case "ASSEMBLY": return(new AssemblyDirective(start, name, attributes, end));

            case "IMPORT": return(new ImportDirective(start, name, attributes, end));

            case "INCLUDE": return(new IncludeDirective(start, name, attributes, end));

            case "OUTPUT": return(new OutputDirective(start, name, attributes, end));

            case "PARAMETER": return(new ParameterDirective(start, name, attributes, end));

            case "TEMPLATE": return(new TemplateDirective(start, name, attributes, end));

            default: return(new CustomDirective(start, name, attributes, end));
            }
        }
 public ParameterDirective(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
     Debug.Assert(name.Text.Equals("parameter", StringComparison.OrdinalIgnoreCase), "name");
 }
Beispiel #14
0
 public DirectiveWithKnownAttributeValues(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
Beispiel #15
0
 public DirectiveWithKnownAttributeValues(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
Beispiel #16
0
 public DirectiveWithAttributeProperty(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
Beispiel #17
0
 public DirectiveWithDescription(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }            
Beispiel #18
0
 public TestableDirective(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
Beispiel #19
0
 public static void SpanStartsAtBlockStart()
 {
     DirectiveBlockStart start;
     var directive = new TestableDirective(
         start = new DirectiveBlockStart(10), 
         new DirectiveName(14, "template"), 
         new Attribute[0], 
         new BlockEnd(23));
     Assert.Equal(start.Span.Start, directive.Span.Start);
 }
Beispiel #20
0
 public TemplateDirective(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
Beispiel #21
0
 public DirectiveWithAttributeProperty(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
Beispiel #22
0
 protected internal virtual void VisitDirectiveBlockStart(DirectiveBlockStart node)
 {            
     this.VisitSyntaxToken(node);
 }
 public static void VisitDirectiveBlockStartCallsVisitSyntaxTokenToAllowProcessingAllSyntaxTokensPolymorphically()
 {
     var visitor = Substitute.ForPartsOf<SyntaxNodeVisitor>();
     var directiveBlockStart = new DirectiveBlockStart(0);
     visitor.VisitDirectiveBlockStart(directiveBlockStart);
     visitor.Received().VisitSyntaxToken(directiveBlockStart);
     Assert.Equal(typeof(SyntaxToken), typeof(DirectiveBlockStart).BaseType);
 }
Beispiel #24
0
 public DirectiveWithDescription(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
Beispiel #25
0
 public IncludeDirective(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
     Debug.Assert(name.Text.Equals("include", StringComparison.OrdinalIgnoreCase), "name");
 }
Beispiel #26
0
 protected internal virtual void VisitDirectiveBlockStart(DirectiveBlockStart node)
 {
     this.VisitSyntaxToken(node);
 }