public static void AcceptCallsVisitBlockEndMethodOfSyntaxNodeVisitor() { var visitor = Substitute.For<SyntaxNodeVisitor>(); var node = new BlockEnd(0); node.Accept(visitor); visitor.Received().VisitBlockEnd(node); }
public static void ChildNodesReturnsBlockStartAndBlockEnd() { var start = new StatementBlockStart(default(int)); var end = new BlockEnd(default(int)); var codeBlock = new CodeBlock(start, end); Assert.True(codeBlock.ChildNodes().SequenceEqual(new SyntaxNode[] { start, end })); }
public CodeBlock(CodeBlockStart start, BlockEnd end) { Debug.Assert(start != null, "start"); Debug.Assert(end != null, "end"); this.start = start; this.end = end; }
public static void SpanEndsAtBlockEnd() { BlockEnd end; var codeBlock = new CodeBlock(new StatementBlockStart(0), end = new BlockEnd(40)); Assert.Equal(end.Span.End, codeBlock.Span.End); }
public CodeBlock(CodeBlockStart start, BlockEnd end) { Debug.Assert(start != null, "start"); Debug.Assert(end != null, "end"); this.start = start; this.end = end; }
public static void SpanEndReturnsMaxEndOfChildNodes() { var end = new BlockEnd(40); var start = new StatementBlockStart(4); var target = new Template(end, start); // intentionally reversed Assert.Equal(end.Span.End, target.Span.End); }
public static void ChildNodesReturnsBlockStartAndBlockEnd() { var start = new StatementBlockStart(default(int)); var end = new BlockEnd(default(int)); var codeBlock = new CodeBlock(start, end); Assert.True(codeBlock.ChildNodes().SequenceEqual(new SyntaxNode[] { start, end })); }
public static void AcceptCallsVisitBlockEndMethodOfSyntaxNodeVisitor() { var visitor = Substitute.For <SyntaxNodeVisitor>(); var node = new BlockEnd(0); node.Accept(visitor); visitor.Received().VisitBlockEnd(node); }
public static void SpanEndReturnsMaxEndOfChildNodes() { var end = new BlockEnd(40); var start = new StatementBlockStart(4); var target = new Template(end, start); // intentionally reversed Assert.Equal(end.Span.End, target.Span.End); }
public static void VisitBlockEndCallsVisitSyntaxTokenToAllowProcessingAllSyntaxTokensPolymorphically() { var visitor = Substitute.ForPartsOf<SyntaxNodeVisitor>(); var blockEnd = new BlockEnd(0); visitor.VisitBlockEnd(blockEnd); visitor.Received().VisitSyntaxToken(blockEnd); Assert.Equal(typeof(SyntaxToken), typeof(BlockEnd).BaseType); }
public static void ChildNodesReturnsNodesSpecifiedInConstructor() { var start = new StatementBlockStart(0); var end = new BlockEnd(2); var node = new Template(start, end); Assert.Same(start, node.ChildNodes().First()); Assert.Same(end, node.ChildNodes().Last()); }
public static void VisitBlockEndCallsVisitSyntaxTokenToAllowProcessingAllSyntaxTokensPolymorphically() { var visitor = Substitute.ForPartsOf <SyntaxNodeVisitor>(); var blockEnd = new BlockEnd(0); visitor.VisitBlockEnd(blockEnd); visitor.Received().VisitSyntaxToken(blockEnd); Assert.Equal(typeof(SyntaxToken), typeof(BlockEnd).BaseType); }
public static void ChildNodesReturnsNodesSpecifiedInConstructor() { var start = new StatementBlockStart(0); var end = new BlockEnd(2); var node = new Template(start, end); Assert.Same(start, node.ChildNodes().First()); Assert.Same(end, node.ChildNodes().Last()); }
public static void VisitTerminalNodeCallsVisitSyntaxNodeToAllowProcessingAllSyntaxNodesPolymorphically() { var visitor = Substitute.ForPartsOf <SyntaxNodeVisitor>(); var terminalNode = new BlockEnd(0); visitor.VisitTerminalNode(terminalNode); Assert.Equal(1, visitor.ReceivedCalls().Count(call => call.GetMethodInfo().Name == "VisitSyntaxNode")); Assert.Equal(typeof(SyntaxNode), typeof(TerminalNode).BaseType); }
public static void GetDescriptionReturnsDescriptionOfDirectiveBlockStart() { var target = new BlockEnd(0); string description; Span applicableTo; Assert.True(target.TryGetDescription(0, out description, out applicableTo)); Assert.Contains("control block", description, StringComparison.OrdinalIgnoreCase); Assert.Contains("directive", description, StringComparison.OrdinalIgnoreCase); Assert.Equal(target.Span, applicableTo); }
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 })); }
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 })); }
public static void SpanEndsAtBlockEnd() { BlockEnd end; var directive = new TestableDirective( new DirectiveBlockStart(10), new DirectiveName(14, "template"), new Attribute[0], end = new BlockEnd(23)); Assert.Equal(end.Span.End, directive.Span.End); }
public static void GetDescriptionReturnsDescriptionOfDirectiveBlockStart() { var target = new BlockEnd(0); string description; Span applicableTo; Assert.True(target.TryGetDescription(0, out description, out applicableTo)); Assert.Contains("control block", description, StringComparison.OrdinalIgnoreCase); Assert.Contains("directive", description, StringComparison.OrdinalIgnoreCase); Assert.Equal(target.Span, applicableTo); }
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; }
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; }
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 CodeBlock(CodeBlockStart start, Code code, BlockEnd end) : this(start, end) { Debug.Assert(code != null, "code"); this.code = code; }
public DirectiveWithKnownAttributeValues(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end) : base(start, name, attributes, end) { }
public DirectiveWithAttributeProperty(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end) : base(start, name, attributes, end) { }
public static void VisitTerminalNodeCallsVisitSyntaxNodeToAllowProcessingAllSyntaxNodesPolymorphically() { var visitor = Substitute.ForPartsOf<SyntaxNodeVisitor>(); var terminalNode = new BlockEnd(0); visitor.VisitTerminalNode(terminalNode); Assert.Equal(1, visitor.ReceivedCalls().Count(call => call.GetMethodInfo().Name == "VisitSyntaxNode")); Assert.Equal(typeof(SyntaxNode), typeof(TerminalNode).BaseType); }
public static void SpanEndsAtBlockEnd() { BlockEnd end; var directive = new TestableDirective( new DirectiveBlockStart(10), new DirectiveName(14, "template"), new Attribute[0], end = new BlockEnd(23)); Assert.Equal(end.Span.End, directive.Span.End); }
public DirectiveWithDescription(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end) : base(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"); }
protected internal virtual void VisitBlockEnd(BlockEnd node) { this.VisitSyntaxToken(node); }
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 TestableDirective(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end) : base(start, name, attributes, end) { }
public DirectiveWithKnownAttributeValues(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end) : base(start, name, attributes, end) { }
public DirectiveWithDescription(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end) : base(start, name, attributes, end) { }
public DirectiveWithAttributeProperty(DirectiveBlockStart start, DirectiveName name, IEnumerable<Attribute> attributes, BlockEnd end) : base(start, name, attributes, end) { }
protected internal virtual void VisitBlockEnd(BlockEnd node) { this.VisitSyntaxToken(node); }
public CodeBlock(CodeBlockStart start, Code code, BlockEnd end) : this(start, end) { Debug.Assert(code != null, "code"); this.code = code; }
public static void SpanEndsAtBlockEnd() { BlockEnd end; var codeBlock = new CodeBlock(new StatementBlockStart(0), end = new BlockEnd(40)); Assert.Equal(end.Span.End, codeBlock.Span.End); }
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"); }
public TemplateDirective(DirectiveBlockStart start, DirectiveName name, IEnumerable <Attribute> attributes, BlockEnd end) : base(start, name, attributes, end) { }