示例#1
0
        public void EditAccount_UserCancelsInteraction_CurrentAccountRemainsUnchanged()
        {
            var currentAccountCopy = _currentSmtpAccount.Copy();

            _interactionRequest.RegisterInteractionHandler <SmtpAccountInteraction>(i =>
            {
                i.SmtpAccount.UserName = "******"; // User makes changes
                i.Success = false;                           // User cancels
            });

            _smtpAccountEditCommand.Execute(_currentSmtpAccount);

            Assert.AreEqual(_currentSmtpAccount, currentAccountCopy);
        }
        public override void Execute(object parameter)
        {
            _currentAccount = parameter as SmtpAccount;
            if (_currentAccount == null)
            {
                return;
            }
            if (!SmtpAccounts.Contains(_currentAccount))
            {
                return;
            }

            var interaction = new SmtpAccountInteraction(_currentAccount.Copy(), Translation.EditSmtpAccount);

            _interactionRequest.Raise(interaction, UpdateSmtpAccountsCallback);
        }