Ejemplo n.º 1
0
        public async Task Sum()
        {
            using (var call = client.Sum())
            {
                var numbers = new List <long> {
                    10, 20, 30
                }.ConvertAll(
                    n => Num.CreateBuilder().SetNum_(n).Build());

                await call.RequestStream.WriteAllAsync(numbers);

                var result = await call.ResponseAsync;
                Assert.AreEqual(60, result.Num_);
            }
        }
Ejemplo n.º 2
0
        public async Task Sum()
        {
            using (var call = client.Sum())
            {
                var numbers = new List <long> {
                    10, 20, 30
                }.Select(n => new Num {
                    Num_ = n
                });

                await call.RequestStream.WriteAllAsync(numbers);

                var result = await call.ResponseAsync;
                Assert.AreEqual(60, result.Num_);
            }
        }
Ejemplo n.º 3
0
        public void Sum()
        {
            Task.Run(async() =>
            {
                using (var call = client.Sum())
                {
                    var numbers = new List <long> {
                        10, 20, 30
                    }.ConvertAll(
                        n => Num.CreateBuilder().SetNum_(n).Build());

                    await call.RequestStream.WriteAll(numbers);
                    var result = await call.Result;
                    Assert.AreEqual(60, result.Num_);
                }
            }).Wait();
        }