public void Visit_Kitchen_Sink_Query_Names_With_Delegate()
        {
            // arrange
            DocumentNode document = Utf8GraphQLParser.Parse(
                FileResource.Open("kitchen-sink.graphql")
                .NormalizeLineBreaks());
            var visitationMap = new BarVisitationMap();
            var enterNames    = new List <string>();
            var leaveNames    = new List <string>();

            // act
            document.Accept <NameNode>(
                (node, parent, path, ancestors) =>
            {
                enterNames.Add(node.Value);
                return(VisitorAction.Continue);
            },
                (node, parent, path, ancestors) =>
            {
                leaveNames.Add(node.Value);
                return(VisitorAction.Continue);
            },
                node => VisitorAction.Continue);

            // assert
            Assert.Equal(enterNames, leaveNames);
            new List <string>[] { enterNames, leaveNames }.MatchSnapshot();
        }
        public void Visit_Kitchen_Sink_Schema()
        {
            // arrange
            DocumentNode document = Utf8GraphQLParser.Parse(
                FileResource.Open("schema-kitchen-sink.graphql"));
            var visitationMap = new BarVisitationMap();

            // act
            document.Accept(new Bar(), visitationMap);

            // assert
            visitationMap.VisitedNodes.MatchSnapshot();
        }
        public void Visit_Kitchen_Sink_Query_Names_With_Delegate_OnlyLeave()
        {
            // arrange
            DocumentNode document = Utf8GraphQLParser.Parse(
                FileResource.Open("kitchen-sink.graphql"));
            var visitationMap = new BarVisitationMap();
            var visitedNames  = new List <string>();

            // act
            document.Accept <NameNode>(
                null,
                (node, parent, path, ancestors) =>
            {
                visitedNames.Add(node.Value);
                return(VisitorAction.Continue);
            },
                node => VisitorAction.Continue);

            // assert
            visitedNames.MatchSnapshot();
        }