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 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); }