public async Task <ActionResult> SendPayment_SendBtc_NoFreeOutputs()
        {
            var emailaddress  = Session["Email_Address"];
            var walletdetails = db.AspNetUsers.Join(db.WalletDetails, u => u.Id, uir => uir.UserId, (u, uir) => new { u, uir }).Where(w => w.u.Email == emailaddress.ToString()).Select(s => new { s.uir.Address, s.uir.GuidIdentifier }).FirstOrDefault();



            string WALLET_ID       = walletdetails.GuidIdentifier;
            string Form_Address    = walletdetails.Address;
            string WALLET_PASSWORD = "******";
            string FIRST_ADDRESS   = "16RQNCzpCQAyTQkj2Bp43vuBu5D822bGAn";



            ServerApiException apiException = await Assert.ThrowsAsync <ServerApiException>(async() =>
            {
                BlockchainHttpClient httpClient = new BlockchainHttpClient(apicode, ApiURL);
                using (BlockchainApiHelper apiHelper = new BlockchainApiHelper(apicode, httpClient, ApiURL, httpClient))
                {
                    Wallet wallet = apiHelper.InitializeWallet(WALLET_ID, WALLET_PASSWORD);
                    await wallet.SendAsync(FIRST_ADDRESS, BitcoinValue.FromBtc(1), Form_Address, BitcoinValue.FromBtc(0));
                }
            });

            Assert.Contains("No free", apiException.Message);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public async void Unarchive_BadAddress_ServerApiException()
        {
            ServerApiException apiException = await Assert.ThrowsAsync <ServerApiException>(async() => {
                using (BlockchainApiHelper apiHelper = new BlockchainApiHelper())
                {
                    WalletHelper walletHelper = apiHelper.CreateWalletHelper(WalletTests.WALLET_ID, WalletTests.WALLET_PASSWORD, WalletTests.WALLET_PASSWORD2);
                    await walletHelper.UnarchiveAddress("BadAddress");
                }
            });

            Assert.Contains("Checksum", apiException.Message);
        }
Exemplo n.º 3
0
        public async void SendPayment_SendBtc_NoFreeOutputs()
        {
            ServerApiException apiException = await Assert.ThrowsAsync <ServerApiException>(async() => {
                using (BlockchainApiHelper apiHelper = new BlockchainApiHelper())
                {
                    WalletHelper walletHelper = apiHelper.CreateWalletHelper(WalletTests.WALLET_ID, WalletTests.WALLET_PASSWORD, WalletTests.WALLET_PASSWORD2);
                    await walletHelper.SendAsync(WalletTests.FIRST_ADDRESS, BitcoinValue.FromBtc(1));
                }
            });

            Assert.Contains("No free", apiException.Message);
        }
        public async void PushTransaction_BadTransaction_ServerError()
        {
            //Dont want to add transactions, check to see if the server responds
            ServerApiException serverApiException = await Assert.ThrowsAsync <ServerApiException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = new BlockchainApiHelper())
                {
                    await apiHelper.TransactionPusher.PushTransactionAsync("Test");
                }
            });

            Assert.Contains("Parse", serverApiException.Message);
        }
Exemplo n.º 5
0
        public async void ArchiveAddress_BadAddress_ServerApiException()
        {
            ServerApiException apiException = await Assert.ThrowsAsync <ServerApiException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = new BlockchainApiHelper())
                {
                    Wallet.Wallet wallet = apiHelper.InitializeWallet(WalletTests.WALLET_ID, WalletTests.WALLET_PASSWORD,
                                                                      WalletTests.WALLET_PASSWORD2);
                    await wallet.ArchiveAddressAsync("badAddress");
                }
            });

            Assert.Contains("Checksum", apiException.Message);
        }
Exemplo n.º 6
0
        public async void SendPayment_SendMultiBtc_NoFreeOutputs()
        {
            ServerApiException apiException = await Assert.ThrowsAsync <ServerApiException>(async() => {
                using (BlockchainApiHelper apiHelper = new BlockchainApiHelper())
                {
                    WalletHelper walletHelper = apiHelper.CreateWalletHelper(WalletTests.WALLET_ID, WalletTests.WALLET_PASSWORD, WalletTests.WALLET_PASSWORD2);
                    Dictionary <string, BitcoinValue> recipients = new Dictionary <string, BitcoinValue>()
                    {
                        { "17VYDFsDxBMovM1cKGEytgeqdijNcr4L5", BitcoinValue.FromBtc(1) }
                    };
                    await walletHelper.SendManyAsync(recipients);
                }
            });

            Assert.Contains("No free", apiException.Message);
        }