public void CreateMailingListEntryTest()
 {
     MockHttpClient.Expect(
         x =>
         x.CreateMailingListEntry(Arg<string>.Is.Equal("TEST"), Arg<MailingListEntryCreateRequest>.Is.Anything))
         .Return(new MailingListEntryCreateResponse {
             statusCode = 201,
         });
     var entry = new MessageBusMailingListEntry();
     entry.MergeFields["%EMAIL%"] = "*****@*****.**";
     MailingListClient.AddMailingListEntry("TEST", entry);
 }
        /// <summary>
        /// This example uploads a mailing list and sends a campaign based on the mailing list
        /// </summary>
        void RunExample(string name, FileInfo mailingList)
        {
            try {

                var uploadResult = MessageBusMailingLists.UploadMailingList(name, mailingList);

                var mailingListKey = uploadResult.MailingListKey;

                var newEntry = new MessageBusMailingListEntry();
                newEntry.MergeFields["%EMAIL%"] = "*****@*****.**";
                newEntry.MergeFields["%FIRST_NAME%"] = "Bob";

                MessageBusMailingLists.AddMailingListEntry(mailingListKey, newEntry);

                MessageBusMailingLists.DeleteMailingListEntry(mailingListKey, "*****@*****.**");

            } catch (MessageBusException) {
                throw;
            }
        }
 public void AddMailingListEntry(string mailingListKey, MessageBusMailingListEntry entry)
 {
     var response = HttpClient.CreateMailingListEntry(mailingListKey, new MailingListEntryCreateRequest(entry));
     if (response.statusCode != 201) {
         throw new MessageBusException(response.statusCode, response.statusMessage);
     }
 }
 public MailingListEntryCreateRequest(MessageBusMailingListEntry entry)
 {
     mergeFields = entry.MergeFields;
 }