public async Task ShouldListenForAResponse(
                Snowflake recipientId,
                Endpoint endpoint,
                object request,
                Dictionary <string, string> parameters,
                Dictionary <string, string> headers,
                [Frozen, Substitute] IResponseService server,
                [Target] DefaultDiscordRequestHandler handler,
                CancellationToken cancellationToken
                )
            {
                await handler.Handle <object, object>(endpoint, request, parameters, headers, cancellationToken);

                await server.Received().ListenForResponse(Any <Guid>(), Any <TaskCompletionSource <Response> >());
            }
            public async Task ShouldQueueARequestWithNoResponseURL(
                Snowflake recipientId,
                Endpoint endpoint,
                object request,
                Dictionary <string, string> parameters,
                Dictionary <string, string> headers,
                [Frozen, Substitute] IResponseService server,
                [Frozen, Substitute] IRequestQueuer queuer,
                [Target] DefaultDiscordRequestHandler handler,
                CancellationToken cancellationToken
                )
            {
                await handler.Handle(endpoint, request, parameters, headers, cancellationToken);

                await queuer.Received().QueueRequest(Is <Request>(req => req.ResponseURL == null), Is(cancellationToken));
            }
            public async Task ShouldQueueARequestWithTheParameters(
                Snowflake recipientId,
                Endpoint endpoint,
                object request,
                Dictionary <string, string> parameters,
                Dictionary <string, string> headers,
                [Frozen, Substitute] IResponseService server,
                [Frozen, Substitute] IRequestQueuer queuer,
                [Target] DefaultDiscordRequestHandler handler,
                CancellationToken cancellationToken
                )
            {
                await handler.Handle(endpoint, request, parameters, headers, cancellationToken);

                await queuer.Received().QueueRequest(Any <Request>(), Is(cancellationToken));

                var receivedRequest = TestUtils.GetArg <Request>(queuer, nameof(IRequestQueuer.QueueRequest), 0);

                receivedRequest.Parameters.Should().BeEquivalentTo(parameters);
            }
            public async Task ShouldDeserializeAndReturnResponse(
                Snowflake recipientId,
                Endpoint endpoint,
                object request,
                object deserializedResponse,
                Dictionary <string, string> parameters,
                Dictionary <string, string> headers,
                [Frozen] Response response,
                [Frozen, Substitute] ISerializer serializer,
                [Frozen, Substitute] IResponseService server,
                [Target] DefaultDiscordRequestHandler handler,
                CancellationToken cancellationToken
                )
            {
                serializer.Deserialize <object>(Any <string>()).Returns(response);
                var result = await handler.Handle <object, object>(endpoint, request, parameters, headers, cancellationToken);

                result.Should().Be(response);
                serializer.Received().Deserialize <object>(Is(response.Body !));
            }
            public async Task ShouldQueueARequestWithTheSerializedBody(
                Snowflake recipientId,
                Endpoint endpoint,
                object request,
                string body,
                Dictionary <string, string> parameters,
                Dictionary <string, string> headers,
                [Frozen, Substitute] ISerializer serializer,
                [Frozen, Substitute] IResponseService server,
                [Frozen, Substitute] IRequestQueuer queuer,
                [Target] DefaultDiscordRequestHandler handler,
                CancellationToken cancellationToken
                )
            {
                serializer.Serialize(Any <object>()).Returns(body);
                await handler.Handle <object, object>(endpoint, request, parameters, headers, cancellationToken);

                await queuer.Received().QueueRequest(Any <Request>(), Is(cancellationToken));

                var receivedRequest = TestUtils.GetArg <Request>(queuer, nameof(IRequestQueuer.QueueRequest), 0);

                receivedRequest.RequestBody.Should().Be(body);
            }