private async Task <List <EmailAccount> > SeedData(IMailServiceDbContext db, int total)
        {
            var emailAccounts = new List <EmailAccount>();

            for (int i = 1; i <= total; i++)
            {
                int number       = NextSeed;
                var emailAccount = new EmailAccount
                {
                    Id            = number,
                    EmailAddress  = $"user{number}@domain.com",
                    Username      = $"user{number}@domain.com",
                    Password      = "******",
                    ServerAddress = "::1",
                    Port          = 143,
                    Protocol      = MailProtocol.Imap,
                    UseSecureMode = false,
                    MailBox       = "INBOX"
                };
                emailAccounts.Add(emailAccount);
                db.EmailAccounts.Add(emailAccount);
            }

            await db.SaveChangesAsync(new());

            return(emailAccounts);
        }
Ejemplo n.º 2
0
        private static async Task <EmailAccount> CreateSample(IMailServiceDbContext db)
        {
            int id           = NextSeed;
            var emailAccount = new EmailAccount
            {
                Id            = id,
                EmailAddress  = $"user.{id}@domain.com",
                Username      = "******",
                Password      = "******",
                Protocol      = MailProtocol.Imap,
                ServerAddress = "::1",
                Port          = 143,
                MailBox       = "INBOX"
            };

            db.EmailAccounts.Add(emailAccount);
            await db.SaveChangesAsync(new());

            return(emailAccount);
        }
Ejemplo n.º 3
0
 public Handler(IMailServiceDbContext db)
 {
     _db = db;
 }