Skip to content

Testing Subscriptions with Microsoft.AspNetCore.Mvc.Testing #675

@LukeSawyers

Description

@LukeSawyers

GraphQLHttpClient works really well for writing integration tests for queries and mutations:

var client = _factory.CreateClient();
var opts = new GraphQLHttpClientOptions { EndPoint = new Uri(client.BaseAddress!, "graphql") };

Client = new GraphQLHttpClient(opts, new SystemTextJsonSerializer(), client);

However it falls short on subscriptions. GraphQLHttpWebSocket is internal and does not seem to accept an injected socket or a factory so using it with _factory.Server.CreateWebSocketClient() isn't feasible.

It would be great if this were possible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions