public void SetUp() { var fixture = new Fixture(); _userName = fixture.Create <string>(); _smtpPassword = fixture.Create <string>(); _mailSignatureHelper = Substitute.For <IMailSignatureHelper>(); _mailSignatureHelper.ComposeMailSignature().Returns(""); var bootstrapper = new IntegrationTestBootstrapper(); var container = bootstrapper.ConfigureContainer(); _th = container.GetInstance <TestHelper>(); _th.InitTempFolder("SmtpEmailTest"); _tokenReplacer = new TokenReplacer(); _tokenReplacer.AddStringToken("ReplaceThis", "Replaced"); var serverIp = IPAddress.Loopback; _smtpPort = FindFreeTcpPort(); _mailServer = serverIp.ToString(); _smtpServer = new SmtpServerForUnitTest(serverIp, _smtpPort, new[] { new NetworkCredential(_userName, _smtpPassword) }); _smtpServer.Start(); }
public void SetUp() { _smtpTestAccount = new SmtpAccount(); _smtpTestAccount.AccountId = "TestAccountId"; _smtpTestAccount.Address = "*****@*****.**"; _smtpTestAccount.UserName = "******"; _smtpTestAccount.Server = "randomHost"; _smtpTestAccount.Port = 25; _smtpTestAccount.Ssl = false; _smtpTestAccount.Password = "******"; _profile = new ConversionProfile(); _profile.EmailSmtpSettings.Enabled = true; _profile.EmailSmtpSettings.AccountId = _smtpTestAccount.AccountId; _profile.EmailSmtpSettings.Recipients = "*****@*****.**"; _profile.EmailSmtpSettings.Subject = ""; _profile.EmailSmtpSettings.Content = ""; _profile.EmailSmtpSettings.AddSignature = false; _accounts = new Accounts(); _accounts.SmtpAccounts.Add(_smtpTestAccount); _mailSignatureHelper = Substitute.For <IMailSignatureHelper>(); _mailSignatureHelper.ComposeMailSignature().Returns("Signature!"); _smtpAction = new SmtpMailAction(_mailSignatureHelper); }
public EditEmailTextViewModel(ITranslationUpdater translationUpdater, IMailSignatureHelper mailSignatureHelper, ITokenHelper tokenHelper, TokenViewModelFactory tokenViewModelFactory) : base(translationUpdater) { _tokenReplacer = tokenHelper.TokenReplacerWithPlaceHolders; var builder = tokenViewModelFactory .Builder <EditEmailTextInteraction>() .WithInitialValue(Interaction) .WithTokenList(tokenHelper.GetTokenListForEmail()); SubjectTokenViewModel = builder .WithSelector(i => i.Subject) .WithDefaultTokenReplacerPreview() .Build(); ContentTokenViewModel = builder .WithSelector(i => i.Content) .WithTokenCustomPreview(ReplaceTokensAddSignature) .Build(); _signatureText = mailSignatureHelper.ComposeMailSignature(); OkCommand = new DelegateCommand(ExecuteOk); CancelCommand = new DelegateCommand(o => FinishInteraction()); }
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 void Setup() { _profile = new ConversionProfile(); _interactions = new List <IInteraction>(); _interactionInvoker = Substitute.For <IInteractionInvoker>(); _interactionInvoker .When(x => x.Invoke(Arg.Any <PasswordInteraction>())) .Do(x => { var interaction = x.Arg <PasswordInteraction>(); interaction.Result = PasswordResult.StorePassword; }); _interactionInvoker .When(x => x.Invoke(Arg.Any <IInteraction>())) .Do(x => { _interactions.Add(x.Arg <IInteraction>()); }); _file = Substitute.For <IFile>(); _path = Substitute.For <IPath>(); _smtpAction = Substitute.For <ISmtpMailAction>(); _smtpAction.Check(_profile, Arg.Any <Accounts>()).Returns(x => new ActionResult()); _smtpAction.ProcessJob(Arg.Any <Job>()).Returns(x => new ActionResult()); _mailSignatureHelper = Substitute.For <IMailSignatureHelper>(); _mailSignatureHelper.ComposeMailSignature().Returns(_mailSignature); }
public ClientTestEmail(IEmailClientFactory emailClientFactory, IMailSignatureHelper mailSignatureHelper, IPath path, IDirectory directory, IFile file) { _emailClientFactory = emailClientFactory; _mailSignatureHelper = mailSignatureHelper; _path = path; _directory = directory; _file = file; }
public void SetUp() { _mailSignatureHelper = Substitute.For <IMailSignatureHelper>(); _jobInfo = new JobInfo(); _storage = Substitute.For <IStorage>(); _settings = new PdfCreatorSettings(_storage); _conversionProfile = new ConversionProfile(); _settings.ConversionProfiles.Add(_conversionProfile); }
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 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() { _mailSignatureHelper = Substitute.For <IMailSignatureHelper>(); _jobInfo = new JobInfo(); _settings = new PdfCreatorSettings(); _conversionProfile = new ConversionProfile(); _settings.ConversionProfiles.Add(_conversionProfile); _versionHelper = Substitute.For <IVersionHelper>(); _versionHelper.FormatWithThreeDigits().Returns(Version); _applicationNameProvider = new ApplicationNameProvider(EditionName); }
public void Setup() { _pathWrap = Substitute.For <IPath>(); _directoryWrap = Substitute.For <IDirectory>(); _fileWrap = Substitute.For <IFile>(); _emailClient = Substitute.For <IEmailClient>(); _emailClientFactory = Substitute.For <IEmailClientFactory>(); _emailClientFactory.CreateEmailClient().Returns(_emailClient); _mailSignatureHelper = Substitute.For <IMailSignatureHelper>(); _clientTestEmail = new ClientTestEmail(_emailClientFactory, _mailSignatureHelper, _pathWrap, _directoryWrap, _fileWrap); _emailClientSettings = new EmailClientSettings(); }
public EditEmailTextViewModel(ITranslationUpdater translationUpdater, IMailSignatureHelper mailSignatureHelper, TokenHelper tokenHelper) : base(translationUpdater) { if (tokenHelper != null) { _tokenReplacer = tokenHelper.TokenReplacerWithPlaceHolders; SubjectTokenViewModel = new TokenViewModel(x => Interaction.Subject = x, () => Interaction?.Subject, tokenHelper.GetTokenListForEmail(), ReplaceTokens); ContentTokenViewModel = new TokenViewModel(x => Interaction.Content = x, () => Interaction?.Content, tokenHelper.GetTokenListForEmail(), ReplaceTokensAddSignature); } _signatureText = mailSignatureHelper.ComposeMailSignature(); OkCommand = new DelegateCommand(ExecuteOk); CancelCommand = new DelegateCommand(o => FinishInteraction()); }
public EditEmailTextViewModel(EditEmailTextWindowTranslation translation, IMailSignatureHelper mailSignatureHelper, TokenHelper tokenHelper) { Translation = translation; TokenReplacer = tokenHelper.TokenReplacerWithPlaceHolders; var tokens = tokenHelper.GetTokenListForEmail(); _signatureText = mailSignatureHelper.ComposeMailSignature(); SubjectTextViewModel = new TokenViewModel( s => Interaction.Subject = s, () => Interaction?.Subject, tokens); BodyTextViewModel = new TokenViewModel( s => Interaction.Content = s, () => Interaction?.Content, tokens); OkCommand = new DelegateCommand(ExecuteOk); }
public void Setup() { _profile = new ConversionProfile(); _job = new Job(null, null, null) { Profile = _profile, OutputFiles = new List <string> { "FirstFile.pdf" } }; _fileList = new List <string>(); _fileList.Add("abc"); _fileList.Add("def"); _fileList.Add("ghi"); _emailClientAction = Substitute.For <IEMailClientAction>(); _mailSignatureHelper = Substitute.For <IMailSignatureHelper>(); _mailSignatureHelper.ComposeMailSignature().Returns(SignatureText); }
public MailHelper(IMailSignatureHelper mailSignatureHelper, IActionOrderHelper actionOrderHelper) { _mailSignatureHelper = mailSignatureHelper; _actionOrderHelper = actionOrderHelper; }
public JobBuilder(IMailSignatureHelper mailSignatureHelper, IJobFinishedHandler jobFinishedHandler) { _mailSignatureHelper = mailSignatureHelper; _jobFinishedHandler = jobFinishedHandler; }
public EMailClientAction(IEmailClientFactory emailClientFactory, IMailSignatureHelper mailSignatureHelper) { _emailClientFactory = emailClientFactory; _mailSignatureHelper = mailSignatureHelper; }
public QuickActionOpenMailClientCommand(ITranslationUpdater translationUpdater, IEMailClientAction action, IMailSignatureHelper mailSignatureHelper) : base(translationUpdater) { _action = action; _mailSignatureHelper = mailSignatureHelper; }
public JobBuilder(IMailSignatureHelper mailSignatureHelper, IVersionHelper versionHelper, ApplicationNameProvider applicationNameProvider) { _mailSignatureHelper = mailSignatureHelper; _versionHelper = versionHelper; _applicationNameProvider = applicationNameProvider; }
public JobBuilderFree(IMailSignatureHelper mailSignatureHelper) : base(mailSignatureHelper) { }
public JobBuilder(IMailSignatureHelper mailSignatureHelper) { _mailSignatureHelper = mailSignatureHelper; }
public SmtpMailAction(IMailSignatureHelper mailSignatureHelper) { _mailSignatureHelper = mailSignatureHelper; }
public JobBuilderFree(IMailSignatureHelper mailSignatureHelper, IVersionHelper versionHelper, ApplicationNameProvider applicationNameProvider) : base(mailSignatureHelper, versionHelper, applicationNameProvider) { }
public JobBuilderPlus(IMailSignatureHelper mailSignatureHelper, IParametersManager parametersManager) : base(mailSignatureHelper, parametersManager) { }
public JobBuilder(IMailSignatureHelper mailSignatureHelper, IParametersManager parametersManager) { _mailSignatureHelper = mailSignatureHelper; _parametersManager = parametersManager; }
public JobBuilderPlus(IMailSignatureHelper mailSignatureHelper) : base(mailSignatureHelper) { }
public EMailClientAction(IEmailClientFactory emailClientFactory, IMailSignatureHelper mailSignatureHelper, IFile file, IMailHelper mailHelper) { _emailClientFactory = emailClientFactory; _file = file; _mailHelper = mailHelper; }