Class GraphQLRequestBuilder

Namespace
ProtoTest.GraphQL
Assembly
ProtoTest.GraphQL.dll
public sealed class GraphQLRequestBuilder : ProtoHttpRequestBuilder<GraphQLResponse, GraphQLRequestBuilder>
Inheritance
GraphQLRequestBuilder
Inherited Members
Extension Methods

Methods

ConnectionPayload(object)

Sets the optional graphql-transport-ws connection_init payload.

public GraphQLRequestBuilder ConnectionPayload(object payload)

Parameters

payload object

Returns

GraphQLRequestBuilder

ExecuteAsync(CancellationToken)

public Task<GraphQLResponse> ExecuteAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<GraphQLResponse>

ExpectAsync<TShape>(TShape, CancellationToken)

Selects, executes, and matches one root field using the same response shape.

public Task<GraphQLResponse> ExpectAsync<TShape>(TShape expectedShape, CancellationToken cancellationToken = default)

Parameters

expectedShape TShape
cancellationToken CancellationToken

Returns

Task<GraphQLResponse>

Type Parameters

TShape

Mutation(string?, Action<GraphQLOperationBuilder>)

public GraphQLRequestBuilder Mutation(string? name, Action<GraphQLOperationBuilder> configure)

Parameters

name string
configure Action<GraphQLOperationBuilder>

Returns

GraphQLRequestBuilder

Mutation(string, object?, string?)

Starts a shape-driven mutation for one root field.

public GraphQLRequestBuilder Mutation(string rootField, object? arguments = null, string? operationName = null)

Parameters

rootField string
arguments object
operationName string

Returns

GraphQLRequestBuilder

OnAuthenticationConfigured(string, Type?)

Records how authentication was configured; the protocol chooses attributes or events.

protected override void OnAuthenticationConfigured(string source, Type? authenticatorType)

Parameters

source string
authenticatorType Type

OnHeaderConfigured(string, bool)

Adopts the authenticator factory resolved for the test by the lifecycle hook.

protected override void OnHeaderConfigured(string name, bool isNewHeader)

Parameters

name string
isNewHeader bool

Query(string?, Action<GraphQLOperationBuilder>)

public GraphQLRequestBuilder Query(string? name, Action<GraphQLOperationBuilder> configure)

Parameters

name string
configure Action<GraphQLOperationBuilder>

Returns

GraphQLRequestBuilder

Query(string, object?, string?)

Starts a shape-driven query for one root field.

public GraphQLRequestBuilder Query(string rootField, object? arguments = null, string? operationName = null)

Parameters

rootField string
arguments object
operationName string

Returns

GraphQLRequestBuilder

Request(string, string?)

public GraphQLRequestBuilder Request(string document, string? operationName = null)

Parameters

document string
operationName string

Returns

GraphQLRequestBuilder

Select<TShape>()

Derives the GraphQL selection set from a test-owned contract type.

public GraphQLRequestBuilder Select<TShape>()

Returns

GraphQLRequestBuilder

Type Parameters

TShape

Select<TShape>(TShape)

Derives the GraphQL selection set from an anonymous object or test-owned contract.

public GraphQLRequestBuilder Select<TShape>(TShape selectionShape)

Parameters

selectionShape TShape

Returns

GraphQLRequestBuilder

Type Parameters

TShape

SubscribeAsync(CancellationToken)

public Task<GraphQLSubscription> SubscribeAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<GraphQLSubscription>

Subscription(string?, Action<GraphQLOperationBuilder>)

public GraphQLRequestBuilder Subscription(string? name, Action<GraphQLOperationBuilder> configure)

Parameters

name string
configure Action<GraphQLOperationBuilder>

Returns

GraphQLRequestBuilder

Subscription(string, object?, string?)

Starts a shape-driven subscription for one root field.

public GraphQLRequestBuilder Subscription(string rootField, object? arguments = null, string? operationName = null)

Parameters

rootField string
arguments object
operationName string

Returns

GraphQLRequestBuilder

Variables(object)

public GraphQLRequestBuilder Variables(object variables)

Parameters

variables object

Returns

GraphQLRequestBuilder