public void Setup() { _smtpTestAccount = new SmtpAccount(); _smtpTestAccount.AccountId = "SmtpTestAccountId"; _profile = new ConversionProfile(); //Attention _profile.EmailSmtpSettings.AccountId = _smtpTestAccount.AccountId; //The AccountAssosiation is mocked below. The _smtpTestAccount is always used. _accounts = new Accounts(); _accounts.SmtpAccounts.Add(_smtpTestAccount); _interactionRequest = new UnitTestInteractionRequest(); _interactionInvoker = Substitute.For <IInteractionInvoker>(); _interactionInvoker.Invoke(Arg.Do <PasswordOverlayInteraction>(i => i.Result = PasswordResult.StorePassword)); _interactionRequest.RegisterInteractionHandler <PasswordOverlayInteraction>(interaction => interaction.Result = PasswordResult.StorePassword); _file = Substitute.For <IFile>(); _path = Substitute.For <IPath>(); _smtpAction = Substitute.For <ISmtpMailAction>(); _smtpAction.Check(Arg.Any <ConversionProfile>(), _accounts, Arg.Any <CheckLevel>()).Returns(x => new ActionResult()); _smtpAction.ProcessJob(Arg.Any <Job>()).Returns(x => new ActionResult()); //_smtpAction.GetSmtpAccount(_profile, _accounts).Returns(_smtpTestAccount); _mailSignatureHelper = Substitute.For <IMailSignatureHelper>(); _mailSignatureHelper.ComposeMailSignature().Returns(_mailSignature); _tokenReplacer = new TokenReplacer(); _tokenReplacerFactory = Substitute.For <ITokenReplacerFactory>(); _tokenReplacerFactory.BuildTokenReplacerWithOutputfiles(Arg.Any <Job>()).Returns(_tokenReplacer); _translation = new SmtpTranslation(); }
public SmtpTestEmailAssistant(ITranslationUpdater translationUpdater, IInteractionRequest interactionRequest, IFile file, ISmtpMailAction smtpMailAction, IPath path, IMailSignatureHelper mailSignatureHelper, ErrorCodeInterpreter errorCodeInterpreter, IInteractionInvoker interactionInvoker) { _interactionRequest = interactionRequest; _file = file; translationUpdater.RegisterAndSetTranslation(tf => _translation = tf.UpdateOrCreateTranslation(_translation)); _smtpMailAction = smtpMailAction; _path = path; _mailSignatureHelper = mailSignatureHelper; _errorCodeInterpreter = errorCodeInterpreter; _interactionInvoker = interactionInvoker; }
public void SetUp() { _interactionRequest = new UnitTestInteractionRequest(); _translation = new SmtpTranslation(); _smtpAccounts = new ObservableCollection <SmtpAccount>(); _usedAccount = new SmtpAccount(); _usedAccount.AccountId = nameof(_usedAccount); _usedAccount.UserName = "******"; _usedAccount.Server = "SV1"; _smtpAccounts.Add(_usedAccount); _unusedAccount = new SmtpAccount(); _unusedAccount.AccountId = nameof(_unusedAccount); _unusedAccount.UserName = "******"; _unusedAccount.Server = "SV2"; _smtpAccounts.Add(_unusedAccount); _profiles = new ObservableCollection <ConversionProfile>(); _profileWithSmtpAccountEnabled = new ConversionProfile(); _profileWithSmtpAccountEnabled.Name = nameof(_profileWithSmtpAccountEnabled); _profileWithSmtpAccountEnabled.EmailSmtpSettings.Enabled = true; _profileWithSmtpAccountEnabled.EmailSmtpSettings.AccountId = _usedAccount.AccountId; _profiles.Add(_profileWithSmtpAccountEnabled); _profileWithSmtpAccountDisabled = new ConversionProfile(); _profileWithSmtpAccountDisabled.Name = nameof(_profileWithSmtpAccountDisabled); _profileWithSmtpAccountDisabled.EmailSmtpSettings.Enabled = false; _profileWithSmtpAccountDisabled.EmailSmtpSettings.AccountId = _usedAccount.AccountId; _profiles.Add(_profileWithSmtpAccountDisabled); var settings = new PdfCreatorSettings(null); settings.ApplicationSettings.Accounts.SmtpAccounts = _smtpAccounts; settings.ConversionProfiles = _profiles; var currentSettingsProvider = Substitute.For <ICurrentSettingsProvider>(); currentSettingsProvider.Settings.Returns(settings); currentSettingsProvider.Profiles.Returns(_profiles); var translationUpdater = new TranslationUpdater(new TranslationFactory(), new ThreadManager()); _smtpAccountRemoveCommand = new SmtpAccountRemoveCommand(_interactionRequest, currentSettingsProvider, translationUpdater); }
public void SetUp() { _interaction = new EditEmailTextInteraction("Subject", "Content", false, false); var translationUpdater = Substitute.For <ITranslationUpdater>(); _translation = new SmtpTranslation(); var mailSignatureHelper = Substitute.For <IMailSignatureHelper>(); mailSignatureHelper.ComposeMailSignature().Returns(TestSignature); _tokenHelper = new TokenHelper(new DesignTimeTranslationUpdater()); _tokenReplacer = _tokenHelper.TokenReplacerWithPlaceHolders; _viewModel = new EditEmailTextViewModel(translationUpdater, mailSignatureHelper, _tokenHelper); _viewModel.SetInteraction(_interaction); }
public void SetUp() { _interactionRequest = new UnitTestInteractionRequest(); _translation = new SmtpTranslation(); _currentSmtpAccount = new SmtpAccount { UserName = "******" }; _smtpAccounts = new ObservableCollection <SmtpAccount>(); _smtpAccounts.Add(_currentSmtpAccount); var settings = new PdfCreatorSettings(); settings.ApplicationSettings.Accounts.SmtpAccounts = _smtpAccounts; _accountsProvider = Substitute.For <ICurrentSettings <Accounts> >(); _accountsProvider.Settings.Returns(settings.ApplicationSettings.Accounts); var translationUpdater = new TranslationUpdater(new TranslationFactory(), new ThreadManager()); _smtpAccountEditCommand = new SmtpAccountEditCommand(_interactionRequest, _accountsProvider, translationUpdater); }