Beispiel #1
0
        public void RewriteEveryFieldOfTheQuery()
        {
            // arange
            DocumentNode document = Utf8GraphQLParser.Parse(
                "{ foo { bar { baz } } }");

            // act
            DocumentNode rewritten = document
                                     .Rewrite <DirectiveQuerySyntaxRewriter, DirectiveNode>(
                new DirectiveNode("upper"));

            // assert
            rewritten.ToString(false).MatchSnapshot();
        }
Beispiel #2
0
        public void RewriteEveryFieldOfTheQuery()
        {
            // arange
            DocumentNode document = Utf8GraphQLParser.Parse(
                "{ foo { bar { baz } } }");

            // act
            DocumentNode rewritten = document
                                     .Rewrite <DirectiveQuerySyntaxRewriter, DirectiveNode>(
                new DirectiveNode("upper"));

            // assert
            var content        = new StringBuilder();
            var stringWriter   = new StringWriter(content);
            var documentWriter = new DocumentWriter(stringWriter);
            var serializer     = new QuerySyntaxSerializer();

            serializer.Visit(rewritten, documentWriter);
            content.ToString().MatchSnapshot();
        }