Beispiel #1
0
        public async Task TestActivateDripCampaignAsyncWithAllParameters()
        {
            Trace.WriteLine(String.Format("POST /drip_campaigns/{0}/activate with all parameters", DEFAULT_CAMPAIGN_ID));

            // Build the drip campaign object
            var recipient    = new EmailRecipient(DEFAULT_RECIPIENT_EMAIL_ADDRESS, DEFAULT_EMAIL_NAME);
            var dripCampaign = new DripCampaign(recipient);

            dripCampaign.cc.Add(new EmailRecipient(DEFAULT_CC_EMAIL_ADDRESS_1, DEFAULT_EMAIL_NAME));
            dripCampaign.cc.Add(new EmailRecipient(DEFAULT_CC_EMAIL_ADDRESS_2, DEFAULT_EMAIL_NAME));
            dripCampaign.bcc.Add(new EmailRecipient(DEFAULT_BCC_EMAIL_ADDRESS_1, DEFAULT_EMAIL_NAME));
            dripCampaign.bcc.Add(new EmailRecipient(DEFAULT_BCC_EMAIL_ADDRESS_2, DEFAULT_EMAIL_NAME));
            dripCampaign.sender.address  = DEFAULT_SENDER_EMAIL_ADDRESS;
            dripCampaign.sender.name     = DEFAULT_SENDER_NAME;
            dripCampaign.sender.reply_to = DEFAULT_REPLY_TO_EMAIL_ADDRESS;
            dripCampaign.tags.Add(DEFAULT_TAG_1);
            dripCampaign.tags.Add(DEFAULT_TAG_2);
            dripCampaign.tags.Add(DEFAULT_TAG_3);
            dripCampaign.locale      = DEFAULT_LOCALE;
            dripCampaign.esp_account = DEFAULT_ESP_ACCOUNT_ID;
            dripCampaign.email_data.Add("amount", "$12.00");

            // Make the API call
            try
            {
                var dripCampaignResponse = await dripCampaign.ActivateAsync(DEFAULT_CAMPAIGN_ID);

                // Validate the response
                SendwithusClientTest.ValidateResponse(dripCampaignResponse);
            }
            catch (AggregateException exception)
            {
                Assert.Fail(exception.ToString());
            }
        }
Beispiel #2
0
        public async Task TestActivateDripCampaignWithInvalidParameters()
        {
            Trace.WriteLine(String.Format("POST /drip_campaigns/{0}/activate with invalid campaign ID", INVALID_CAMPAIGN_ID));

            // Build the drip campaign object
            var recipient    = new EmailRecipient(DEFAULT_RECIPIENT_EMAIL_ADDRESS);
            var dripCampaign = new DripCampaign(recipient);

            // Make the API call
            try {
                var response = await dripCampaign.ActivateAsync(INVALID_CAMPAIGN_ID);
            }
            catch (AggregateException exception)
            {
                // Make sure the response was HTTP 400 Bad Request
                SendwithusClientTest.ValidateException(exception, HttpStatusCode.BadRequest);
            }
        }
Beispiel #3
0
        public async Task TestActivateDripCampaignAsyncWithMinimumParameters()
        {
            Trace.WriteLine(String.Format("POST /drip_campaigns/{0}/activate with minimum parameters", DEFAULT_CAMPAIGN_ID));

            // Build the drip campaign object
            var recipient    = new EmailRecipient(DEFAULT_RECIPIENT_EMAIL_ADDRESS);
            var dripCampaign = new DripCampaign(recipient);

            // Make the API call
            try
            {
                var dripCampaignResponse = await dripCampaign.ActivateAsync(DEFAULT_CAMPAIGN_ID);

                // Validate the response
                SendwithusClientTest.ValidateResponse(dripCampaignResponse);
            }
            catch (AggregateException exception)
            {
                Assert.Fail(exception.ToString());
            }
        }