Пример #1
0
        public static RnMailClient BuildRnMailClient(
            MailAccount mailAccount = null,
            IRnLogger logger        = null,
            IWebConfig webConfig    = null,
            IDirectory directory    = null)
        {
            // ensure that we have a mail account to work with
            if (mailAccount == null)
            {
                mailAccount = new MailAccount
                {
                    SmtpHost = "mail.goolge.com",
                    SmtpPort = 443,
                    Id       = 1
                };
            }

            // ensure that we have all other required objects
            logger    = logger ?? Substitute.For <IRnLogger>();
            directory = directory ?? Substitute.For <IDirectory>();

            // configure the default web.config reader
            if (webConfig == null)
            {
                webConfig = Substitute.For <IWebConfig>();

                webConfig // override for default behavior
                .GetAppSetting(RnMailClient.DISK_MAIL_FOLDER, @"c:\mails\")
                .Returns(@"c:\mails\");
            }

            return(new RnMailClient(logger, webConfig, mailAccount, directory));
        }
Пример #2
0
        // constructor
        public RnMailClient(IRnLogger logger, IWebConfig webConfig, MailAccount mailAccount, IDirectory directory = null)
        {
            _logger    = logger;
            _webConfig = webConfig;
            _account   = mailAccount;
            _directory = directory ?? new RnDirectory();

            _mailClient = CreateMailClient();
        }
Пример #3
0
        public static UserAccountService BuildUserAccountService(
            IRnLogger logger = null,
            IUserAccountRepo userAccountRepo     = null,
            IEncryptionService encryptionService = null)
        {
            logger            = logger ?? Substitute.For <IRnLogger>();
            userAccountRepo   = userAccountRepo ?? Substitute.For <IUserAccountRepo>();
            encryptionService = encryptionService ?? Substitute.For <IEncryptionService>();

            return(new UserAccountService(logger, userAccountRepo, encryptionService));
        }
Пример #4
0
        public static MailAccountService BuildMailAccountService(
            IRnLogger logger = null,
            IMailAccountRepo mailAccountRepo     = null,
            IEncryptionService encryptionService = null)
        {
            logger            = logger ?? Substitute.For <IRnLogger>();
            mailAccountRepo   = mailAccountRepo ?? Substitute.For <IMailAccountRepo>();
            encryptionService = encryptionService ?? Substitute.For <IEncryptionService>();

            return(new MailAccountService(logger, mailAccountRepo, encryptionService));
        }
Пример #5
0
 public RnMailClientFactory(IRnLogger logger, IWebConfig webConfig, IDirectory directory)
 {
     _logger    = logger;
     _webConfig = webConfig;
     _directory = directory;
 }
Пример #6
0
 public UserAccountService(IRnLogger logger, IUserAccountRepo repo, IEncryptionService encryption)
 {
     _logger     = logger;
     _repo       = repo;
     _encryption = encryption;
 }
Пример #7
0
 public MailAccountService(IRnLogger logger, IMailAccountRepo repo, IEncryptionService encryptionService)
 {
     _logger            = logger;
     _repo              = repo;
     _encryptionService = encryptionService;
 }