protected override async Task WhenAsync() { await using (_testServer.Start() .ConfigureAwait(false)) { var client = await _testServer .CreateRequestClientAsync() .ConfigureAwait(false); var requestPayload = new RequestPayload( new RequestHeader(RequestHeader.MaxVersion) .WithRequestApiKey(ApiVersionsRequest.ApiKey) .WithRequestApiVersion( ApiVersionsRequest.MaxVersion) .WithCorrelationId(Int32.From(12)), new ApiVersionsRequest(ApiVersionsRequest.MaxVersion)); await client .SendAsync(requestPayload) .ConfigureAwait(false); _response = await client .ReadAsync(requestPayload) .ConfigureAwait(false); } }
protected override Task GivenAsync() { _testServer.On <ApiVersionsRequest, ApiVersionsResponse>( request => request.Respond() .WithThrottleTimeMs(Int32.From(100)) .WithApiKeysCollection( key => key .WithIndex(FetchRequest.ApiKey) .WithMinVersion(FetchRequest.MinVersion) .WithMaxVersion(FetchRequest.MaxVersion))); return(Task.CompletedTask); }
The_subscription_should_receive_a_api_versions_response_with_throttle_time() { _response.Message.As <ApiVersionsResponse>() .ThrottleTimeMs.Should().Be(Int32.From(100)); }
The_subscription_should_receive_a_api_versions_response_with_correlation_id() { _response.Header.CorrelationId.Should().Be(Int32.From(12)); }