public async Task TestManageAccountViewModelChangePassword()
        {
            UserKeyPair key1 = new UserKeyPair(EmailAddress.Parse("*****@*****.**"), 512);
            UserKeyPair key2 = new UserKeyPair(EmailAddress.Parse("*****@*****.**"), 512);

            var mockUserAsymmetricKeysStore = new Mock <AccountStorage>((IAccountService)null);

            mockUserAsymmetricKeysStore.Setup <Task <IEnumerable <UserKeyPair> > >(f => f.AllKeyPairsAsync()).Returns(Task.FromResult((IEnumerable <UserKeyPair>) new UserKeyPair[] { key1, key2 }));
            string passphraseUsed = String.Empty;

            mockUserAsymmetricKeysStore.Setup(f => f.ChangePassphraseAsync(It.IsAny <Passphrase>()))
            .Callback <Passphrase>((passphrase) =>
            {
                passphraseUsed = passphrase.Text;
            }).Returns(Task.FromResult(true));

            ManageAccountViewModel viewModel = await ManageAccountViewModel.CreateAsync(mockUserAsymmetricKeysStore.Object);

            IEnumerable <AccountProperties> emailsList = null;

            viewModel.BindPropertyChanged(nameof(ManageAccountViewModel.AccountProperties), (IEnumerable <AccountProperties> emails) => emailsList = emails);
            Assert.That(emailsList.Count(), Is.EqualTo(2), "There should be two accounts now.");
            Assert.That(emailsList.First().EmailAddress, Is.EqualTo("*****@*****.**"), "The first should be '*****@*****.**'");
            Assert.That(emailsList.Last().EmailAddress, Is.EqualTo("*****@*****.**"), "The last should be '*****@*****.**'");

            await viewModel.ChangePassphraseAsync.ExecuteAsync("allan").Free();

            Assert.That(passphraseUsed, Is.EqualTo("allan"));
        }
        public static async Task <ManageAccountDialog> CreateAsync(Form parent)
        {
            ManageAccountDialog mad = new ManageAccountDialog();

            mad.InitializeStyle(parent);

            AccountStorage userKeyPairs = new AccountStorage(New <LogOnIdentity, IAccountService>(Resolve.KnownIdentities.DefaultEncryptionIdentity));

            mad._viewModel = await ManageAccountViewModel.CreateAsync(userKeyPairs);

            mad._viewModel.BindPropertyChanged <IEnumerable <AccountProperties> >(nameof(ManageAccountViewModel.AccountProperties), mad.ListAccountEmails);

            return(mad);
        }