public void SetNicknameTest() { NicknameElement nickname = new NicknameElement("john"); entry.Nickname = nickname; Assert.AreEqual(nickname, entry.Nickname, "Nickname should be updated after setting"); }
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"); }
public void Init() { nickname = new NicknameElement("foo"); }