Пример #1
0
        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);
            }
        }