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

            node.Accept(visitor);
            visitor.Received().VisitDirectiveBlockStart(node);
        }
예제 #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);
        }
예제 #4
0
 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);
 }
예제 #5
0
        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);
        }
예제 #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 }));
 }
예제 #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);
        }
예제 #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 }));
        }
예제 #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;
        }
예제 #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;
        }
예제 #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);
     }
 }
예제 #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));
            }
        }
예제 #13
0
 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");
 }
예제 #14
0
 public DirectiveWithKnownAttributeValues(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
예제 #15
0
 public DirectiveWithKnownAttributeValues(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
예제 #16
0
 public DirectiveWithAttributeProperty(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
예제 #17
0
 public DirectiveWithDescription(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }            
예제 #18
0
 public TestableDirective(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
예제 #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);
 }
예제 #20
0
 public TemplateDirective(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
예제 #21
0
 public DirectiveWithAttributeProperty(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
예제 #22
0
 protected internal virtual void VisitDirectiveBlockStart(DirectiveBlockStart node)
 {            
     this.VisitSyntaxToken(node);
 }
예제 #23
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);
 }
예제 #24
0
 public DirectiveWithDescription(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end)
     : base(start, name, attributes, end)
 {
 }
예제 #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");
 }
예제 #26
0
 protected internal virtual void VisitDirectiveBlockStart(DirectiveBlockStart node)
 {
     this.VisitSyntaxToken(node);
 }