public void SaveAndReadTest()
        {
            EmailListElement emailList = new EmailListElement("foo");
            entry.EmailList = emailList;

            StringBuilder sb = new StringBuilder();
            XmlWriter writer = new XmlTextWriter(new StringWriter(sb));
            entry.SaveToXml(writer);
            writer.Close();

            XmlDocument document = new XmlDocument();
            document.LoadXml(sb.ToString());

            EmailListEntry newEntry = new EmailListEntry();
            foreach (XmlNode node in document.FirstChild.ChildNodes)
            {
                ExtensionElementEventArgs args = new ExtensionElementEventArgs();
                args.ExtensionElement = node;
                args.Base = newEntry;
                newEntry.Parse(args, new AtomFeedParser());
            }

            Assert.AreEqual(emailList.Name, newEntry.EmailList.Name,
                "Parsed entry should have same email list name as original entry");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new email list on this domain.
        /// </summary>
        /// <param name="emailList">the name of the email list that you wish to create.</param>
        /// <returns>the newly created EmailListEntry</returns>
        public EmailListEntry CreateEmailList(string emailList)
        {
            EmailListQuery query = new EmailListQuery(Domain);
            EmailListEntry entry = new EmailListEntry(emailList);

            return emailListService.Insert(query.Uri, entry);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Inserts a new email list entry into the specified feed.
 /// </summary>
 /// <param name="feed">the feed into which this entry should be inserted</param>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public EmailListEntry Insert(EmailListFeed feed, EmailListEntry entry)
 {
     try
     {
         return base.Insert(feed, entry) as EmailListEntry;
     }
     catch (GDataRequestException e)
     {
         AppsException a = AppsException.ParseAppsException(e);
         throw (a == null ? e : a);
     }
 }
 public void Init()
 {
     entry = new EmailListEntry();
 }
Exemplo n.º 5
0
 /// <summary>
 /// Overridden Delete method that throws AppsException
 /// </summary>
 /// <param name="entry">the EmailListEntry to delete</param>
 public void Delete(EmailListEntry entry)
 {
     try
     {
         base.Delete(entry);
     }
     catch (GDataRequestException e)
     {
         AppsException a = AppsException.ParseAppsException(e);
         throw (a == null ? e : a);
     }
 }