public void KiiTopicAclTest()
        {
            this.LogIn();

            KiiTopic appTopicA  = Kii.Topic("A");
            KiiTopic appTopicA_ = Kii.Topic("A");
            KiiTopic appTopicB  = Kii.Topic("B");
            KiiTopic usrTopicA  = KiiUser.CreateByUri(new Uri("kiicloud://users/user1234")).Topic("A");

            KiiTopicACL acl1 = null;
            KiiTopicACL acl2 = null;

            // same object
            acl1 = new KiiTopicACL(appTopicA);
            acl2 = new KiiTopicACL(appTopicA_);
            Assert.IsTrue(acl1.Equals(acl2));
            Assert.IsTrue(acl1.GetHashCode() == acl2.GetHashCode());
            Assert.IsFalse(acl1 == acl2);
            // same object and action
            acl1 = new KiiTopicACL(appTopicA, TopicAction.SEND_MESSAGE_TO_TOPIC);
            acl2 = new KiiTopicACL(appTopicA_, TopicAction.SEND_MESSAGE_TO_TOPIC);
            Assert.IsTrue(acl1.Equals(acl2));
            Assert.IsTrue(acl1.GetHashCode() == acl2.GetHashCode());
            Assert.IsFalse(acl1 == acl2);
            // different action
            acl1 = new KiiTopicACL(appTopicA, TopicAction.SEND_MESSAGE_TO_TOPIC);
            acl2 = new KiiTopicACL(appTopicA_, TopicAction.SUBSCRIBE_TO_TOPIC);
            Assert.IsFalse(acl1.Equals(acl2));
            Assert.IsFalse(acl1.GetHashCode() == acl2.GetHashCode());
            Assert.IsFalse(acl1 == acl2);
            // different topic name
            acl1 = new KiiTopicACL(appTopicA, TopicAction.SEND_MESSAGE_TO_TOPIC);
            acl2 = new KiiTopicACL(appTopicB, TopicAction.SEND_MESSAGE_TO_TOPIC);
            Assert.IsFalse(acl1.Equals(acl2));
            Assert.IsFalse(acl1.GetHashCode() == acl2.GetHashCode());
            Assert.IsFalse(acl1 == acl2);
            // different scope of bucket
            acl1 = new KiiTopicACL(appTopicA, TopicAction.SEND_MESSAGE_TO_TOPIC);
            acl2 = new KiiTopicACL(usrTopicA, TopicAction.SEND_MESSAGE_TO_TOPIC);
            Assert.IsFalse(acl1.Equals(acl2));
            Assert.IsFalse(acl1.GetHashCode() == acl2.GetHashCode());
            Assert.IsFalse(acl1 == acl2);
        }
        public void KiiTopicAclTest()
        {
            KiiTopicACL acl1 = new KiiTopicACL(Kii.Topic("A"));
            KiiTopicACL acl2 = new KiiTopicACL(Kii.Topic("A"));

            KiiUser userA  = KiiUser.CreateByUri(new Uri("kiicloud://users/userA"));
            KiiUser userA_ = KiiUser.CreateByUri(new Uri("kiicloud://users/userA"));
            KiiUser userB  = KiiUser.CreateByUri(new Uri("kiicloud://users/userB"));
            KiiUser userC  = KiiUser.CreateByUri(new Uri("kiicloud://users/C"));

            KiiGroup groupA  = KiiGroup.CreateByUri(new Uri("kiicloud://groups/groupA"));
            KiiGroup groupA_ = KiiGroup.CreateByUri(new Uri("kiicloud://groups/groupA"));
            KiiGroup groupB  = KiiGroup.CreateByUri(new Uri("kiicloud://groups/groupB"));
            KiiGroup groupC  = KiiGroup.CreateByUri(new Uri("kiicloud://groups/C"));

            KiiACLEntry <KiiTopic, TopicAction> aclEntry1 = null;
            KiiACLEntry <KiiTopic, TopicAction> aclEntry2 = null;

            // same user
            aclEntry1 = new KiiACLEntry <KiiTopic, TopicAction>(acl1, userA);
            aclEntry2 = new KiiACLEntry <KiiTopic, TopicAction>(acl2, userA_);
            Assert.IsTrue(aclEntry1.Equals(aclEntry2));
            Assert.IsTrue(aclEntry1.GetHashCode() == aclEntry2.GetHashCode());
            Assert.IsFalse(aclEntry1 == aclEntry2);
            // same user
            aclEntry1 = new KiiACLEntry <KiiTopic, TopicAction>(acl1, KiiAnonymousUser.Get());
            aclEntry2 = new KiiACLEntry <KiiTopic, TopicAction>(acl2, KiiAnonymousUser.Get());
            Assert.IsTrue(aclEntry1.Equals(aclEntry2));
            Assert.IsTrue(aclEntry1.GetHashCode() == aclEntry2.GetHashCode());
            Assert.IsFalse(aclEntry1 == aclEntry2);
            // different user
            aclEntry1 = new KiiACLEntry <KiiTopic, TopicAction>(acl1, userA);
            aclEntry2 = new KiiACLEntry <KiiTopic, TopicAction>(acl2, userB);
            Assert.IsFalse(aclEntry1.Equals(aclEntry2));
            Assert.IsFalse(aclEntry1.GetHashCode() == aclEntry2.GetHashCode());
            Assert.IsFalse(aclEntry1 == aclEntry2);
            // different user
            aclEntry1 = new KiiACLEntry <KiiTopic, TopicAction>(acl1, KiiAnonymousUser.Get());
            aclEntry2 = new KiiACLEntry <KiiTopic, TopicAction>(acl2, KiiAnyAuthenticatedUser.Get());
            Assert.IsFalse(aclEntry1.Equals(aclEntry2));
            Assert.IsFalse(aclEntry1.GetHashCode() == aclEntry2.GetHashCode());
            Assert.IsFalse(aclEntry1 == aclEntry2);
            // same group
            aclEntry1 = new KiiACLEntry <KiiTopic, TopicAction>(acl1, groupA);
            aclEntry2 = new KiiACLEntry <KiiTopic, TopicAction>(acl2, groupA_);
            Assert.IsTrue(aclEntry1.Equals(aclEntry2));
            Assert.IsTrue(aclEntry1.GetHashCode() == aclEntry2.GetHashCode());
            Assert.IsFalse(aclEntry1 == aclEntry2);
            // different group
            aclEntry1 = new KiiACLEntry <KiiTopic, TopicAction>(acl1, groupA);
            aclEntry2 = new KiiACLEntry <KiiTopic, TopicAction>(acl2, groupB);
            Assert.IsFalse(aclEntry1.Equals(aclEntry2));
            Assert.IsFalse(aclEntry1.GetHashCode() == aclEntry2.GetHashCode());
            Assert.IsFalse(aclEntry1 == aclEntry2);
            // different subject kind
            aclEntry1 = new KiiACLEntry <KiiTopic, TopicAction>(acl1, userC);
            aclEntry2 = new KiiACLEntry <KiiTopic, TopicAction>(acl2, groupC);
            Assert.IsFalse(aclEntry1.Equals(aclEntry2));
            Assert.IsFalse(aclEntry1.GetHashCode() == aclEntry2.GetHashCode());
            Assert.IsFalse(aclEntry1 == aclEntry2);
        }