Пример #1
0
        public void listings()
        {
            // documentation example 1
            PubSub_Listing core = new PubSub_Listing();
            core.CreateChannel("/public/chatrooms/A21", "The Best Chat Room");
            core.CreateChannel("/public/chatrooms/A22", "<3 Phil Collins");
            core.CreateChannel("/public/chatrooms/B12", "80's Music Fans ONLY!");

            listings l = new listings(core);
            string expected = "[9,[\"\\/public\\/chatrooms\\/A21\",\"\\/public\\/chatrooms\\/A22\",\"\\/public\\/chatrooms\\/B12\"],[\"The Best Chat Room\",\"\\u003C3 Phil Collins\",\"80's Music Fans ONLY!\"]]";
            string result = l.ToString();
            Assert.AreEqual(expected, result);
        }
Пример #2
0
        public void acknowledge()
        {
            // documentation example 1
            PubSub_Listing core = new PubSub_Listing();
            core.CreateChannel("/rss/news/latest");

            acknowledge a = new acknowledge(core.channels[0], false);
            string expected = "[11,\"\\/rss\\/news\\/latest\"]";
            string result = a.ToString();
            Assert.AreEqual(expected, result);

            // documentation example 2
            a.allow_publishing = true;
            expected = "[11,\"\\/rss\\/news\\/latest\",true]";
            result = a.ToString();
            Assert.AreEqual(expected, result);

            a.allow_publishing = false;
            a.channel.Set_Max(99);
            for (int i = 0; i < 120; i++)
            {
                a.channel.add_event("test");
            }
            PubSub_Event e = new PubSub_Event("test old", 41267360);
            a.channel.add_event(e);
            expected = "[11,\"\\/rss\\/news\\/latest\",false,99,41267360]";
        }