public async Task Should_Reschedule_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)
      });

      ScheduledEmailResult rescheduleResponse =
        await api.RescheduleMessage(new RescheduleMessageRequest(result.First().Id, DateTime.Now.AddMinutes(10)));

      Assert.AreEqual(result.First().Id, rescheduleResponse.Id);
    }
示例#2
0
        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);
        }
示例#3
0
        public async Task Should_Reschedule_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)
            });

            ScheduledEmailResult rescheduleResponse =
                await api.RescheduleMessage(new RescheduleMessageRequest(result.First().Id, DateTime.Now.AddMinutes(10)));

            Assert.AreEqual(result.First().Id, rescheduleResponse.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);
        }