コード例 #1
0
ファイル: VisitorTests.cs プロジェクト: amarant/GraphQLSharp
 public void AllowsANamedFunctionsVisitorApi()
 {
     var ast = Parser.Parse("{ a, b { x }, c }", new ParseOptions
     {
         NoLocation = true,
     });
     var visitor = new NodeTypeVisitor();
     visitor.Visit(ast);
     visitor.Visited.ShouldBeEquivalentTo(ImmutableArray.Create(
         Tuple.Create(true, NodeType.SelectionSet, (object)null),
         Tuple.Create(true, NodeType.Name, (object)"a"),
         Tuple.Create(true, NodeType.Name, (object)"b"),
         Tuple.Create(true, NodeType.SelectionSet, (object)null),
         Tuple.Create(true, NodeType.Name, (object)"x"),
         Tuple.Create(false, NodeType.SelectionSet, (object)null),
         Tuple.Create(true, NodeType.Name, (object)"c"),
         Tuple.Create(false, NodeType.SelectionSet, (object)null)
     ));
 }
コード例 #2
0
ファイル: VisitorTests.cs プロジェクト: amarant/GraphQLSharp
        public void AllowsANamedFunctionsVisitorApi()
        {
            var ast = Parser.Parse("{ a, b { x }, c }", new ParseOptions
            {
                NoLocation = true,
            });
            var visitor = new NodeTypeVisitor();

            visitor.Visit(ast);
            visitor.Visited.ShouldBeEquivalentTo(ImmutableArray.Create(
                                                     Tuple.Create(true, NodeType.SelectionSet, (object)null),
                                                     Tuple.Create(true, NodeType.Name, (object)"a"),
                                                     Tuple.Create(true, NodeType.Name, (object)"b"),
                                                     Tuple.Create(true, NodeType.SelectionSet, (object)null),
                                                     Tuple.Create(true, NodeType.Name, (object)"x"),
                                                     Tuple.Create(false, NodeType.SelectionSet, (object)null),
                                                     Tuple.Create(true, NodeType.Name, (object)"c"),
                                                     Tuple.Create(false, NodeType.SelectionSet, (object)null)
                                                     ));
        }