public static async Task SendPhoneNotifyMessage(INotifyMessageSender notifyMessageSender) { IDatabase database = new Butterfly.Core.Database.Memory.MemoryDatabase(); await database.CreateFromResourceFileAsync(Assembly.GetExecutingAssembly(), "Butterfly.Notify.Test.db.sql"); database.SetDefaultValue("id", tableName => Guid.NewGuid().ToString()); database.SetDefaultValue("created_at", tableName => DateTime.Now); var notifyMessageManager = new NotifyManager(database, phoneNotifyMessageSender: notifyMessageSender); notifyMessageManager.Start(); var notifyMessage = new NotifyMessage("+1 316 712 7412", "+1 316 555 1212", null, "Just testing", null); using (ITransaction transaction = await database.BeginTransactionAsync()) { await notifyMessageManager.Queue(transaction, notifyMessage); } await Task.Delay(200000); }
public static async Task SendEmailNotifyMessage(INotifyMessageSender notifyMessageSender) { IDatabase database = new Butterfly.Core.Database.Memory.MemoryDatabase(); await database.CreateFromResourceFileAsync(Assembly.GetExecutingAssembly(), "Butterfly.Notify.Test.db.sql"); database.SetDefaultValue("id", tableName => Guid.NewGuid().ToString()); database.SetDefaultValue("created_at", tableName => DateTime.Now); var notifyMessageManager = new NotifyManager(database, emailNotifyMessageSender: notifyMessageSender); notifyMessageManager.Start(); var notifyMessage = new NotifyMessage("*****@*****.**", "*****@*****.**", "Test SES", "Just testing", null); using (ITransaction transaction = await database.BeginTransactionAsync()) { await notifyMessageManager.Queue(transaction, notifyMessage); await transaction.CommitAsync(); } await Task.Delay(200000); }