public void WithdrawVakacoin()
        {
            var walletRepository =
                _vakapayRepositoryFactory.GetWalletRepository(_vakapayRepositoryFactory.GetOldConnection());
            var userRepo = _vakapayRepositoryFactory.GetUserRepository(_vakapayRepositoryFactory.GetOldConnection());
            var wallet   = walletRepository.FindByUserAndNetwork(
                userRepo.FindByEmailAddress("*****@*****.**").Id,
                CryptoCurrency.VAKA);

            var res = _walletBusiness.Withdraw(wallet, "useraaaaaaab", (decimal)0.0001, 0);

            Assert.AreEqual(res.Status, Status.STATUS_SUCCESS);
        }
        public void AfterLogin()
        {
            Console.WriteLine("start");
            var repositoryConfig = new RepositoryConfiguration
            {
                ConnectionString = AppSettingHelper.GetDbConnection()
            };

            Console.WriteLine("New Address");
            PersistenceFactory = new VakapayRepositoryMysqlPersistenceFactory(repositoryConfig);
            var userBus        = new UserBusiness.UserBusiness(PersistenceFactory);
            var walletBusiness = new WalletBusiness.WalletBusiness(PersistenceFactory);
            var userRepo       = PersistenceFactory.GetUserRepository(PersistenceFactory.GetOldConnection());

            var resultCreated = userBus.Login(
                new User {
                Email = "*****@*****.**", PhoneNumber = "+84988478266", FullName = "Ngo Ngoc Huan"
            });

            walletBusiness.MakeAllWalletForNewUser(userRepo.FindByEmailAddress("*****@*****.**"));
            Console.WriteLine(JsonHelper.SerializeObject(resultCreated));
            Assert.IsNotNull(resultCreated);

            resultCreated = userBus.Login(
                new User
            {
                Email = "*****@*****.**", PhoneNumber = "+84965995710", FullName = "Tieu Thanh Liem"
            });
            walletBusiness.MakeAllWalletForNewUser(userRepo.FindByEmailAddress("*****@*****.**"));
            Console.WriteLine(JsonHelper.SerializeObject(resultCreated));
            Assert.IsNotNull(resultCreated);
        }
        public void InitFakeAddressAndCoin()
        {
            var repositoryConfig = new RepositoryConfiguration
            {
                ConnectionString = AppSettingHelper.GetDbConnection()
            };

            //Create user active for test
            var persistenceFactory = new VakapayRepositoryMysqlPersistenceFactory(repositoryConfig);
            var connection         = persistenceFactory.GetDbConnection();
            var userRepo           = persistenceFactory.GetUserRepository(connection);
            var walletRepo         = persistenceFactory.GetWalletRepository(connection);


            //fake userId
            for (int i = 1; i < 10; i++)
            {
                var ins = userRepo.Insert(
                    new User()
                {
                    Id     = i.ToString(),
                    Status = "Active"
                }
                    );
                Assert.AreEqual(Status.STATUS_SUCCESS, ins.Status);
            }

            //create wallet without address
            for (int i = 1; i < 10; i++)
            {
                CreateAllWalletForUser(i.ToString());
            }

            //insert address into WalletDb
            // and insert to ethereumAddress
            for (int i = 1; i < 10; i++)
            {
                var prepareWallet = walletRepo.FindByUserAndNetwork(i.ToString(), CryptoCurrency.ETH);
                CreateNewAddressAsync(prepareWallet.Id);
            }

            //send coin from rootAddress to new address
            for (int i = 1; i < 10; i++)
            {
                var prepareWallet = walletRepo.FindByUserAndNetwork(i.ToString(), CryptoCurrency.ETH);
                //Todo update prepareWallet.Address
                //				InsertPendingTxsToWithdraw("46b4594c-a45a-400d-86ce-9a7869d61180", prepareWallet.Address);
            }
        }