public void AddRemoveNodeTest() { using (mocks.Record()) { Expect.Call(stream.Document).Return(doc); SetupTrackerBeginIq(delegate { return(true); }); } using (mocks.Playback()) { PubSubManager mgr = GetPubSubMgr(); mgr.GetNode(jid, NODE, 0); FieldInfo fieldInfo = mgr.GetType().GetField("m_nodes", BindingFlags.Instance | BindingFlags.NonPublic); IDictionary nodes = (IDictionary)fieldInfo.GetValue(mgr); if (nodes == null || nodes.Count != 1) { Assert.Fail("The GetNode function failed"); } mgr.RemoveNode(jid, NODE, null); Assert.IsTrue(nodes[new JIDNode(jid, NODE)] == null); } }
private void deletePubSubToolStripMenuItem_Click(object sender, EventArgs e) { PubSubSubcribeForm fm = setupPubSubForm(); if (fm.ShowDialog() != DialogResult.OK) { return; } JID jid = fm.JID; string node = fm.Node; psm.RemoveNode(jid, node, delegate { MessageBox.Show("Remove Node unsuccessful."); }); tabControl1.TabPages.RemoveByKey(string.Format("{0}/{1}", jid, node)); }
public void RemoveNodeTest() { using (mocks.Record()) { Expect.Call(stream.Document).Return(doc); SetupTrackerBeginIq(delegate(IQ iq, IqCB cb, object cbArg) { string id = iq.GetAttribute("id"); string original = iq.OuterXml.Replace(" ", ""); string comparison = GetRemoveNodeIq(id).Replace(" ", ""); return(original == comparison); }); } using (mocks.Playback()) { PubSubManager mgr = GetPubSubMgr(); mgr.RemoveNode(jid, NODE, null); } }