private static void AccountTester(IAccountServiceRpcClient client) { var req = new CanFillOrderRequest { Order = new Order { AccountId = "6056cfb6-a4ee-4a98-b71e-c082a732c473" }, FillQuantity = 100 }; Task <CanFillOrderResponse> resp = null; try { resp = client.CanFillOrderAsync(req).ResponseAsync; resp.Wait(); bool canFill = resp.Result.Value; Display("canFill: " + canFill); } catch (Exception e) { Display("An error occurred: " + e.Message); } Task <AccountList> listResp = null; try { listResp = client.ListAsync(new Empty()).ResponseAsync; listResp.Wait(); ICollection <Account> data = listResp.Result.Accounts; data.ToList().ForEach(account => Display(account.ToString())); } catch (Exception e) { Display("An error occurred: " + e.Message); } }
//[Authorize] public override async Task <AccountList> ListAccounts(Empty request, ServerCallContext context) { Logger.Here().Information("BGN"); // TODO: authentication try { var response = accountService.ListAsync(request); Logger.Here().Information("END"); return(await response); } catch (Exception e) { Logger.Here().Warning(e.Message); throw new RpcException(new Status(StatusCode.Internal, e.Message)); } }