public void ProcessShowBalances_ShouldReturnBalanceForAGivenWallet()
        {
            // Arrange
            const string walletContents = "{ \"EncryptedSeed\": \"6PYM714zxNRpmx7WRaCLNJyAreYx2BU5GkbCx5jF5QQNKeZExYqrNHzK8L\",\"ChainCode\": \"CarQU+owbi2iML7Fy5vf+6O0Lpc/V//NFkk7WLVkh70=\",\"Network\": \"Main\",\"CreationTime\": \"2019-07-18\"}";

            const string walletDirectoryName = "Wallets";
            const string walletFileName      = "wallet_show_balances_test.json";
            var          walletFilePath      = Path.Combine(walletDirectoryName, walletFileName);

            Directory.CreateDirectory(walletDirectoryName);
            using (File.Create(walletFilePath))
            {
            }

            File.WriteAllText(walletFilePath, walletContents);
            File.Exists(walletFilePath).Should().BeTrue();

            var args = new[]
            {
                $"wallet-file={walletFileName}",
            };

            var password = new SecureString();

            password.AppendChar('p');
            password.AppendChar('a');
            password.AppendChar('s');
            password.AppendChar('s');
            password.AppendChar('w');
            password.AppendChar('o');
            password.AppendChar('r');
            password.AppendChar('d');
            IBitcoinLibrary bitcoinLibrary = new BitcoinLibrary();

            var expectedResult = "Address Key - 12aTk1fcxq2Sa8xpwDyRWVK6pg8RfDzp51:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 1An8cCNwNKkZExStUdtuav5XoUPnFTeS32:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 17vghiDiZYcpFDgT7FL7wf9NiqFiGyaiWU:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 1AZ8mMSmfwyt6RoKU8VvzodbaW7QaTgPL3:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 1Prgw1SJF53Qcgmn2YQ4F8suZN9wPZnU7y:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 1JU6L1iKYqgEdBdqfGQ4vx1DD2DRq84Hg7:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 1HLzcWeRRF8dGitVpwVHw2VRr7jzPr1Fdy:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 1BeVydLDbof2jv6upkwm1HdcgDjfUbWo9s:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 1AP64gCEBt1MHtXdAFKwcaEpBKaWAm2Yhb:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 16DsRYBAVukyC45bWvRki83yTx3djztScq:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 16QWEMqjXTaPkxBPtQP8CHvQm7D2q9jc5m:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 1EhYAoGP9gbA5tVi7dNqi5vHRCrgzZgnU:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 18vwHHkvGGBh2SaeniWKUf9PLo7kRim9XQ:  Confirmed Balance: 0.  Unconfirmed Balance: 0! Address Key - 1BiutrFMyx7H8kLBAJAXLduNEWQTnTJ3Ca:  Confirmed Balance: 0.  Unconfirmed Balance: 0! ";

            try
            {
                // Act
                var result = bitcoinLibrary.ShowBalances(args, password);

                result.Should().Be(expectedResult);
            }
            catch (IncorrectWalletPasswordException ex)
            {
                // Assert
                ex.Message.Should().Contain("Provided password is incorrect.");
            }

            // Clean up
            Directory.Delete(walletDirectoryName, true);
            File.Delete(walletFileName);
        }
        public void ProcessShowBalances_ShouldThrowCustomExceptionForAnIncorrectPassword()
        {
            // Arrange
            const string walletContents = "{ \"EncryptedSeed\": \"6PYM714zxNRpmx7WRaCLNJyAreYx2BU5GkbCx5jF5QQNKeZExYqrNHzK8L\",\"ChainCode\": \"CarQU+owbi2iML7Fy5vf+6O0Lpc/V//NFkk7WLVkh70=\",\"Network\": \"Main\",\"CreationTime\": \"2019-07-18\"}";

            const string walletDirectoryName = "Wallets";
            const string walletFileName      = "wallet_show_balances_test.json";
            var          walletFilePath      = Path.Combine(walletDirectoryName, walletFileName);

            Directory.CreateDirectory(walletDirectoryName);
            using (File.Create(walletFilePath))
            {
            }

            var args = new[]
            {
                $"wallet-file={walletFileName}",
            };

            File.WriteAllText(walletFilePath, walletContents);
            File.Exists(walletFilePath).Should().BeTrue();

            var password = new SecureString(); // Incorrect password.

            password.AppendChar('p');
            IBitcoinLibrary bitcoinLibrary = new BitcoinLibrary();

            try
            {
                // Act
                bitcoinLibrary.ShowBalances(args, password);

                // Should not get here - force a fail if we do
                bitcoinLibrary.Should().BeNull();
            }
            catch (IncorrectWalletPasswordException ex)
            {
                // Assert
                ex.Message.Should().Contain("Provided password is incorrect.");
            }

            // Clean up
            Directory.Delete(walletDirectoryName, true);
            File.Delete(walletFileName);
        }
        public void ProcessShowBalances_ShouldThrowACustomExceptionWhenAGivenWalletIsMissing()
        {
            // Arrange
            const string walletFileName = "wallet_show_balances_test.json";

            var args = new[]
            {
                $"wallet-file={walletFileName}",
            };

            var password = new SecureString();

            password.AppendChar('p');
            password.AppendChar('a');
            password.AppendChar('s');
            password.AppendChar('s');
            password.AppendChar('w');
            password.AppendChar('o');
            password.AppendChar('r');
            password.AppendChar('d');
            IBitcoinLibrary bitcoinLibrary = new BitcoinLibrary();

            try
            {
                // Act
                bitcoinLibrary.ShowBalances(args, password);

                // Should not get here - force a fail if we do
                bitcoinLibrary.Should().BeNull();
            }
            catch (WalletNotFoundException ex)
            {
                // Assert
                ex.Message.Should().Contain("Wallet not found: ");
            }
        }