private Autogenerated.GetBulkStateResponse MakeGetBulkStateResponse<T>(string key, T state) { var data = TypeConverters.ToJsonByteString(state, new JsonSerializerOptions(JsonSerializerDefaults.Web)); var response = new Autogenerated.GetBulkStateResponse { Items = { new Autogenerated.BulkStateItem() { Key = key, Data = data, } } }; return response; }
private async void SendResponseWithBulkState(string key, string state, TestHttpClient.Entry entry) { var stateDate = TypeConverters.ToJsonByteString(state); var bulkResponse = new Autogenerated.GetBulkStateResponse(); bulkResponse.Items.Add(new Autogenerated.BulkStateItem() { Key = key, Data = ByteString.CopyFromUtf8(state) }); var streamContent = await GrpcUtils.CreateResponseContent(bulkResponse); var response = GrpcUtils.CreateResponse(HttpStatusCode.OK, streamContent); entry.Completion.SetResult(response); }