public void OneGraph_Schema() { // arrange byte[] sourceText = Encoding.UTF8.GetBytes(FileResource.Open("onegraph.graphql")); // act DocumentNode document = Utf8GraphQLParser.Parse(sourceText); // assert document.ToString().MatchSnapshot(); }
public void ParserScalarType() { // arrange var sourceText = "scalar FOO @foo(a: \"123\")"; var parser = new Utf8GraphQLParser( Encoding.UTF8.GetBytes(sourceText)); // act DocumentNode document = parser.Parse(); // assert document.ToString().MatchSnapshot(); }
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(); }
public void ParseUnion() { // arrange var sourceText = "union Foo @foo(a: \"123\") = " + "BAR | BAZ "; var parser = new Utf8GraphQLParser( Encoding.UTF8.GetBytes(sourceText)); // act DocumentNode document = parser.Parse(); // assert document.ToString().MatchSnapshot(); }
public void ParseEnum() { // arrange var sourceText = "enum Foo @foo(a: \"123\") " + "{ BAR @foo(a: 123) , BAZ }"; var parser = new Utf8GraphQLParser( Encoding.UTF8.GetBytes(sourceText)); // act DocumentNode document = parser.Parse(); // assert document.ToString().MatchSnapshot(); }
public void ParserInputObjectType() { // arrange var sourceText = "input a @foo(a: \"123\") " + "{ b: String @foo(a: \"123\") c: Int = 123 }"; var parser = new Utf8GraphQLParser( Encoding.UTF8.GetBytes(sourceText)); // act DocumentNode document = parser.Parse(); // assert document.ToString().MatchSnapshot(); }
public void ParserSimpleInterfaceType() { // arrange var 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 document.ToString().MatchSnapshot(); }
public void ParseSchemaDefinition() { // arrange var sourceText = "\"\"\"\nDescription\n\"\"\"" + "schema @foo(a: \"123\") " + "{ query: Foo mutation: Bar subscription: Baz }"; var parser = new Utf8GraphQLParser( Encoding.UTF8.GetBytes(sourceText)); // act DocumentNode document = parser.Parse(); // assert document.ToString().MatchSnapshot(); }
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(); }