public void Test_GroupScopeAsync()
        {
            KiiGroup group = Kii.Group("test_group");

            group.Save();
            group.Topic("group_topic").Save();

            CountDownLatch cd = new CountDownLatch(1);
            IList <KiiACLEntry <KiiTopic, TopicAction> > entries = null;
            Exception exception = null;

            KiiTopic topic = group.Topic("group_topic");

            topic.ListAclEntries((IList <KiiACLEntry <KiiTopic, TopicAction> > result, Exception e) => {
                entries   = result;
                exception = e;
                cd.Signal();
            });
            if (!cd.Wait(new TimeSpan(0, 0, 0, 20)))
            {
                Assert.Fail("Callback not fired.");
            }
            Assert.IsNull(exception);
            Assert.AreEqual(4, entries.Count);
        }
        public void Test_GroupScope()
        {
            KiiGroup group = Kii.Group("test_group");

            group.Save();
            for (int i = 0; i < 51; i++)
            {
                group.Topic("user_topic" + i).Save();
            }

            CountDownLatch           cd     = new CountDownLatch(1);
            KiiListResult <KiiTopic> topics = null;
            Exception exception             = null;

            group.ListTopics((KiiListResult <KiiTopic> t, Exception e) => {
                topics    = t;
                exception = e;
                cd.Signal();
            });
            if (!cd.Wait(new TimeSpan(0, 0, 0, 20)))
            {
                Assert.Fail("Callback not fired.");
            }
            Assert.IsNull(exception);
            Assert.IsTrue(topics.HasNext);
            Assert.IsNotNull(topics.PaginationKey);
            Assert.AreEqual(50, topics.Result.Count);

            string paginationKey = topics.PaginationKey;

            cd        = new CountDownLatch(1);
            topics    = null;
            exception = null;

            group.ListTopics(paginationKey, (KiiListResult <KiiTopic> t, Exception e) => {
                topics    = t;
                exception = e;
                cd.Signal();
            });
            if (!cd.Wait(new TimeSpan(0, 0, 0, 20)))
            {
                Assert.Fail("Callback not fired.");
            }

            Assert.IsNull(exception);
            Assert.IsFalse(topics.HasNext);
            Assert.IsNull(topics.PaginationKey);
            Assert.AreEqual(1, topics.Result.Count);
        }
        public void Test_GroupScope()
        {
            KiiGroup group = Kii.Group("test_group");

            group.Save();
            group.Topic("group_topic").Save();

            CountDownLatch cd        = new CountDownLatch(1);
            bool?          existence = null;
            Exception      exception = null;

            group.Topic("group_topic").Exists((bool?result, Exception e) => {
                exception = e;
                existence = result;
                cd.Signal();
                return;
            });
            if (!cd.Wait(new TimeSpan(0, 0, 0, 20)))
            {
                Assert.Fail("Callback not fired.");
            }
            Assert.IsNull(exception);
            Assert.IsTrue(existence.Value);
        }