public void ParallelAttributeWillBeHonored(ExecutionStrategy defaultStrategy) { // arrange ISchema schema = SchemaBuilder.New() .AddQueryType <ParallelQuery>() .Create(); DocumentNode document = Utf8GraphQLParser.Parse( @"{ foo }"); OperationDefinitionNode operationDefinition = document.Definitions.OfType <OperationDefinitionNode>().Single(); IPreparedOperation operation = OperationCompiler.Compile( "a", document, operationDefinition, schema, schema.QueryType, new(new DefaultTypeConverter())); // act QueryPlanNode root = QueryPlanBuilder.Prepare(operation); // assert Snapshot(root, defaultStrategy); }
public void ExtendedRootTypesWillHonorGlobalSerialSetting(ExecutionStrategy defaultStrategy) { // arrange ISchema schema = SchemaBuilder.New() .AddQueryType(c => c.Name(OperationTypeNames.Query)) .AddType <BarQueries>() .ModifyOptions(o => o.DefaultResolverStrategy = defaultStrategy) .Create(); DocumentNode document = Utf8GraphQLParser.Parse( @"{ bars }"); OperationDefinitionNode operationDefinition = document.Definitions.OfType <OperationDefinitionNode>().Single(); IPreparedOperation operation = OperationCompiler.Compile( "a", document, operationDefinition, schema, schema.QueryType, new(new DefaultTypeConverter())); // act QueryPlanNode root = QueryPlanBuilder.Prepare(operation); // assert Snapshot(root, defaultStrategy); }
public void CreateReviewForEpisode_Plan(ExecutionStrategy defaultStrategy) { // arrange ISchema schema = SchemaBuilder.New() .AddStarWarsTypes() .ModifyOptions(o => o.DefaultResolverStrategy = defaultStrategy) .Create(); DocumentNode document = Utf8GraphQLParser.Parse( @"mutation CreateReviewForEpisode( $ep: Episode!, $review: ReviewInput!) { createReview(episode: $ep, review: $review) { stars commentary } }"); OperationDefinitionNode operationDefinition = document.Definitions.OfType <OperationDefinitionNode>().Single(); IPreparedOperation operation = OperationCompiler.Compile( "a", document, operationDefinition, schema, schema.MutationType !, new(new DefaultTypeConverter())); // act QueryPlanNode root = QueryPlanBuilder.Prepare(operation); // assert Snapshot(root, defaultStrategy); }
public ResolverNode( ISelection first, ISelection?firstParent = null, ExecutionStrategy?strategy = null) : base(strategy ?? QueryPlanBuilder.GetStrategyFromSelection(first)) { First = first; FirstParent = firstParent; Selections.Add(first); }
public void GetHero_Root_Deferred_Plan(ExecutionStrategy defaultStrategy) { // arrange ISchema schema = SchemaBuilder.New() .AddStarWarsTypes() .ModifyOptions(o => o.DefaultResolverStrategy = defaultStrategy) .Create(); DocumentNode document = Utf8GraphQLParser.Parse( @"query GetHero($episode: Episode, $withFriends: Boolean!) { ... @defer { hero(episode: $episode) { name friends @include(if: $withFriends) { nodes { id } } } } a: hero(episode: $episode) { name friends @include(if: $withFriends) { nodes { id } } } }"); OperationDefinitionNode operationDefinition = document.Definitions.OfType <OperationDefinitionNode>().Single(); IPreparedOperation operation = OperationCompiler.Compile( "a", document, operationDefinition, schema, schema.QueryType, new(new DefaultTypeConverter())); // act QueryPlanNode root = QueryPlanBuilder.Prepare(operation); // assert Snapshot(root, defaultStrategy); }
public void GetHero_Stream_Plan_Nested_Streams(ExecutionStrategy defaultStrategy) { // arrange ISchema schema = SchemaBuilder.New() .AddStarWarsTypes() .ModifyOptions(o => o.DefaultResolverStrategy = defaultStrategy) .Create(); DocumentNode document = Utf8GraphQLParser.Parse( @"{ hero(episode: NEW_HOPE) { id ... @defer(label: ""friends"") { friends { nodes @stream(initialCount: 1) { id name friends { nodes @stream(initialCount: 1) { id name } } } } } } }"); OperationDefinitionNode operationDefinition = document.Definitions.OfType <OperationDefinitionNode>().Single(); IPreparedOperation operation = OperationCompiler.Compile( "a", document, operationDefinition, schema, schema.QueryType, new(new DefaultTypeConverter())); // act QueryPlanNode root = QueryPlanBuilder.Prepare(operation); // assert Snapshot(root, defaultStrategy); }
public void TypeNameFieldsInMutations() { // arrange ISchema schema = SchemaBuilder.New() .AddDocumentFromString(@" type Query { foo: String } type Mutation { bar: Bar } type Bar { test: String } ") .Use(next => next) .Create(); DocumentNode document = Utf8GraphQLParser.Parse( @"mutation { bar { test __typename } }"); OperationDefinitionNode operationDefinition = document.Definitions.OfType <OperationDefinitionNode>().Single(); IPreparedOperation operation = OperationCompiler.Compile( "a", document, operationDefinition, schema, schema.MutationType !, new(new DefaultTypeConverter())); // act QueryPlanNode root = QueryPlanBuilder.Prepare(operation); // assert Snapshot(root); }