コード例 #1
0
        public void Test_0023_Save_update_add_remove_server_error_partial()
        {
            this.LogIn();

            KiiGroup group = KiiGroup.CreateByUri(new Uri("kiicloud://groups/group1234"));

            KiiUser user = KiiUser.CreateByUri(new Uri("kiicloud://users/user1234"));

            group.RemoveUser(user);

            user = KiiUser.CreateByUri(new Uri("kiicloud://users/user5678"));
            group.AddUser(user);

            // set Response
            client.RequestUrl.Clear();
            this.SetStandardSaveResponse(client);
            client.AddResponse(new CloudException(400, "{}"));

            try
            {
                group.Save();
            }
            catch (GroupOperationException e)
            {
                Assert.AreEqual(0, e.AddFailedUsers.Count);
                Assert.AreEqual(1, e.RemoveFailedUsers.Count);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public void TestGetIDAfterSave()
        {
            Kii.Initialize("appId", "appKey", Kii.Site.US);
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.HttpClientFactory = factory;

            MockHttpClient client = factory.Client;

            // login
            client.AddResponse(200, "{" +
                               "\"id\" : \"user1234\"," +
                               "\"access_token\" : \"cdef\"," +
                               "\"expires_in\" : 9223372036854775}");
            KiiUser.LogIn("kii1234", "pass1234");

            client.AddResponse(200, "{" +
                               "\"groupID\" : \"dummyId\"" +
                               "}");
            KiiGroup group = Kii.Group("MyGroup");

            group.Save();

            Assert.AreEqual("dummyId", group.ID);
            Assert.AreEqual("MyGroup", group.Name);
        }
コード例 #4
0
        public void Test_0002_Save_broken_json()
        {
            this.LogIn();

            KiiGroup group = Kii.Group("testGroup");

            KiiUser user = KiiUser.CreateByUri(new Uri("kiicloud://users/user1234"));

            group.AddUser(user);

            // set Response
            client.AddResponse(200, "{}");

            bool      done           = false;
            KiiGroup  savedGroup     = null;
            Exception savedException = null;

            group.Save((KiiGroup retGroup, Exception retExp) =>
            {
                done           = true;
                savedGroup     = retGroup;
                savedException = retExp;
            });

            Assert.IsTrue(done);
            Assert.IsNotNull(savedException);
            Assert.IsTrue(savedException is IllegalKiiBaseObjectFormatException);
            Assert.IsNotNull(savedGroup);
            Assert.AreEqual("testGroup", savedGroup.Name);
        }
コード例 #5
0
        public void Test_0001_Save_server_error()
        {
            this.LogIn();

            KiiGroup group = Kii.Group("testGroup");

            KiiUser user = KiiUser.CreateByUri(new Uri("kiicloud://users/user1234"));

            group.AddUser(user);

            // set Response
            client.AddResponse(new CloudException(400, "{ \"errorCode\" : \"INVALID_INPUT_DATA\", \"message\" : \"There are validation errors\", \"suppressed\" : [ ]}"));

            bool      done           = false;
            KiiGroup  savedGroup     = null;
            Exception savedException = null;

            group.Save((KiiGroup retGroup, Exception retExp) =>
            {
                done           = true;
                savedGroup     = retGroup;
                savedException = retExp;
            });

            Assert.IsTrue(done);
            Assert.IsNotNull(savedException);
            Assert.IsTrue(savedException is GroupOperationException);
            Assert.IsNotNull(savedGroup);
            Assert.AreEqual("testGroup", savedGroup.Name);
        }
コード例 #6
0
        public void Test_0012_Save_update_delete()
        {
            this.LogIn();

            KiiGroup group = KiiGroup.CreateByUri(new Uri("kiicloud://groups/group1234"));

            KiiUser user = KiiUser.CreateByUri(new Uri("kiicloud://users/user1234"));

            group.RemoveUser(user);


            // set Response
            client.RequestUrl.Clear();
            this.SetStandardSaveResponse();

            bool      done           = false;
            KiiGroup  savedGroup     = null;
            Exception savedException = null;

            group.Save((KiiGroup retGroup, Exception retExp) =>
            {
                done           = true;
                savedGroup     = retGroup;
                savedException = retExp;
            });

            Assert.IsTrue(done);
            Assert.IsNull(savedException);
            Assert.IsNotNull(savedGroup);

            Assert.AreEqual(1, client.RequestUrl.Count);
            Assert.AreEqual("https://api.kii.com/api/apps/appId/groups/group1234/members/user1234", client.RequestUrl [0]);
        }
コード例 #7
0
        public void Test_0504_remove_member()
        {
            // Create test user for group owner
            string  userID = TextUtils.generateUUID();
            KiiUser user   = KiiUser.CreateByUri(new Uri("kiicloud://users/" + userID));

            SDKTestHack.SetField(Kii.Instance, "mLoginUser", user);
            string authToken = TextUtils.generateUUID();

            KiiCloudEngine.UpdateAccessToken(authToken);

            // Prepare group
            string   groupName = TextUtils.randomAlphaNumeric(10);
            string   groupID   = TextUtils.randomAlphaNumeric(26);
            KiiGroup group     = Kii.Group(groupName);

            SDKTestHack.SetField(group, "mId", groupID);
            SDKTestHack.SetField(group, "mOwnerId", userID);

            // Prepare KiiUser for member
            string  memberID = TextUtils.generateUUID();
            KiiUser member   = KiiUser.CreateByUri(new Uri("kiicloud://users/" + memberID));

            group.RemoveUser(member);

            // Check value
            HashSet <KiiUser> addUsers    = (HashSet <KiiUser>)SDKTestHack.GetField(group, "addUsers");
            HashSet <KiiUser> removeUsers = (HashSet <KiiUser>)SDKTestHack.GetField(group, "removeUsers");

            Assert.AreEqual(0, addUsers.Count);
            Assert.AreEqual(1, removeUsers.Count);

            // Prepare mock response for adding user
            client.AddResponse(204, "");

            // Save group
            group.Save();

            // Verify request
            Assert.AreEqual(1, client.RequestUrl.Count);
            Assert.AreEqual(1, client.RequestHeader.Count);
            string requestUrl = AppUtil.getUrlOfSite(AppConst.APP_SITE, AppConst.APP_ID, "groups", groupID, "members", memberID);

            Assert.AreEqual(requestUrl, client.RequestUrl[0]);
            Assert.AreEqual("DELETE", client.RequestMethod[0].ToString());
            IList <MockHttpHeaderList> headers = client.RequestHeader;

            Assert.AreEqual(AppConst.APP_ID, client.RequestHeader[0]["X-Kii-AppID"]);
            Assert.AreEqual(AppConst.APP_KEY, client.RequestHeader[0]["X-Kii-AppKey"]);
            Assert.AreEqual("Bearer " + authToken, client.RequestHeader[0]["Authorization"]);
            Assert.AreEqual(null, client.RequestBody[0]);

            // Verify
            Assert.AreEqual(groupID, group.ID);

            addUsers    = (HashSet <KiiUser>)SDKTestHack.GetField(group, "addUsers");
            removeUsers = (HashSet <KiiUser>)SDKTestHack.GetField(group, "removeUsers");
            Assert.AreEqual(0, addUsers.Count);
            Assert.AreEqual(0, removeUsers.Count);
        }
コード例 #8
0
        public void Test_0000_Save()
        {
            this.LogIn();

            KiiGroup group = Kii.Group("testGroup");

            KiiUser user = KiiUser.CreateByUri(new Uri("kiicloud://users/user1234"));

            group.AddUser(user);

            // set Response
            this.SetStandardSaveResponse();

            bool      done           = false;
            KiiGroup  savedGroup     = null;
            Exception savedException = null;

            group.Save((KiiGroup retGroup, Exception retExp) =>
            {
                done           = true;
                savedGroup     = retGroup;
                savedException = retExp;
            });

            Assert.IsTrue(done);
            Assert.IsNull(savedException);
            Assert.AreEqual("0c4375c7-16f5-4ce6-9cd3-ec24bc0519e9", savedGroup.ID);
        }
コード例 #9
0
        public void Test_Non_Initialize_StorageAPI()
        {
            KiiUser   user   = null;
            KiiGroup  group  = null;
            KiiBucket bucket = null;
            KiiObject obj    = null;

            try
            {
                // User Management
                user = KiiUser.BuilderWithName("hoge").Build();
                user.Register("password");
                Assert.Fail("InvalidOperationException isn't thrown");
            }
            catch (InvalidOperationException e)
            {
                Assert.AreEqual(ErrorInfo.UTILS_KIICLIENT_NULL, e.Message);
            }
            try
            {
                bucket = Kii.Bucket("appbucket");
                bucket.Delete();
                Assert.Fail("InvalidOperationException isn't thrown");
            }
            catch (InvalidOperationException e)
            {
                Assert.AreEqual(ErrorInfo.UTILS_KIICLIENT_NULL, e.Message);
            }
            try
            {
                obj = bucket.NewKiiObject();
                obj.Save();
                Assert.Fail("InvalidOperationException isn't thrown");
            }
            catch (InvalidOperationException e)
            {
                Assert.AreEqual(ErrorInfo.UTILS_KIICLIENT_NULL, e.Message);
            }
            try
            {
                KiiQuery query = new KiiQuery();
                bucket.Query(query);
                Assert.Fail("InvalidOperationException isn't thrown");
            }
            catch (InvalidOperationException e)
            {
                Assert.AreEqual(ErrorInfo.UTILS_KIICLIENT_NULL, e.Message);
            }
            try
            {
                group = Kii.Group("myGroup");
                group.Save();
                Assert.Fail("InvalidOperationException isn't thrown");
            }
            catch (InvalidOperationException e)
            {
                Assert.AreEqual(ErrorInfo.UTILS_KIICLIENT_NULL, e.Message);
            }
        }
コード例 #10
0
        public void Test_1_3_GroupWithID_ExistsInCloud_Refresh_AddMembers()
        {
            // mock refresh response
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.HttpClientFactory = factory;
            MockHttpClient client = (MockHttpClient)factory.Client;

            client.AddResponse(200, "{" +
                               "\"groupID\" : \"dummyId\"," +
                               "\"name\" : \"MyGroup\"," +
                               "\"owner\" : \"user1234\"" +
                               "}");

            // mock response for adding user
            client.AddResponse(201, "{}");

            // create group
            string   groupId = "dummyId";
            KiiGroup group   = KiiGroup.GroupWithID(groupId);

            Assert.IsNull(group.Name);

            // refresh
            group.Refresh();
            Assert.AreEqual("MyGroup", group.Name);

            // add member
            string  memberID = TextUtils.generateUUID();
            KiiUser member   = KiiUser.UserWithID(memberID);

            group.AddUser(member);

            HashSet <KiiUser> addUsers    = (HashSet <KiiUser>)SDKTestHack.GetField(group, "addUsers");
            HashSet <KiiUser> removeUsers = (HashSet <KiiUser>)SDKTestHack.GetField(group, "removeUsers");

            Assert.AreEqual(1, addUsers.Count);
            Assert.AreEqual(0, removeUsers.Count);

            // Save group
            group.Save();

            // Verify add member request
            string requestUrl = Utils.Path(ConstantValues.DEFAULT_BASE_URL, "apps", "appId", "groups", "dummyId", "members", memberID);

            Assert.AreEqual(requestUrl, client.RequestUrl[1]);
            Assert.AreEqual("PUT", client.RequestMethod[1].ToString());
            Assert.AreEqual(AppConst.APP_ID, client.RequestHeader[1]["X-Kii-AppID"]);
            Assert.AreEqual(AppConst.APP_KEY, client.RequestHeader[1]["X-Kii-AppKey"]);
            Assert.AreEqual("Bearer token1234", client.RequestHeader[1]["Authorization"]);
            Assert.AreEqual(null, client.RequestBody[1]);

            // Verify local userList get empty.
            Assert.AreEqual(groupId, group.ID);
            addUsers    = (HashSet <KiiUser>)SDKTestHack.GetField(group, "addUsers");
            removeUsers = (HashSet <KiiUser>)SDKTestHack.GetField(group, "removeUsers");
            Assert.AreEqual(0, addUsers.Count);
            Assert.AreEqual(0, removeUsers.Count);
        }
        private IEnumerator TestStep()
        {
            string  username = StringUtils.RandomAlphabetic(20);
            string  password = StringUtils.RandomAlphabetic(20);
            KiiUser user     = KiiUser.BuilderWithName(username).Build();
            var     task     = RegisterUser(user, password, (KiiUser u, Exception e) => {
                if (e != null)
                {
                    throw new TestFailException();
                }
                Debug.Log("Register user.");
            });

            yield return(StartCoroutine(task));

            // create group
            string   groupname = StringUtils.RandomAlphabetic(20);
            KiiGroup group     = Kii.Group(groupname);

            Exception        exp      = null;
            bool             endFlag  = false;
            KiiGroupCallback callback = (KiiGroup grp, Exception e) => {
                exp     = e;
                endFlag = true;
            };

            group.Save(callback);
            while (!endFlag)
            {
                yield return(new WaitForSeconds(1));
            }

            if (exp != null)
            {
                throw new TestFailException();
            }

            // refresh
            KiiGroup groupWithId = KiiGroup.GroupWithID(group.ID);

            exp     = null;
            endFlag = false;
            groupWithId.Refresh(callback);
            while (!endFlag)
            {
                yield return(new WaitForSeconds(1));
            }
            if (exp != null)
            {
                throw new TestFailException();
            }
            if (!groupname.Equals(groupWithId.Name))
            {
                throw new TestFailException();
            }
            resultFlag = true;
        }
コード例 #12
0
        public void Test_0101_RemoveMyself_FromGroupMember()
        {
            // Create KiiUser for group member
            long    milliseconds = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
            string  memberName   = "kiiGroupMember-" + milliseconds;
            KiiUser member       = KiiUser.BuilderWithName(memberName).Build();

            member.Register("pass1234");
            string memberToken = KiiUser.AccessToken;

            // Create KiiUser for group member
            string  ownerName = "kiiGroupOwner-" + milliseconds;
            KiiUser owner     = KiiUser.BuilderWithName(ownerName).Build();

            owner.Register("pass1234");

            // Create group
            KiiGroup group = Kii.Group("testGroup");

            // Add member and save
            group.AddUser(member);
            group.Save();

            // Auth as member
            KiiUser.LogOut();
            KiiUser.LoginWithToken(memberToken);

            // Try to remove myself from the group
            group.RemoveUser(KiiUser.CurrentUser);
            group.Save();

            // Check value
            HashSet <KiiUser> addUsers    = (HashSet <KiiUser>)SDKTestHack.GetField(group, "addUsers");
            HashSet <KiiUser> removeUsers = (HashSet <KiiUser>)SDKTestHack.GetField(group, "removeUsers");

            Assert.AreEqual(0, addUsers.Count);
            Assert.AreEqual(0, removeUsers.Count);
        }
コード例 #13
0
        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);
        }
コード例 #14
0
        public void Test_0001_Save_server_error()
        {
            this.LogIn();

            KiiGroup group = Kii.Group("testGroup");

            KiiUser user = KiiUser.CreateByUri(new Uri("kiicloud://users/user1234"));

            group.AddUser(user);

            // set Response
            client.AddResponse(new CloudException(400, "{}"));

            group.Save();
        }
コード例 #15
0
        public void Test_0002_Save_broken_json()
        {
            this.LogIn();

            KiiGroup group = Kii.Group("testGroup");

            KiiUser user = KiiUser.CreateByUri(new Uri("kiicloud://users/user1234"));

            group.AddUser(user);

            // set Response
            client.AddResponse(200, "{}");

            group.Save();
        }
コード例 #16
0
        public void Test_0000_Save()
        {
            this.LogIn();

            KiiGroup group = Kii.Group("testGroup");

            KiiUser user = KiiUser.CreateByUri(new Uri("kiicloud://users/user1234"));

            group.AddUser(user);

            // set Response
            this.SetStandardSaveResponse(client);

            group.Save();

            Assert.AreEqual("0c4375c7-16f5-4ce6-9cd3-ec24bc0519e9", group.ID);
        }
コード例 #17
0
        public void Test_0010_Save_update_add()
        {
            this.LogIn();

            KiiGroup group = KiiGroup.CreateByUri(new Uri("kiicloud://groups/group1234"));

            KiiUser user = KiiUser.CreateByUri(new Uri("kiicloud://users/user1234"));

            group.AddUser(user);

            // set Response
            client.RequestUrl.Clear();
            this.SetStandardSaveResponse(client);

            group.Save();

            Assert.AreEqual(1, client.RequestUrl.Count);
            Assert.AreEqual("https://api.kii.com/api/apps/appId/groups/group1234/members/user1234", client.RequestUrl[0]);
        }
コード例 #18
0
        public void Test_0023_Save_update_add_remove_server_error_partial()
        {
            this.LogIn();

            KiiGroup group = KiiGroup.CreateByUri(new Uri("kiicloud://groups/group1234"));

            KiiUser user = KiiUser.CreateByUri(new Uri("kiicloud://users/user1234"));

            group.RemoveUser(user);

            user = KiiUser.CreateByUri(new Uri("kiicloud://users/user5678"));
            group.AddUser(user);

            // set Response
            client.RequestUrl.Clear();
            this.SetStandardSaveResponse();
            client.AddResponse(new CloudException(400, "{ \"errorCode\" : \"INVALID_INPUT_DATA\", \"message\" : \"There are validation errors\", \"suppressed\" : [ ]}"));

            bool      done           = false;
            KiiGroup  savedGroup     = null;
            Exception savedException = null;

            group.Save((KiiGroup retGroup, Exception retExp) =>
            {
                done           = true;
                savedGroup     = retGroup;
                savedException = retExp;
            });

            Assert.IsTrue(done);
            Assert.IsNotNull(savedException);
            Assert.IsTrue(savedException is GroupOperationException);
            Assert.IsNotNull(savedGroup);
            Assert.AreEqual("group1234", savedGroup.ID);

            GroupOperationException groupExp = (GroupOperationException)savedException;

            Assert.AreEqual(0, groupExp.AddFailedUsers.Count);
            Assert.AreEqual(1, groupExp.RemoveFailedUsers.Count);
        }
コード例 #19
0
        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);
        }
        private IEnumerator TestStep()
        {
            string  username = StringUtils.RandomAlphabetic(20);
            string  password = StringUtils.RandomAlphabetic(20);
            KiiUser user     = KiiUser.BuilderWithName(username).Build();
            var     task     = RegisterUser(user, password, (KiiUser u, Exception e) => {
                if (e != null)
                {
                    throw new TestFailException();
                }
                Debug.Log("Register user.");
            });

            yield return(StartCoroutine(task));

            // create group
            string   groupname = StringUtils.RandomAlphabetic(20);
            KiiGroup group     = Kii.Group(groupname);

            Exception        exp      = null;
            bool             endFlag  = false;
            KiiGroupCallback callback = (KiiGroup grp, Exception e) => {
                exp     = e;
                endFlag = true;
            };

            group.Save(callback);
            while (!endFlag)
            {
                yield return(new WaitForSeconds(1));
            }

            if (exp != null)
            {
                throw new TestFailException();
            }

            // refresh
            KiiGroup groupWithId = KiiGroup.GroupWithID(group.ID);

            exp     = null;
            endFlag = false;
            groupWithId.Refresh(callback);
            while (!endFlag)
            {
                yield return(new WaitForSeconds(1));
            }
            if (exp != null)
            {
                throw new TestFailException();
            }
            if (!groupname.Equals(groupWithId.Name))
            {
                throw new TestFailException();
            }

            // change name
            string newGroupName = StringUtils.RandomAlphabetic(20);

            exp     = null;
            endFlag = false;
            groupWithId.ChangeName(newGroupName, callback);
            while (!endFlag)
            {
                yield return(new WaitForSeconds(1));
            }
            if (!newGroupName.Equals(groupWithId.Name))
            {
                throw new TestFailException();
            }

            //check groupname changed in server.
            string     respString  = ApiHelper.get(SDKUtils.GetGroupUFEUri(groupWithId), Kii.AppId, Kii.AppKey, KiiUser.AccessToken);
            JsonObject groupJson   = new JsonObject(respString);
            string     updatedName = groupJson.GetString("name");

            if (!newGroupName.Equals(updatedName))
            {
                throw new TestFailException();
            }
            resultFlag = true;
        }
コード例 #21
0
        public void Test_0502_CreateGroup_with_member()
        {
            // Create test user for group owner
            string  userID = TextUtils.generateUUID();
            KiiUser user   = KiiUser.CreateByUri(new Uri("kiicloud://users/" + userID));

            SDKTestHack.SetField(Kii.Instance, "mLoginUser", user);
            string authToken = TextUtils.generateUUID();

            KiiCloudEngine.UpdateAccessToken(authToken);

            // Prepare KiiUser for member
            string  memberID = TextUtils.generateUUID();
            KiiUser member   = KiiUser.CreateByUri(new Uri("kiicloud://users/" + memberID));

            // Prepare group
            string   groupName = TextUtils.randomAlphaNumeric(10);
            KiiGroup group     = Kii.Group(groupName, new List <KiiUser>()
            {
                member
            });

            // Check value
            HashSet <KiiUser> addUsers    = (HashSet <KiiUser>)SDKTestHack.GetField(group, "addUsers");
            HashSet <KiiUser> removeUsers = (HashSet <KiiUser>)SDKTestHack.GetField(group, "removeUsers");

            Assert.AreEqual(1, addUsers.Count);
            Assert.AreEqual(0, removeUsers.Count);

            // Prepare mock response for creating group
            string     groupID   = TextUtils.randomAlphaNumeric(26);
            JsonObject resEntity = new JsonObject(new Dictionary <string, object>()
            {
                { "groupID", groupID },
                { "notFoundUsers", new JsonArray() }
            });

            client.AddResponse(201, resEntity.ToString());

            // Save group
            group.Save();

            // Verify request
            Assert.AreEqual(1, client.RequestUrl.Count);
            Assert.AreEqual(1, client.RequestHeader.Count);
            string requestUrl = AppUtil.getUrlOfSite(AppConst.APP_SITE, AppConst.APP_ID, "groups");

            Assert.AreEqual(requestUrl, client.RequestUrl[0]);
            Assert.AreEqual("POST", client.RequestMethod[0].ToString());
            IList <MockHttpHeaderList> headers = client.RequestHeader;

            Assert.AreEqual(AppConst.APP_ID, client.RequestHeader[0]["X-Kii-AppID"]);
            Assert.AreEqual(AppConst.APP_KEY, client.RequestHeader[0]["X-Kii-AppKey"]);
            Assert.AreEqual("Bearer " + authToken, client.RequestHeader[0]["Authorization"]);

            JsonObject requestBody = new JsonObject(client.RequestBody[0]);

            Assert.AreEqual(3, requestBody.Length());
            Assert.AreEqual(groupName, requestBody.GetString("name"));
            Assert.AreEqual(userID, requestBody.GetString("owner"));
            Assert.AreEqual(1, requestBody.GetJsonArray("members").Length());
            Assert.AreEqual(memberID, requestBody.GetJsonArray("members").GetString(0));

            // Verify
            Assert.AreEqual(groupID, group.ID);
            Assert.AreEqual(user.ID, group.Owner.ID);

            addUsers    = (HashSet <KiiUser>)SDKTestHack.GetField(group, "addUsers");
            removeUsers = (HashSet <KiiUser>)SDKTestHack.GetField(group, "removeUsers");
            Assert.AreEqual(0, addUsers.Count);
            Assert.AreEqual(0, removeUsers.Count);
        }