Ejemplo n.º 1
0
        public void Test_0202_Delete_server_error()
        {
            Kii.Initialize("appId", "appKey", Kii.Site.US);
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.HttpClientFactory = factory;

            // set response
            MockHttpClient client = factory.Client;

            this.SetStandardSaveResponse(client);

            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["name"] = "Kii";
            obj["age"]  = 18;

            obj.Save();

            Assert.AreEqual("d8dc9f29-0fb9-48be-a80c-ec60fddedb54", obj.ID);
            Assert.AreEqual(1337039114613, obj.CreatedTime);
            Assert.AreEqual(1337039114613, obj.ModifedTime);

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

            obj.Delete();
        }
Ejemplo n.º 2
0
        public void Test_1_1_CountAllWhenObjectNotExists()
        {
            string    bucketName = "TestBucket" + CurrentTimeMillis();
            KiiBucket bucket     = Kii.Bucket(bucketName);

            KiiBucket      callbackBucket = null;
            KiiQuery       callbackQuery  = null;
            int            count          = -1;
            Exception      exp            = null;
            CountDownLatch cd             = new CountDownLatch(1);

            bucket.Count((KiiBucket b, KiiQuery q, int c, Exception e) => {
                callbackBucket = b;
                callbackQuery  = q;
                count          = c;
                exp            = e;
                cd.Signal();
            });

            if (!cd.Wait(new TimeSpan(0, 0, 0, 3)))
            {
                Assert.Fail("Callback not fired.");
            }
            Assert.IsNotNull(callbackBucket);
            Assert.AreEqual(bucket.Uri, callbackBucket.Uri);
            Assert.IsNotNull(callbackQuery);
            Assert.AreEqual(new KiiQuery(null).ToString(), callbackQuery.ToString());
            Assert.IsNull(exp);
            Assert.AreEqual(0, count);
        }
Ejemplo n.º 3
0
        public void Test_0120_Save_Update_No_Overwrite()
        {
            Kii.Initialize("appId", "appKey", Kii.Site.US);
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.HttpClientFactory = factory;

            // set response
            MockHttpClient client = factory.Client;

            this.SetStandardSaveResponse(client);

            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["name"] = "Kii";
            obj["age"]  = 18;

            obj.Save();

            Assert.AreEqual("d8dc9f29-0fb9-48be-a80c-ec60fddedb54", obj.ID);
            Assert.AreEqual(1337039114613, obj.CreatedTime);
            Assert.AreEqual(1337039114613, obj.ModifedTime);

            // update
            obj["age"] = 19;

            // set Response
            client.AddResponse(200, "{\"modifiedAt\": 3456}");

            obj.SaveAllFields(false);
            Assert.AreEqual(1337039114613, obj.CreatedTime);
            Assert.AreEqual(3456, obj.ModifedTime);
        }
Ejemplo n.º 4
0
        public void Test_0200_Delete()
        {
            Kii.Initialize("appId", "appKey", Kii.Site.US);
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.HttpClientFactory = factory;

            // set response
            MockHttpClient client = factory.Client;

            this.SetStandardSaveResponse(client);

            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["name"] = "Kii";
            obj["age"]  = 18;

            obj.Save();

            Assert.AreEqual("d8dc9f29-0fb9-48be-a80c-ec60fddedb54", obj.ID);
            Assert.AreEqual(1337039114613, obj.CreatedTime);
            Assert.AreEqual(1337039114613, obj.ModifedTime);
            // set body content-type
            SDKTestHack.SetField(obj, "mBodyContentType", "text/plain");

            // set Response
            client.AddResponse(204, "");

            obj.Delete();
            Assert.AreEqual(-1, obj.CreatedTime);
            Assert.AreEqual(-1, obj.ModifedTime);
            Assert.AreEqual(null, obj.Uri);
            Assert.IsNull(obj.BodyContentType);
        }
Ejemplo n.º 5
0
        public void Test_0003_Save_2times()
        {
            Kii.Initialize("appId", "appKey", Kii.Site.US);
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.HttpClientFactory = factory;

            // set response
            MockHttpClient client = factory.Client;

            this.SetStandardSaveResponse(client);

            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["name"] = "Kii";
            obj["age"]  = 18;

            obj.Save();

            Assert.AreEqual("d8dc9f29-0fb9-48be-a80c-ec60fddedb54", obj.ID);
            Assert.AreEqual(1337039114613, obj.CreatedTime);
            Assert.AreEqual(1337039114613, obj.ModifedTime);

            // clear stub
            client.RequestBody.Clear();
            // set Response
            client.AddResponse(200, "{\"_created\": 1234,\"_modified\": 3456}");

            obj["score"] = 80;

            obj.Save();

            Assert.AreEqual("{\"score\":80}", client.RequestBody[0]);
        }
Ejemplo n.º 6
0
        public void Test_0201_Delete_No_ID()
        {
            // set response
            this.SetStandardSaveResponse();

            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["name"] = "Kii";
            obj["age"]  = 18;

            bool      done      = false;
            KiiObject outObj    = null;
            Exception exception = null;

            obj.Delete((KiiObject deletedObj, Exception e) =>
            {
                done      = true;
                outObj    = deletedObj;
                exception = e;
            });

            Assert.IsTrue(done);
            Assert.IsNotNull(outObj);
            Assert.IsNotNull(exception);
            Assert.IsTrue(exception is InvalidOperationException);
        }
Ejemplo n.º 7
0
        public void Test_0001_Save_server_error()
        {
            // set response
            client.AddResponse(new CloudException(400, "{}"));

            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["name"] = "Kii";
            obj["age"]  = 18;

            bool      done      = false;
            KiiObject outObj    = null;
            Exception exception = null;

            obj.Save((KiiObject createdObj, Exception e) =>
            {
                done      = true;
                outObj    = createdObj;
                exception = e;
            });

            Assert.IsTrue(done);
            Assert.IsNotNull(outObj);
            Assert.IsNotNull(exception);
            Assert.IsTrue(exception is CloudException);
            Assert.AreEqual(400, (exception as CloudException).Status);
        }
Ejemplo n.º 8
0
        public void Test_4_24_CreateWithQuery_InCloud_Patch_Overwrite_EtagNotMatch()
        {
            Kii.Initialize("appId", "appKey", Kii.Site.US);
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.HttpClientFactory = factory;

            // set response
            MockHttpClient client = factory.Client;

            client.AddResponse(201, "{" +
                               "\"results\" : [" +
                               "{" +
                               "\"_created\" : 1," +
                               "\"_modified\" : 1," +
                               "\"key\" : \"value\"," +
                               "\"_id\" : \"abcd-1234\"," +
                               "\"_version\" : \"1\" " +
                               "}]" +
                               "}");

            KiiQueryResult <KiiObject> result = Kii.Bucket("test").Query(null);

            Assert.AreEqual(1, result.Count);
            KiiObject obj = result[0];

            string mockResponseBody = "{\"errorCode\" : \"OBJECT_VERSION_IN_STALE\"}";

            client.AddResponse(new CloudException(409, mockResponseBody));
            obj["key1"] = "value1";
            CloudException exp = null;

            try {
                obj.Save(true);
                Assert.Fail("Exception not thrown");
            } catch (CloudException e) {
                exp = e;
            }
            Assert.IsNotNull(exp);
            Assert.AreEqual(409, exp.Status);
            Assert.AreEqual(mockResponseBody, exp.Body);

            // check request
            string url = Utils.Path(ConstantValues.DEFAULT_BASE_URL, "apps", "appId", "buckets", "test", "objects", "abcd-1234");

            Assert.AreEqual(url, client.RequestUrl[1]);
            Assert.AreEqual(KiiHttpMethod.POST, client.RequestMethod[1]);
            MockHttpHeaderList headerList = client.RequestHeader[1];

            Assert.AreEqual("appId", headerList["X-Kii-AppID"]);
            Assert.AreEqual("appKey", headerList["X-Kii-AppKey"]);
            Assert.AreEqual("PATCH", headerList["X-HTTP-Method-Override"]);
            Assert.IsTrue(headerList["X-Kii-SDK"].StartsWith("sn=cs;sv="));

            string     reqBody          = "{\"key1\" : \"value1\"}";
            JsonObject expectedBodyJson = new JsonObject(reqBody);
            JsonObject actualBodyJson   = new JsonObject(client.RequestBody[1]);

            KiiAssertion.AssertJson(expectedBodyJson, actualBodyJson);
        }
        public void Test_1_15_CreateWithId_InCloud_NoPatch_NotOverwrite_EtagNotMatch()
        {
            Kii.Initialize("appId", "appKey", Kii.Site.US);
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.HttpClientFactory = factory;
            string objId = "abcd-1234";

            // save object to cloud
            MockHttpClient client = factory.Client;

            client.AddResponse(201, "{\"createdAt\" : 1, \"modifiedAt\" : 1}", "1");

            KiiObject obj = Kii.Bucket("test").NewKiiObject(objId);

            obj["key"] = "value";
            obj.SaveAllFields(true);
            Assert.AreEqual("abcd-1234", obj.ID);
            Assert.AreEqual(1, obj.CreatedTime);
            Assert.AreEqual(1, obj.ModifedTime);
            string etag = (string)SDKTestHack.GetField(obj, "mEtag");

            Assert.AreEqual("1", etag);

            // server send error response (assume object already updated in server side)
            string mockResponseBody = "{\"errorCode\" : \"OBJECT_VERSION_IN_STALE\"}";

            client.AddResponse(new CloudException(409, mockResponseBody));
            obj["key1"] = "value1";
            CloudException exp = null;

            try {
                obj.SaveAllFields(false);
                Assert.Fail("Exception not thrown");
            } catch (CloudException e) {
                exp = e;
            }
            Assert.IsNotNull(exp);
            Assert.AreEqual(409, exp.Status);
            Assert.AreEqual(mockResponseBody, exp.Body);


            // request contains if-match
            string url = Utils.Path(ConstantValues.DEFAULT_BASE_URL, "apps", "appId", "buckets", "test", "objects", objId);

            Assert.AreEqual(url, client.RequestUrl[1]);
            Assert.AreEqual(KiiHttpMethod.PUT, client.RequestMethod[1]);
            MockHttpHeaderList headerList = client.RequestHeader[1];

            Assert.AreEqual("appId", headerList["X-Kii-AppID"]);
            Assert.AreEqual("appKey", headerList["X-Kii-AppKey"]);
            Assert.IsTrue(headerList["X-Kii-SDK"].StartsWith("sn=cs;sv="));
            Assert.AreEqual("1", headerList["If-Match"]);

            string     reqBody          = "{ \"key\" : \"value\", \"key1\" : \"value1\"}";
            JsonObject expectedBodyJson = new JsonObject(reqBody);
            JsonObject actualBodyJson   = new JsonObject(client.RequestBody[1]);

            KiiAssertion.AssertJson(expectedBodyJson, actualBodyJson);
        }
Ejemplo n.º 10
0
        public void Test_0205_ListAclEntries_QUERY_ONLY()
        {
            LogIn("test-user-00001");
            // set response
            client.AddResponse(200, "{" +
                               "\"QUERY_OBJECTS_IN_BUCKET\":[" +
                               "{\"userID\":\"user1234\"}" +
                               "]" +
                               "}"
                               );

            KiiBucket bucket = Kii.Bucket("test");

            // list
            IList <KiiACLEntry <KiiBucket, BucketAction> > entries = bucket.ListAclEntries();

            Assert.AreEqual(1, entries.Count);

            // entry 1
            KiiACLEntry <KiiBucket, BucketAction> entry = entries[0];

            Assert.AreEqual(BucketAction.QUERY_OBJECTS_IN_BUCKET, entry.Action);
            Assert.IsTrue(entry.Subject is KiiUser);
            Assert.AreEqual("kiicloud://users/user1234", ((KiiUser)entry.Subject).Uri.ToString());
        }
Ejemplo n.º 11
0
        public void TestSDKInfoIncludedInRequestHeader()
        {
            Kii.Initialize("appId", "appKey", Kii.Site.US);
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.HttpClientFactory = factory;

            // set response
            MockHttpClient client = factory.Client;

            client.AddResponse(200, "{\"objectID\": 1, \"createdAt\": 1}");

            string    bucketName = "TestBucket";
            KiiBucket bucket     = Kii.Bucket(bucketName);
            KiiObject obj        = bucket.NewKiiObject();

            obj.Save();

            // check request.
            MockHttpHeaderList headerList = client.RequestHeader[0];

            Assert.AreEqual("appId", headerList["X-Kii-AppID"]);
            Assert.AreEqual("appKey", headerList["X-Kii-AppKey"]);
            string sdkInfo = headerList["X-Kii-SDK"];

            Assert.IsNotNull(sdkInfo);
            Assert.IsTrue(sdkInfo.StartsWith("sn=cs;sv="));
        }
Ejemplo n.º 12
0
        public void Test_0101_SaveAllField_false()
        {
            // set response
            this.SetStandardSaveResponse();

            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["name"] = "Kii";
            obj["age"]  = 18;

            bool      done      = false;
            KiiObject outObj    = null;
            Exception exception = null;

            obj.SaveAllFields(false, (KiiObject createdObj, Exception e) =>
            {
                done      = true;
                outObj    = createdObj;
                exception = e;
            });
            Assert.IsTrue(done);
            Assert.IsNotNull(outObj);
            Assert.IsNull(exception);

            Assert.AreEqual("d8dc9f29-0fb9-48be-a80c-ec60fddedb54", outObj.ID);
            Assert.AreEqual(1337039114613, outObj.CreatedTime);
            Assert.AreEqual(1337039114613, outObj.ModifedTime);
        }
        public void Test_3_19_CreateWithNoId_InCloud_Patch_NoOverwrite_EtagNone()
        {
            Kii.Initialize("appId", "appKey", Kii.Site.US);
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.HttpClientFactory = factory;

            // set response
            MockHttpClient client = factory.Client;

            client.AddResponse(201, "{\"objectID\" : \"abcd-1234\", \"createdAt\" : 1, \"modifiedAt\" : 1}", "1");

            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["key"] = "value";
            obj.SaveAllFields(false);
            Assert.AreEqual("abcd-1234", obj.ID);
            Assert.AreEqual(1, obj.CreatedTime);
            Assert.AreEqual(1, obj.ModifedTime);

            client.AddResponse(201, "{\"createdAt\" : 1, \"modifiedAt\" : 1}", "1");
            // set etag to null
            SDKTestHack.SetField(obj, "mEtag", null);
            obj.SaveAllFields(false);
        }
        public void Test_1_19_CreateWithId_InCloud_NoPatch_NoOverwrite_EtagNone()
        {
            Kii.Initialize("appId", "appKey", Kii.Site.US);
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.HttpClientFactory = factory;
            string objId = "abcd-1234";

            // prepare response
            MockHttpClient client = factory.Client;

            client.AddResponse(201, "{\"createdAt\" : 1, \"modifiedAt\" : 1}", "1");

            // save object to cloud
            KiiObject obj = Kii.Bucket("test").NewKiiObject(objId);

            obj["key"] = "value";
            obj.SaveAllFields(true);
            Assert.AreEqual("abcd-1234", obj.ID);
            Assert.AreEqual(1, obj.CreatedTime);
            Assert.AreEqual(1, obj.ModifedTime);
            string etag = (string)SDKTestHack.GetField(obj, "mEtag");

            Assert.AreEqual("1", etag);

            // set etag to null
            SDKTestHack.SetField(obj, "mEtag", null);
            obj.SaveAllFields(false);
        }
Ejemplo n.º 15
0
        public void Test_2_6_CountWithUnsupportedQuery()
        {
            string    bucketName = "bucket" + CurrentTimeMillis();
            KiiBucket bucket     = Kii.Bucket(bucketName);

            for (int i = 0; i < 2; i++)
            {
                KiiObject obj = bucket.NewKiiObject();
                obj ["intField"] = i;
                obj.Save();
            }


            KiiQuery query = new KiiQuery(null);

            query.Limit = 1;

            KiiQueryResult <KiiObject> result = bucket.Query(query);

            Assert.AreEqual(1, result.Count);
            query = result.NextKiiQuery;
            CloudException exp = null;

            try {
                bucket.Count(query);
                Assert.Fail("Exception not thrown");
            } catch (CloudException e) {
                exp = e;
            }
            Assert.IsNotNull(exp);
            Assert.AreEqual(400, exp.Status);
            JsonObject body = new JsonObject(exp.Body);

            Assert.AreEqual("QUERY_NOT_SUPPORTED", body.GetString("errorCode"));
        }
Ejemplo n.º 16
0
        public void Test_0000_NewObject()
        {
            KiiBucket bucket = Kii.Bucket("test");
            KiiObject obj    = bucket.NewKiiObject();

            Assert.IsNotNull(obj);
        }
Ejemplo n.º 17
0
        public void Test_1210_PublishExpiresAt_not_uploaded()
        {
            Kii.Initialize("appId", "appKey", Kii.Site.US);
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.AsyncHttpClientFactory = factory;

            // set response
            MockHttpClient client = factory.Client;

            this.SetStandardResponse(client);

            KiiObject obj       = Kii.Bucket("images").NewKiiObject();
            bool      done      = false;
            string    outUrl    = null;
            Exception exception = null;

            obj.PublishBodyExpiresAt(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc),
                                     (KiiObject obj2, string url, Exception e) =>
            {
                done      = true;
                outUrl    = url;
                exception = e;
            });
            Assert.IsTrue(done);
            Assert.IsNull(outUrl);
            Assert.IsNotNull(exception);
            Assert.IsTrue(exception is InvalidOperationException);
        }
Ejemplo n.º 18
0
        public void Test_0002_Save_broken_json()
        {
            // set response
            client.AddResponse(200, "{}");

            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["name"] = "Kii";
            obj["age"]  = 18;

            bool      done      = false;
            KiiObject outObj    = null;
            Exception exception = null;

            obj.Save((KiiObject createdObj, Exception e) =>
            {
                done      = true;
                outObj    = createdObj;
                exception = e;
            });

            Assert.IsTrue(done);
            Assert.IsNotNull(outObj);
            Assert.IsNotNull(exception);
            Assert.IsTrue(exception is IllegalKiiBaseObjectFormatException);
        }
Ejemplo n.º 19
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);
            }
        }
        public void Test_0101_long_null()
        {
            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["score"] = (long)1234567890123;

            obj.GetLong(null);
        }
        public void Test_0901_Has_null()
        {
            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["score"] = 100;

            obj.Has(null);
        }
        public void Test_0001_int_null()
        {
            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["score"] = 100;

            obj.GetInt(null);
        }
        public void Test_0302_bool_null()
        {
            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["enable"] = true;

            obj.GetBoolean(null);
        }
        public void Test_0201_double_null()
        {
            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["score"] = 12.345;

            obj.GetDouble(null);
        }
Ejemplo n.º 25
0
        public void Test_1_1_CountAllWhenObjectNotExists()
        {
            string    bucketName = "bucket" + CurrentTimeMillis();
            KiiBucket bucket     = Kii.Bucket(bucketName);
            int       count      = bucket.Count();

            Assert.AreEqual(0, count);
        }
        public void Test_0401_string_null()
        {
            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["name"] = "kii";

            obj.GetString(null);
        }
        public void Test_1_3_CountAllAsyncWithNullCallback()
        {
            string        bucketName = "TestBucket";
            KiiBucket     bucket     = Kii.Bucket(bucketName);
            CountCallback callback   = null;

            bucket.Count(callback);
        }
Ejemplo n.º 28
0
        public void Test_2_6_CountWithUnsupportedQuery()
        {
            MockHttpClientFactory factory = new MockHttpClientFactory();

            Kii.HttpClientFactory = factory;

            // set response
            MockHttpClient client           = factory.Client;
            string         mockResponseBody = "{\"errorCode\" : \"QUERY_NOT_SUPPORTED\"}";

            client.AddResponse(new CloudException(400, mockResponseBody));

            string    bucketName = "TestBucket";
            KiiBucket bucket     = Kii.Bucket(bucketName);
            KiiClause clause     = KiiClause.Equals("key", "value");
            KiiQuery  query      = new KiiQuery(clause);

            query.NextPaginationKey = "pkey";
            CloudException exp = null;

            try {
                bucket.Count(query);
                Assert.Fail("Exception not thrown");
            } catch (CloudException e) {
                exp = e;
            }
            Assert.IsNotNull(exp);
            Assert.AreEqual(400, exp.Status);
            Assert.AreEqual(mockResponseBody, exp.Body);

            // check request.
            string url = Utils.Path(ConstantValues.DEFAULT_BASE_URL, "apps", "appId", "buckets", "TestBucket", "query");

            Assert.AreEqual(url, client.RequestUrl[0]);
            Assert.AreEqual(KiiHttpMethod.POST, client.RequestMethod[0]);
            MockHttpHeaderList headerList = client.RequestHeader[0];

            Assert.AreEqual("appId", headerList["X-Kii-AppID"]);
            Assert.AreEqual("appKey", headerList["X-Kii-AppKey"]);
            String queryStr = "{ " +
                              "\"bucketQuery\" : {" +
                              "\"clause\" : {" +
                              "\"type\" : \"eq\"," +
                              "\"field\" : \"key\"," +
                              "\"value\" : \"value\"" +
                              "}," +
                              "\"aggregations\" : [ {" +
                              "\"type\" : \"COUNT\"," +
                              "\"putAggregationInto\" : \"count_field\"" +
                              "}]" +
                              "}, " +
                              "\"paginationKey\" : \"pkey\"" +
                              "}";
            JsonObject expectedBodyJson = new JsonObject(queryStr);
            JsonObject actualBodyJson   = new JsonObject(client.RequestBody[0]);

            KiiAssertion.AssertJson(expectedBodyJson, actualBodyJson);
        }
        public void Test_0011_int_fallback_null()
        {
            KiiObject obj = Kii.Bucket("test").NewKiiObject();

            obj["score"] = 100;

            Assert.AreEqual(100, obj.GetInt("score", -1));
            Assert.AreEqual(-1, obj.GetInt(null, -1));
        }
        public void Test_2_3_CountAllAsyncWithNullCallback()
        {
            string        bucketName = "TestBucket";
            KiiBucket     bucket     = Kii.Bucket(bucketName);
            KiiQuery      query      = new KiiQuery(null);
            CountCallback callback   = null;

            bucket.Count(query, callback);
        }