public static async Task DependendRequestsExample(Math.IMathClient client) { var numbers = new List <Num> { new Num.Builder { Num_ = 1 }.Build(), new Num.Builder { Num_ = 2 }.Build(), new Num.Builder { Num_ = 3 }.Build() }; Num sum; using (var sumCall = client.Sum()) { await sumCall.RequestStream.WriteAll(numbers); sum = await sumCall.Result; } DivReply result = await client.DivAsync(new DivArgs.Builder { Dividend = sum.Num_, Divisor = numbers.Count }.Build()); Console.WriteLine("Avg Result: " + result); }
public void Sum() { Task.Run(async() => { 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(); }
public static async Task SumExample(Math.IMathClient stub) { var numbers = new List <Num> { new Num.Builder { Num_ = 1 }.Build(), new Num.Builder { Num_ = 2 }.Build(), new Num.Builder { Num_ = 3 }.Build() }; var call = stub.Sum(); await call.RequestStream.WriteAll(numbers); Console.WriteLine("Sum Result: " + await call.Result); }
public static async Task SumExample(Math.IMathClient client) { var numbers = new List <Num> { new Num { Num_ = 1 }, new Num { Num_ = 2 }, new Num { Num_ = 3 } }; using (var call = client.Sum()) { await call.RequestStream.WriteAllAsync(numbers); Console.WriteLine("Sum Result: " + await call.ResponseAsync); } }