Esempio n. 1
0
        public async Task DuplexStreamingNativeCall(string channelName)
        {
            var client   = new Greeter.GreeterClient(GetChannel(channelName));
            var response = new List <string>();

            using (var call = client.DuplexStreaming(CompatibilityToolsTestExtensions.SerializeMethodInput(ProtobufMarshallerFactory.Default, "Hello")))
            {
                var responseHeaders = await call.ResponseHeadersAsync.ConfigureAwait(false);

                CompatibilityToolsTestExtensions.DeserializeMethodOutput <string>(ProtobufMarshallerFactory.Default, responseHeaders).ShouldBe("Hello");

                foreach (var name in new[] { "person 1", "person 2" })
                {
                    await call.RequestStream.WriteAsync(new HelloRequest { Name = name });
                }

                await call.RequestStream.CompleteAsync();

                while (await call.ResponseStream.MoveNext(default))