public static async Task AssertBalance(SDK.CentaurusClient client, int assetId, long amount, long liabilities)
        {
            Func <Task <bool> > func = async() =>
            {
                await client.UpdateAccountData();

                var balance = client.AccountData.GetBalances().First(a => a.AssetId == assetId);
                return(balance.Amount == amount && balance.Liabilities == liabilities);
            };

            await AssertDuringPeriod(
                func,
                TimeSpan.FromSeconds(1),
                $"Balance is not equal to expected."
                );
        }
        public static async Task <List <SDK.CentaurusClient> > ConnectClients(this IntegrationTestEnvironment environment, List <KeyPair> clients, SDK.Models.ConstellationInfo info)
        {
            var clientConnections = new List <SDK.CentaurusClient>();

            foreach (var client in clients)
            {
                var clientConnection = new SDK.CentaurusClient(
                    new Uri(IntegrationTestEnvironment.AlphaAddress),
                    client,
                    info,
                    environment.StellarProvider,
                    environment.GetClientConnectionWrapper
                    );

                await clientConnection.Connect();

                clientConnections.Add(clientConnection);
            }
            return(clientConnections);
        }
        public static async Task AssertWithdrawal(this IntegrationTestEnvironment environment, SDK.CentaurusClient client, KeyPair keyPair, int assetId, string amount)
        {
            var balance       = client.AccountData.GetBalances().First(a => a.AssetId == assetId);
            var balanceAmount = balance.Amount;

            try
            {
                var result = await client.Withdrawal(keyPair, amount, environment.SDKConstellationInfo.Assets.First(a => a.Id == assetId));

                environment.AssertFinalize(result);
                AsserResult(result, ResultStatusCodes.Success);
                await AssertBalance(client, assetId, balanceAmount - Amount.ToXdr(amount), 0);
            }
            catch (Exception exc)
            {
                Assert.Fail(exc.Message, "Error on withdrawal.");
            }
        }