Exemplo n.º 1
0
        public void Removing()
        {
            var topics = new TopicManager();

            Assert.AreEqual(0, topics.GetPeers("alpha").Count());

            topics.AddInterest("alpha", a);
            topics.AddInterest("alpha", b);
            Assert.AreEqual(2, topics.GetPeers("alpha").Count());

            topics.RemoveInterest("alpha", a);
            Assert.AreEqual(b, topics.GetPeers("alpha").First());
            Assert.AreEqual(1, topics.GetPeers("alpha").Count());

            topics.RemoveInterest("alpha", a);
            Assert.AreEqual(b, topics.GetPeers("alpha").First());
            Assert.AreEqual(1, topics.GetPeers("alpha").Count());

            topics.RemoveInterest("alpha", b);
            Assert.AreEqual(0, topics.GetPeers("alpha").Count());

            topics.RemoveInterest("beta", b);
            Assert.AreEqual(0, topics.GetPeers("beta").Count());
        }