예제 #1
0
 public MailDemonDatabaseChangeToken(IMailDemonDatabaseProvider dbProvider,
                                     IMemoryCache memoryCache, string viewPath)
 {
     this.dbProvider          = dbProvider;
     this.memoryCache         = memoryCache;
     this.fileNameNoExtension = Path.GetFileNameWithoutExtension(viewPath);
 }
 public MailDemonDatabaseFileProvider(IMailDemonDatabaseProvider dbProvider,
                                      IMemoryCache memoryCache, string rootPath)
 {
     this.dbProvider  = dbProvider;
     this.memoryCache = memoryCache;
     this.rootPath    = rootPath;
 }
예제 #3
0
 public HomeController(IMailDemonDatabaseProvider dbProvider, IMailCreator mailCreator, IMailSender mailSender,
                       IBulkMailSender bulkMailSender, IAuthority authority)
 {
     this.dbProvider     = dbProvider;
     this.mailCreator    = mailCreator ?? throw new ArgumentNullException(nameof(mailCreator));
     this.mailSender     = mailSender ?? throw new ArgumentNullException(nameof(mailSender));
     this.bulkMailSender = bulkMailSender;
     this.authority      = authority;
 }
예제 #4
0
 public void Setup()
 {
     Cleanup();
     dbProvider = this as IMailDemonDatabaseProvider;
     using (var db = dbProvider.GetDatabase())
     {
         db.Initialize();
         MailList list = new MailList
         {
             Name             = listName,
             Company          = company,
             PhysicalAddress  = fullAddress,
             Title            = listName + " title",
             FromEmailAddress = fromAddress,
             FromEmailName    = fromName,
             Website          = website
         };
         MailTemplate template = new MailTemplate
         {
             Name         = templateName,
             LastModified = DateTime.UtcNow,
             Text         = templateText,
             Title        = "confirm"
         };
         MailTemplate template2 = new MailTemplate
         {
             Name         = templateName2,
             LastModified = DateTime.UtcNow,
             Text         = templateText2,
             Title        = "welcome"
         };
         db.Lists.Add(list);
         db.Templates.Add(template);
         db.Templates.Add(template2);
         db.SaveChanges();
     }
     mailCreator = new MailCreator(new RazorRenderer(null, Directory.GetCurrentDirectory(), Assembly.GetExecutingAssembly()))
     {
         IgnoreElements = authority
     };
     homeController = new HomeController(this, null, mailCreator, this, null, this)
     {
         RequireCaptcha = false,
         TempData       = new TempDataDictionary(httpContext, this)
     };
     homeController.ControllerContext.HttpContext = httpContext;
     httpContext.Request.Headers["User-Agent"]    = "Test";
     httpContext.Connection.RemoteIpAddress       = System.Net.IPAddress.Parse("127.0.0.1");
     httpContext.Request.Scheme = scheme;
     httpContext.Request.Host   = new HostString(domainName);
 }
예제 #5
0
        public MailDemonDatabaseFileInfo(IMailDemonDatabaseProvider dbProvider, string rootPath, string viewPath)
        {
            this.dbProvider = dbProvider;

            // work-around bug in .NET core pathing with view start for custom rendered razor views
            if (viewPath.Equals("/_ViewStart.cshtml") || viewPath.Equals("_ViewStart.cshtml", StringComparison.OrdinalIgnoreCase))
            {
                viewPath = "Views/_ViewStart.cshtml";
            }
            this.rootPath = rootPath;
            this.fileName = viewPath;
            this.fullPath = Path.Combine(rootPath, viewPath);
            if (!File.Exists(this.fullPath))
            {
                this.fullPath = viewPath;
            }
            this.fullPath            = this.fullPath.Trim(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
            this.fileNameNoExtension = Path.GetFileNameWithoutExtension(viewPath);
            this.name = Path.GetFileName(viewPath);
            GetContent();
        }
예제 #6
0
 public BulkMailSender(IMailDemonDatabaseProvider dbProvider)
 {
     this.dbProvider = dbProvider;
 }
예제 #7
0
 public SubscriptionCleanup(IMailDemonDatabaseProvider dbProvider)
 {
     this.dbProvider = dbProvider;
 }
 public PhysicalDirectoryContents(IMailDemonDatabaseProvider dbProvider, string dir)
 {
     this.dbProvider = dbProvider;
     this.dir        = dir;
 }