Пример #1
0
 public EmailSpooler(IEmailSpoolerDependencies dependencies)
 {
     CheckDependencies(dependencies);
     _context        = dependencies.DbContext;
     _emailGenerator = dependencies.EmailGenerator;
     _config         = dependencies.EmailSpoolerConfig;
 }
Пример #2
0
        private static void CheckDependencies(IEmailSpoolerDependencies dependencies)
        {
            var missing = new List <string>();

            if (dependencies.DbContext == null)
            {
                missing.Add("dbContext");
            }
            if (dependencies.EmailGenerator == null)
            {
                missing.Add("emailGenerator");
            }
            if (dependencies.EmailSpoolerConfig == null)
            {
                missing.Add("emailSpoolerConfig");
            }
            if (missing.Any())
            {
                throw new ArgumentNullException(string.Join(",", missing));
            }
        }
 protected virtual IEmailSpooler CreateSpoolerWith(IEmailSpoolerDependencies deps)
 {
     return(new EmailSpooler(deps));
 }
Пример #4
0
 protected override IEmailSpooler CreateSpoolerWith(IEmailSpoolerDependencies deps)
 {
     return(CreateSpooler(deps));
 }