Esempio n. 1
0
 public SmtpTestEmailAssistant(SmtpSettingsAndActionControlTranslation translation, IInteractionInvoker interactionInvoker, IFile file,
                               ISmtpMailAction smtpMailAction, IPath path, IMailSignatureHelper mailSignatureHelper, ErrorCodeInterpreter errorCodeInterpreter)
 {
     _file                 = file;
     _translation          = translation;
     _interactionInvoker   = interactionInvoker;
     _smtpMailAction       = smtpMailAction;
     _path                 = path;
     _mailSignatureHelper  = mailSignatureHelper;
     _errorCodeInterpreter = errorCodeInterpreter;
 }
        public EmailSmtpActionViewModel(SmtpSettingsAndActionControlTranslation translation, IInteractionInvoker interactionInvoker, ISmtpTest smtpTest)
        {
            Translation         = translation;
            _interactionInvoker = interactionInvoker;
            _smtpTest           = smtpTest;

            EditMailTextCommand = new DelegateCommand(EditMailTextExecute);
            SetPasswordCommand  = new DelegateCommand(SetPasswordExecute);
            TestSmtpCommand     = new DelegateCommand(TextSmtpExecute);

            DisplayName = Translation.DisplayName;
            Description = Translation.Description;
        }
Esempio n. 3
0
        public void WhenSuccessful_ShowsSuccessMessage()
        {
            var translation = new SmtpSettingsAndActionControlTranslation();
            var assistant   = BuildAssistant();

            assistant.SendTestMail(_profile, new Accounts());

            _interactionInvoker.Received().Invoke(Arg.Any <MessageInteraction>());

            var messageInteraction =
                _interactions.Where(x => x is MessageInteraction).Cast <MessageInteraction>().First();

            Assert.AreEqual(translation.SendTestMail, messageInteraction.Title);
            Assert.AreEqual(translation.GetTestMailSentFormattedTranslation(string.Empty), messageInteraction.Text);
            Assert.AreEqual(MessageIcon.Info, messageInteraction.Icon);
        }
Esempio n. 4
0
        public void WhenSendingMailFails_ShowsErrorMessage()
        {
            var translation   = new SmtpSettingsAndActionControlTranslation();
            var expectedError = ErrorCode.Smtp_AuthenticationDenied;

            _smtpAction.ProcessJob(Arg.Any <Job>()).Returns(new ActionResult(expectedError));
            var assistant = BuildAssistant();

            assistant.SendTestMail(_profile, new Accounts());

            _interactionInvoker.Received().Invoke(Arg.Any <MessageInteraction>());

            var messageInteraction =
                _interactions.Where(x => x is MessageInteraction).Cast <MessageInteraction>().First();

            Assert.AreEqual(translation.SendTestMail, messageInteraction.Title);
            Assert.AreEqual(TranslationAttribute.GetValue(expectedError), messageInteraction.Text);
            Assert.AreEqual(MessageIcon.Error, messageInteraction.Icon);
        }
Esempio n. 5
0
        public void WhenProfileInvalid_DisplaysErrorMessage()
        {
            var translation   = new SmtpSettingsAndActionControlTranslation();
            var expectedError = ErrorCode.Smtp_NoPasswordSpecified;

            _smtpAction.Check(_profile, Arg.Any <Accounts>()).Returns(x => new ActionResult(expectedError));
            var assistant = BuildAssistant();

            assistant.SendTestMail(_profile, new Accounts());

            _interactionInvoker.Received().Invoke(Arg.Any <MessageInteraction>());

            var messageInteraction =
                _interactions.Where(x => x is MessageInteraction).Cast <MessageInteraction>().First();

            var errorCodeInt = (int)expectedError;

            Assert.AreEqual(translation.SendTestMail, messageInteraction.Title);
            Assert.AreEqual(TranslationAttribute.GetValue(expectedError), messageInteraction.Text);
            Assert.AreEqual(MessageIcon.Error, messageInteraction.Icon);
        }
 public InteractiveSmtpPasswordProvider(SmtpSettingsAndActionControlTranslation translation, IInteractionInvoker interactionInvoker)
 {
     _translation        = translation;
     _interactionInvoker = interactionInvoker;
 }