示例#1
0
 public async void ArchiveAddress_NullAddress_ArgumentNullException()
 {
     await Assert.ThrowsAsync <ArgumentNullException>(async() =>
     {
         using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
         {
             Wallet.Wallet wallet = GetWallet(apiHelper);
             await wallet.ArchiveAddress(null);
         }
     });
 }
        public async void ArchiveAddress_BadAddress_ServerApiException()
        {
            ServerApiException apiException = await Assert.ThrowsAsync <ServerApiException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = new BlockchainApiHelper())
                {
                    Wallet.Wallet wallet = apiHelper.CreateWallet(WalletTests.WALLET_ID, WalletTests.WALLET_PASSWORD,
                                                                  WalletTests.WALLET_PASSWORD2);
                    await wallet.ArchiveAddress("badAddress");
                }
            });

            Assert.Contains("Checksum", apiException.Message);
        }
        public async void NewAddress_ArchiveThenConsolidate_Valid()
        {
            using (BlockchainApiHelper apiHelper = new BlockchainApiHelper())
            {
                Wallet.Wallet wallet  = apiHelper.CreateWallet(WalletTests.WALLET_ID, WalletTests.WALLET_PASSWORD, WalletTests.WALLET_PASSWORD2);
                WalletAddress address = await wallet.NewAddress("Test");

                Assert.NotNull(address);

                string archivedAddress = await wallet.ArchiveAddress(address.AddressStr);

                Assert.NotNull(archivedAddress);


                string unarchivedAddress = await wallet.UnarchiveAddress(archivedAddress);

                Assert.NotNull(unarchivedAddress);
            }
        }