public override void VisitDirective(DirectiveIntermediateNode node)
            {
                if (_directive == node.Directive)
                {
                    Directives.Add(new IntermediateNodeReference(Parent, node));
                }

                base.VisitDirective(node);
            }
        public void FindDirectiveReferences_FindsMatchingDirectives()
        {
            // Arrange
            var directive  = DirectiveDescriptor.CreateSingleLineDirective("test");
            var directive2 = DirectiveDescriptor.CreateSingleLineDirective("test");

            var document   = new DocumentIntermediateNode();
            var @namespace = new NamespaceDeclarationIntermediateNode();

            var builder = IntermediateNodeBuilder.Create(document);

            builder.Push(@namespace);

            var match1 = new DirectiveIntermediateNode()
            {
                Directive = directive,
            };

            builder.Add(match1);

            var nonMatch = new DirectiveIntermediateNode()
            {
                Directive = directive2,
            };

            builder.Add(nonMatch);

            var match2 = new DirectiveIntermediateNode()
            {
                Directive = directive,
            };

            builder.Add(match2);

            // Act
            var results = document.FindDirectiveReferences(directive);

            // Assert
            Assert.Collection(
                results,
                r =>
            {
                Assert.Same(@namespace, r.Parent);
                Assert.Same(match1, r.Node);
            },
                r =>
            {
                Assert.Same(@namespace, r.Parent);
                Assert.Same(match2, r.Node);
            });
        }