Пример #1
0
        public void ParseFacebookKitchenSinkSchema()
        {
            // arrange
            string schemaSource = FileResource.Open("schema-kitchen-sink.graphql");

            // act
            var          parser   = new Parser();
            DocumentNode document = parser.Parse(
                schemaSource, new ParserOptions(noLocations: true));

            // assert
            document.MatchSnapshot();
        }
Пример #2
0
        public void RussionLiterals()
        {
            // arrange
            byte[] sourceText = Encoding.UTF8.GetBytes(
                FileResource.Open("russion-literals.graphql"));

            // act
            var parser = new Utf8GraphQLParser(
                sourceText, ParserOptions.Default);
            DocumentNode document = parser.Parse();

            // assert
            document.MatchSnapshot();
        }
Пример #3
0
        public void QueryWithStringArg()
        {
            // arrange
            byte[] sourceText = Encoding.UTF8.GetBytes(
                FileResource.Open("QueryWithStringArg.graphql"));

            // act
            var parser = new Utf8GraphQLParser(
                sourceText, ParserOptions.Default);
            DocumentNode document = parser.Parse();

            // assert
            document.MatchSnapshot();
        }
Пример #4
0
        public void ParseFacebookKitchenSinkQuery()
        {
            // arrange
            string querySource = FileResource.Open("kitchen-sink.graphql");

            // act
            var          parser   = new Parser();
            DocumentNode document = parser.Parse(
                querySource, new ParserOptions(
                    noLocations: true, allowFragmentVariables: true));

            // assert
            document.MatchSnapshot();
        }
        public void KitchenSinkQueryQuery()
        {
            // arrange
            byte[] sourceText = Encoding.UTF8.GetBytes(
                FileResource.Open("kitchen-sink.graphql")
                .NormalizeLineBreaks());

            // act
            var parser = new Utf8GraphQLParser(
                sourceText, ParserOptions.Default);
            DocumentNode document = parser.Parse();

            // assert
            document.MatchSnapshot();
        }
Пример #6
0
        public void ParseFacebookKitchenSinkQuery()
        {
            // arrange
            string querySource = FileResource.Open("kitchen-sink.graphql");
            var    parser      = new Utf8GraphQLParser(
                Encoding.UTF8.GetBytes(querySource));

            // act
            DocumentNode document = parser.Parse();

            // assert
            QuerySyntaxSerializer.Serialize(document)
            .MatchSnapshot(new SnapshotNameExtension("sdl"));
            document.MatchSnapshot();
        }
        public void ParseQueryDirective()
        {
            // arrange
            var text = @"
                query ($var: Boolean) @onQuery {
                    field
                }
            ";

            // act
            DocumentNode document = Utf8GraphQLParser.Parse(
                Encoding.UTF8.GetBytes(text));

            // assert
            document.MatchSnapshot();
        }
Пример #8
0
        public void ParseFacebookKitchenSinkQuery()
        {
            // arrange
            var querySource =
                FileResource.Open("kitchen-sink.graphql")
                .NormalizeLineBreaks();
            var parser = new Utf8GraphQLParser(
                Encoding.UTF8.GetBytes(querySource));

            // act
            DocumentNode document = parser.Parse();

            // assert
            document.ToString().MatchSnapshot(new SnapshotNameExtension("sdl"));
            document.MatchSnapshot();
        }
        public void ParseFacebookKitchenSinkSchema()
        {
            // arrange
            string schemaSource = FileResource.Open(
                "schema-kitchen-sink.graphql")
                                  .NormalizeLineBreaks();
            var parser = new Utf8GraphQLParser(
                Encoding.UTF8.GetBytes(schemaSource));

            // act
            DocumentNode document = parser.Parse();

            // assert
            SchemaSyntaxSerializer.Serialize(document)
            .MatchSnapshot(new SnapshotNameExtension("sdl"));
            document.MatchSnapshot();
        }
Пример #10
0
        public void QueryWithComments()
        {
            // arrange
            string query = @"{
                hero {
                    name
                    # Queries can have comments!
                    friends {
                        name
                    }
                }
            }";

            // act
            DocumentNode document = Parser.Default.Parse(query,
                                                         new ParserOptions(noLocations: true));

            // assert
            document.MatchSnapshot();
        }
        public void QueryWithComments()
        {
            // arrange
            byte[] sourceText = Encoding.UTF8.GetBytes(
                @"{
                hero {
                    name
                    # Queries can have comments!
                    friends(a:""foo"" b: 123456 c:null d:     true) {
                        name
                    }
                }
            }".NormalizeLineBreaks());

            // act
            var parser = new Utf8GraphQLParser(
                sourceText, ParserOptions.Default);
            DocumentNode document = parser.Parse();

            // assert
            document.MatchSnapshot();
            QuerySyntaxSerializer.Serialize(document)
            .MatchSnapshot(new SnapshotNameExtension("serialized"));
        }