public void SaveAndReadTest() { LoginElement login = new LoginElement("jdoe"); entry.Login = login; NicknameElement nickname = new NicknameElement("john"); entry.Nickname = nickname; StringBuilder sb = new StringBuilder(); XmlWriter writer = new XmlTextWriter(new StringWriter(sb)); entry.SaveToXml(writer); writer.Close(); XmlDocument document = new XmlDocument(); document.LoadXml(sb.ToString()); NicknameEntry newEntry = new NicknameEntry(); foreach (XmlNode node in document.FirstChild.ChildNodes) { ExtensionElementEventArgs args = new ExtensionElementEventArgs(); args.ExtensionElement = node; args.Base = newEntry; newEntry.Parse(args, new AtomFeedParser()); } Assert.AreEqual(login.UserName, newEntry.Login.UserName, "Parsed entry should have same username as original entry"); Assert.AreEqual(nickname.Name, newEntry.Nickname.Name, "Parsed entry should have same nickname as original entry"); }
/// <summary> /// Inserts a new nickname 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 NicknameEntry Insert(NicknameFeed feed, NicknameEntry entry) { try { return base.Insert(feed, entry) as NicknameEntry; } catch (GDataRequestException e) { AppsException a = AppsException.ParseAppsException(e); throw a ?? e; } }
/// <summary> /// Inserts a new nickname 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 NicknameEntry Insert(NicknameFeed feed, NicknameEntry entry) { try { return(base.Insert(feed, entry) as NicknameEntry); } catch (GDataRequestException e) { AppsException a = AppsException.ParseAppsException(e); throw a ?? e; } }
/// <summary> /// Overridden Delete method that throws AppsException /// </summary> /// <param name="entry">the NicknameEntry to delete</param> public void Delete(NicknameEntry entry) { try { base.Delete(entry); } catch (GDataRequestException e) { AppsException a = AppsException.ParseAppsException(e); throw (a == null ? e : a); } }
/// <summary> /// Creates a nickname for the specified user. /// </summary> /// <param name="username">the user account for which you are creating a nickname</param> /// <param name="nickname">the nickname for the user account</param> /// <returns>the newly created NicknameEntry object</returns> public NicknameEntry CreateNickname(string username, string nickname) { NicknameQuery query = new NicknameQuery(Domain); NicknameEntry entry = new NicknameEntry(); entry.Login = new LoginElement(username); entry.Nickname = new NicknameElement(nickname); return(nicknameService.Insert(query.Uri, entry)); }
/// <summary> /// Inserts a new nickname entry into the feed at the /// specified URI. /// </summary> /// <param name="feedUri">the URI of the feed into which this entry should be inserted</param> /// <param name="entry">the entry to insert</param> /// <returns>the inserted entry</returns> public NicknameEntry Insert(Uri feedUri, NicknameEntry entry) { try { return(base.Insert(feedUri, entry) as NicknameEntry); } catch (GDataRequestException e) { AppsException a = AppsException.ParseAppsException(e); throw (a == null ? e : a); } }
/// <summary> /// Creates a nickname for the specified user. /// </summary> /// <param name="username">the user account for which you are creating a nickname</param> /// <param name="nickname">the nickname for the user account</param> /// <returns>the newly created NicknameEntry object</returns> public NicknameEntry CreateNickname(string username, string nickname) { NicknameQuery query = new NicknameQuery(Domain); NicknameEntry entry = new NicknameEntry(); entry.Login = new LoginElement(username); entry.Nickname = new NicknameElement(nickname); return nicknameService.Insert(query.Uri, entry); }
public void Init() { entry = new NicknameEntry(); }
/// <summary> /// Inserts a new nickname entry into the feed at the /// specified URI. /// </summary> /// <param name="feedUri">the URI of the feed into which this entry should be inserted</param> /// <param name="entry">the entry to insert</param> /// <returns>the inserted entry</returns> public NicknameEntry Insert(Uri feedUri, NicknameEntry entry) { try { return base.Insert(feedUri, entry) as NicknameEntry; } catch (GDataRequestException e) { AppsException a = AppsException.ParseAppsException(e); throw (a == null ? e : a); } }