コード例 #1
0
 public static void AcceptCallsVisitAttributeNameMethodOfSyntaxNodeVisitor()
 {
     var visitor = Substitute.For<SyntaxNodeVisitor>();
     var node = new AttributeName(0, string.Empty);
     node.Accept(visitor);
     visitor.Received().VisitAttributeName(node);
 }
コード例 #2
0
        protected internal override void VisitAttributeName(AttributeName node)
        {
            base.VisitAttributeName(node);

            if (node.Span.Start <= this.position && this.position <= node.Span.End)
            {
                Debug.Assert(this.currentDirective != null, "currentDirective");
                var directiveDescriptor = DirectiveDescriptor.GetDirectiveDescriptor(this.currentDirective.GetType());

                var completions = new List<Completion>();
                foreach (AttributeDescriptor attribute in directiveDescriptor.Attributes.Values)
                {
                    if (!this.currentDirective.Attributes.ContainsKey(attribute.DisplayName))
                    {
                        completions.Add(CreateAttributeCompletion(attribute));
                    }
                }

                if (completions.Count > 0)
                {
                    this.Completions = completions;
                    this.Node = node;
                }
            }
        }
コード例 #3
0
 public static void VisitAttributeNameCallsVisitCaptureNodeToAllowProcessingAllCaptureNodesPolymorphically()
 {
     var visitor = Substitute.ForPartsOf<SyntaxNodeVisitor>();
     var attributeName = new AttributeName(0, "attribute");
     visitor.VisitAttributeName(attributeName);
     visitor.Received().VisitCaptureNode(attributeName);
     Assert.Equal(typeof(CaptureNode), typeof(AttributeName).BaseType);
 }
コード例 #4
0
        public static void AcceptCallsVisitAttributeNameMethodOfSyntaxNodeVisitor()
        {
            var visitor = Substitute.For <SyntaxNodeVisitor>();
            var node    = new AttributeName(0, string.Empty);

            node.Accept(visitor);
            visitor.Received().VisitAttributeName(node);
        }
コード例 #5
0
        public static void VisitCaptureNodeCallsVisitTerminalNodeToAllowProcessingAllTerminalNodesPolymorphically()
        {
            var visitor     = Substitute.ForPartsOf <SyntaxNodeVisitor>();
            var captureNode = new AttributeName(0, "attribute");

            visitor.VisitCaptureNode(captureNode);
            visitor.Received().VisitTerminalNode(captureNode);
            Assert.Equal(typeof(TerminalNode), typeof(CaptureNode).BaseType);
        }
コード例 #6
0
ファイル: AttributeTest.cs プロジェクト: icool123/T4Toolbox
 public static void ChildNodesReturnsNodesSpecifiedInConstructor()
 {
     var name = new AttributeName(0, "language");
     var equals = new Equals(8);
     var quote1 = new DoubleQuote(9);
     var value = new AttributeValue(10, "C#");
     var quote2 = new DoubleQuote(12);
     var attribute = new Attribute(name, equals, quote1, value, quote2);
     Assert.True(new SyntaxNode[] { name, equals, quote1, value, quote2 }.SequenceEqual(attribute.ChildNodes()));
 }
コード例 #7
0
ファイル: AttributeTest.cs プロジェクト: toasteur/T4toolbox
        public static void ChildNodesReturnsNodesSpecifiedInConstructor()
        {
            var name      = new AttributeName(0, "language");
            var equals    = new Equals(8);
            var quote1    = new DoubleQuote(9);
            var value     = new AttributeValue(10, "C#");
            var quote2    = new DoubleQuote(12);
            var attribute = new Attribute(name, equals, quote1, value, quote2);

            Assert.True(new SyntaxNode[] { name, equals, quote1, value, quote2 }.SequenceEqual(attribute.ChildNodes()));
        }
コード例 #8
0
ファイル: AttributeTest.cs プロジェクト: icool123/T4Toolbox
 public static void SpanStartsAtName()
 {
     AttributeName name;
     var attribute = new Attribute(
         name = new AttributeName(10, "language"), 
         new Equals(18), 
         new DoubleQuote(19), 
         new AttributeValue(20, "C#"), 
         new DoubleQuote(22));
     Assert.Equal(name.Span.Start, attribute.Span.Start);
 }
コード例 #9
0
ファイル: AttributeTest.cs プロジェクト: toasteur/T4toolbox
        public static void SpanStartsAtName()
        {
            AttributeName name;
            var           attribute = new Attribute(
                name = new AttributeName(10, "language"),
                new Equals(18),
                new DoubleQuote(19),
                new AttributeValue(20, "C#"),
                new DoubleQuote(22));

            Assert.Equal(name.Span.Start, attribute.Span.Start);
        }
コード例 #10
0
ファイル: Attribute.cs プロジェクト: toasteur/T4toolbox
        public Attribute(AttributeName name, Equals equals, DoubleQuote quote1, AttributeValue value, DoubleQuote quote2)
        {
            Debug.Assert(name != null, "name");
            Debug.Assert(equals != null, "equals");
            Debug.Assert(quote1 != null, "quote1");
            Debug.Assert(value != null, "value");
            Debug.Assert(quote2 != null, "quote2");

            this.name   = name;
            this.equals = equals;
            this.quote1 = quote1;
            this.value  = value;
            this.quote2 = quote2;
        }
コード例 #11
0
ファイル: Attribute.cs プロジェクト: icool123/T4Toolbox
        public Attribute(AttributeName name, Equals equals, DoubleQuote quote1, AttributeValue value, DoubleQuote quote2)
        {
            Debug.Assert(name != null, "name");
            Debug.Assert(equals != null, "equals");
            Debug.Assert(quote1 != null, "quote1");
            Debug.Assert(value != null, "value");
            Debug.Assert(quote2 != null, "quote2");

            this.name = name;
            this.equals = equals;
            this.quote1 = quote1;
            this.value = value;
            this.quote2 = quote2;
        }
コード例 #12
0
 public static void NodeReturnsAttributeNameWhenPositionIsWithinAttributeName()
 {
     AttributeName attributeName;
     var directive = new OutputDirective(
         new DirectiveBlockStart(0),
         new DirectiveName(4, "output"),
         new[] { new Attribute(attributeName = new AttributeName(11, "e"), new Equals(12), new DoubleQuote(13), new AttributeValue(14, string.Empty), new DoubleQuote(14)) },
         new BlockEnd(16));
     var builder = new TemplateCompletionBuilder(12);
     builder.Visit(directive);
     Assert.Same(attributeName, builder.Node);
 }
コード例 #13
0
 protected internal virtual void VisitAttributeName(AttributeName node)
 {
     this.VisitCaptureNode(node);
 }
コード例 #14
0
 protected internal virtual void VisitAttributeName(AttributeName node)
 {
     this.VisitCaptureNode(node);
 }
コード例 #15
0
 public static void KindReturnsAttributeNameSyntaxKind()
 {
     var target = new AttributeName(0, string.Empty);
     Assert.Equal(SyntaxKind.AttributeName, target.Kind);
 }
コード例 #16
0
        public static void KindReturnsAttributeNameSyntaxKind()
        {
            var target = new AttributeName(0, string.Empty);

            Assert.Equal(SyntaxKind.AttributeName, target.Kind);
        }