public void Scheduled_Message_Is_Rescheduled() { // Setup var apiKey = ConfigurationManager.AppSettings["APIKey"]; string toEmail = ConfigurationManager.AppSettings["ValidToEmail"]; string fromEmail = ConfigurationManager.AppSettings["FromEMail"]; // Exercise var api = new MandrillApi(apiKey); var messages = api.SendMessage(new EmailMessage { to = new List <EmailAddress> { new EmailAddress { email = toEmail, name = "" } }, from_email = fromEmail, subject = "Mandrill Integration Test", html = "<strong>Scheduled Email</strong>", text = "Example text" }, DateTime.UtcNow.AddMinutes(5.0)); var message = api.ListScheduledMessages().Find(s => s.Id == messages.First().Id); var rescheduled = api.RescheduleMessage(message.Id, message.SendAt.AddMinutes(5.0)); //Verify Assert.Greater(rescheduled.SendAt, message.SendAt); //Tear down api.CancelScheduledMessage(rescheduled.Id); }
public void Scheduled_Message_Is_Canceled() { // Setup var apiKey = ConfigurationManager.AppSettings["APIKey"]; string toEmail = ConfigurationManager.AppSettings["ValidToEmail"]; string fromEmail = ConfigurationManager.AppSettings["FromEMail"]; // Exercise var api = new MandrillApi(apiKey); var messages = api.SendMessage(new EmailMessage { to = new List <EmailAddress> { new EmailAddress { email = toEmail, name = "" } }, from_email = fromEmail, subject = "Mandrill Integration Test", html = "<strong>Scheduled Email</strong>", text = "Example text" }, DateTime.UtcNow.AddMinutes(5.0)); var scheduled = api.ListScheduledMessages(toEmail); //Verify that message was scheduled Assert.AreEqual(1, scheduled.Count(s => s.Id == messages.First().Id)); api.CancelScheduledMessage(messages.First().Id); scheduled = api.ListScheduledMessages(toEmail); //Verify that message was cancelled. Assert.AreEqual(0, scheduled.Count(s => s.Id == messages.First().Id)); }
public async Task Message_With_Send_At_Is_Scheduled_For_Paid_Account() { if (!IsPaidAccount) Assert.Ignore("Not a paid account"); // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; string toEmail = ConfigurationManager.AppSettings["ValidToEmail"]; string fromEmail = ConfigurationManager.AppSettings["FromEMail"]; // Exercise var api = new MandrillApi(apiKey); List<EmailResult> result = await api.SendMessage(new SendMessageRequest(new EmailMessage { To = new List<EmailAddress> {new EmailAddress {Email = toEmail, Name = ""}}, FromEmail = fromEmail, Subject = "Mandrill Integration Test", Html = "<strong>Scheduled Email</strong>", Text = "Example text" }){ SendAt = DateTime.Now.AddMinutes(5) }); // Verify Assert.AreEqual(1, result.Count); Assert.AreEqual(toEmail, result.First().Email); Assert.AreEqual(EmailResultStatus.Scheduled, result.First().Status); //Tear down await api.CancelScheduledMessage(new CancelScheduledMessageRequest(result.First().Id)); }
public void Message_With_Send_At_Is_Scheduled() { // Setup var apiKey = ConfigurationManager.AppSettings["APIKey"]; string toEmail = ConfigurationManager.AppSettings["ValidToEmail"]; string fromEmail = ConfigurationManager.AppSettings["FromEMail"]; // Exercise var api = new MandrillApi(apiKey); var result = api.SendMessage(new EmailMessage { to = new List <EmailAddress> { new EmailAddress { email = toEmail, name = "" } }, from_email = fromEmail, subject = "Mandrill Integration Test", html = "<strong>Scheduled Email</strong>", text = "Example text" }, DateTime.UtcNow.AddMinutes(5.0)); // Verify Assert.AreEqual(1, result.Count); Assert.AreEqual(toEmail, result.First().Email); Assert.AreEqual(EmailResultStatus.Scheduled, result.First().Status); //Tear down api.CancelScheduledMessage(result.First().Id); }
public async Task Should_Schedule_Then_List_Scheduled_And_Cancel_Message() { if (!IsPaidAccount) { Assert.Ignore("Not a paid account"); } // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; string toEmail = ConfigurationManager.AppSettings["ValidToEmail"]; string fromEmail = ConfigurationManager.AppSettings["FromEMail"]; // Exercise var api = new MandrillApi(apiKey); List <EmailResult> result = await api.SendMessage(new SendMessageRequest(new EmailMessage { To = new List <EmailAddress> { new EmailAddress { Email = toEmail, Name = "" } }, FromEmail = fromEmail, Subject = "Mandrill Integration Test", Html = "<strong>Example HTML</strong>", Text = "Example text" }){ SendAt = DateTime.Now.AddMinutes(5) }); List <ScheduledEmailResult> scheduled = await api.ListScheduledMessages(new ListScheduledMessagesRequest { ToEmail = toEmail }); //Verify that message was scheduled Assert.AreEqual(1, scheduled.Count(s => s.Id == result.First().Id)); await api.CancelScheduledMessage(new CancelScheduledMessageRequest(result.First().Id)); scheduled = await api.ListScheduledMessages(new ListScheduledMessagesRequest { ToEmail = toEmail }); //Verify that message was canceled. Assert.AreEqual(0, scheduled.Count(s => s.Id == result.First().Id)); }
public async Task Message_With_Send_At_Is_Scheduled_For_Paid_Account() { if (!IsPaidAccount) { Assert.Ignore("Not a paid account"); } // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; string toEmail = ConfigurationManager.AppSettings["ValidToEmail"]; string fromEmail = ConfigurationManager.AppSettings["FromEMail"]; // Exercise var api = new MandrillApi(apiKey); List <EmailResult> result = await api.SendMessage(new SendMessageRequest(new EmailMessage { To = new List <EmailAddress> { new EmailAddress { Email = toEmail, Name = "" } }, FromEmail = fromEmail, Subject = "Mandrill Integration Test", Html = "<strong>Scheduled Email</strong>", Text = "Example text" }){ SendAt = DateTime.Now.AddMinutes(5) }); // Verify Assert.AreEqual(1, result.Count); Assert.AreEqual(toEmail, result.First().Email); Assert.AreEqual(EmailResultStatus.Scheduled, result.First().Status); //Tear down await api.CancelScheduledMessage(new CancelScheduledMessageRequest(result.First().Id)); }
public async Task Should_Schedule_Then_List_Scheduled_And_Cancel_Message() { if (!IsPaidAccount) Assert.Ignore("Not a paid account"); // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; string toEmail = ConfigurationManager.AppSettings["ValidToEmail"]; string fromEmail = ConfigurationManager.AppSettings["FromEMail"]; // Exercise var api = new MandrillApi(apiKey); List<EmailResult> result = await api.SendMessage(new SendMessageRequest(new EmailMessage { To = new List<EmailAddress> {new EmailAddress {Email = toEmail, Name = ""}}, FromEmail = fromEmail, Subject = "Mandrill Integration Test", Html = "<strong>Example HTML</strong>", Text = "Example text" }){ SendAt = DateTime.Now.AddMinutes(5) }); List<ScheduledEmailResult> scheduled = await api.ListScheduledMessages(new ListScheduledMessagesRequest {ToEmail = toEmail}); //Verify that message was scheduled Assert.AreEqual(1, scheduled.Count(s => s.Id == result.First().Id)); await api.CancelScheduledMessage(new CancelScheduledMessageRequest(result.First().Id)); scheduled = await api.ListScheduledMessages(new ListScheduledMessagesRequest {ToEmail = toEmail}); //Verify that message was canceled. Assert.AreEqual(0, scheduled.Count(s => s.Id == result.First().Id)); }
public void Message_With_Send_At_Is_Scheduled() { // Setup var apiKey = ConfigurationManager.AppSettings["APIKey"]; string toEmail = ConfigurationManager.AppSettings["ValidToEmail"]; string fromEmail = ConfigurationManager.AppSettings["FromEMail"]; // Exercise var api = new MandrillApi(apiKey); var result = api.SendMessage(new EmailMessage { to = new List<EmailAddress> { new EmailAddress { email = toEmail, name = "" } }, from_email = fromEmail, subject = "Mandrill Integration Test", html = "<strong>Scheduled Email</strong>", text = "Example text" }, DateTime.UtcNow.AddMinutes(5.0)); // Verify Assert.AreEqual(1, result.Count); Assert.AreEqual(toEmail, result.First().Email); Assert.AreEqual(EmailResultStatus.Scheduled, result.First().Status); //Tear down api.CancelScheduledMessage(result.First().Id); }
public void Scheduled_Message_Is_Rescheduled() { // Setup var apiKey = ConfigurationManager.AppSettings["APIKey"]; string toEmail = ConfigurationManager.AppSettings["ValidToEmail"]; string fromEmail = ConfigurationManager.AppSettings["FromEMail"]; // Exercise var api = new MandrillApi(apiKey); var messages = api.SendMessage(new EmailMessage { to = new List<EmailAddress> { new EmailAddress { email = toEmail, name = "" } }, from_email = fromEmail, subject = "Mandrill Integration Test", html = "<strong>Scheduled Email</strong>", text = "Example text" }, DateTime.UtcNow.AddMinutes(5.0)); var message = api.ListScheduledMessages().Find(s => s.Id == messages.First().Id); var rescheduled = api.RescheduleMessage(message.Id, message.SendAt.AddMinutes(5.0)); //Verify Assert.Greater(rescheduled.SendAt, message.SendAt); //Tear down api.CancelScheduledMessage(rescheduled.Id); }
public void Scheduled_Message_Is_Canceled() { // Setup var apiKey = ConfigurationManager.AppSettings["APIKey"]; string toEmail = ConfigurationManager.AppSettings["ValidToEmail"]; string fromEmail = ConfigurationManager.AppSettings["FromEMail"]; // Exercise var api = new MandrillApi(apiKey); var messages = api.SendMessage(new EmailMessage { to = new List<EmailAddress> { new EmailAddress { email = toEmail, name = "" } }, from_email = fromEmail, subject = "Mandrill Integration Test", html = "<strong>Scheduled Email</strong>", text = "Example text" }, DateTime.UtcNow.AddMinutes(5.0)); var scheduled = api.ListScheduledMessages(toEmail); //Verify that message was scheduled Assert.AreEqual(1, scheduled.Count(s => s.Id == messages.First().Id)); api.CancelScheduledMessage(messages.First().Id); scheduled = api.ListScheduledMessages(toEmail); //Verify that message was cancelled. Assert.AreEqual(0, scheduled.Count(s => s.Id == messages.First().Id)); }