예제 #1
0
        public void ParserScalarType()
        {
            // arrange
            string sourceText = "scalar FOO @foo(a: \"123\")";
            var    parser     = new Parser();

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

            // assert
            SchemaSyntaxSerializer.Serialize(document).MatchSnapshot();
        }
예제 #2
0
        public void ParserScalarType()
        {
            // arrange
            string sourceText = "scalar FOO @foo(a: \"123\")";
            var    parser     = new Utf8GraphQLParser(
                Encoding.UTF8.GetBytes(sourceText));

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

            // assert
            SchemaSyntaxSerializer.Serialize(document).MatchSnapshot();
        }
예제 #3
0
        public void ParseUnion_LeadingPipe()
        {
            // arrange
            string sourceText = "union Foo @foo(a: \"123\") = "
                                + "| BAR | BAZ ";
            var parser = new Parser();

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

            // assert
            SchemaSyntaxSerializer.Serialize(document).MatchSnapshot();
        }
예제 #4
0
        public void ParseEnum()
        {
            // arrange
            string sourceText = "enum Foo @foo(a: \"123\") "
                                + "{ BAR @foo(a: 123) , BAZ }";
            var parser = new Parser();

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

            // assert
            SchemaSyntaxSerializer.Serialize(document).MatchSnapshot();
        }
예제 #5
0
        public void ParserInputObjectType()
        {
            // arrange
            string sourceText = "input a @foo(a: \"123\") " +
                                "{ b: String @foo(a: \"123\") c: Int = 123 }";
            var parser = new Parser();

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

            // assert
            SchemaSyntaxSerializer.Serialize(document).MatchSnapshot();
        }
예제 #6
0
        public void ParseUnion()
        {
            // arrange
            string sourceText = "union Foo @foo(a: \"123\") = "
                                + "BAR | BAZ ";
            var parser = new Utf8GraphQLParser(
                Encoding.UTF8.GetBytes(sourceText));

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

            // assert
            SchemaSyntaxSerializer.Serialize(document).MatchSnapshot();
        }
예제 #7
0
        public void ParserSimpleObjectType()
        {
            // arrange
            string sourceText = "type a @foo(a: \"123\") " +
                                "{ b: String @foo(a: \"123\") " +
                                "c(d: F = ENUMVALUE @foo(a: \"123\")): Int }";
            var parser = new Parser();

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

            // assert
            SchemaSyntaxSerializer.Serialize(document).MatchSnapshot();
        }
예제 #8
0
        public void ParseSchemaDefinition()
        {
            // arrange
            string sourceText = "\"\"\"\nDescription\n\"\"\"" +
                                "schema @foo(a: \"123\") " +
                                "{ query: Foo mutation: Bar subscription: Baz }";
            var parser = new Parser();

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

            // assert
            SchemaSyntaxSerializer.Serialize(document).MatchSnapshot();
        }
예제 #9
0
        public void ParserSimpleInterfaceType()
        {
            // arrange
            string sourceText = "interface a implements e @foo(a: \"123\") " +
                                "{ b: String @foo(a: \"123\") " +
                                "c(d: F = ENUMVALUE @foo(a: \"123\")): Int }";
            var parser = new Utf8GraphQLParser(
                Encoding.UTF8.GetBytes(sourceText));

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

            // assert
            SchemaSyntaxSerializer.Serialize(document).MatchSnapshot();
        }
예제 #10
0
        public void ParseFacebookKitchenSinkSchema()
        {
            // arrange
            string schemaSource = FileResource.Open(
                "schema-kitchen-sink.graphql");
            var parser = new Utf8GraphQLParser(
                Encoding.UTF8.GetBytes(schemaSource));

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

            // assert
            SchemaSyntaxSerializer.Serialize(document)
            .MatchSnapshot(new SnapshotNameExtension("sdl"));
            document.MatchSnapshot();
        }