コード例 #1
0
        public void Test_1_6_Upload_NullCallback()
        {
            KiiAnalytics.Initialize("appID004", "appKey", KiiAnalytics.Site.JP, "dev004");
            KiiEvent ev = KiiAnalytics.NewEvent("type1");

            ev["page"]  = 1;
            ev["label"] = "OK";
            Assert.IsFalse(ev.Sent);

            // set mock
            MockHttpClientFactory factory = new MockHttpClientFactory();

            KiiAnalytics.AsyncHttpClientFactory = factory;
            MockHttpClient client = factory.Client;

            client.AddResponse(204, "");

            // async upload
            KiiEventCallback callback = null;

            KiiAnalytics.Upload(callback, ev);

            // verify event uploaded
            Assert.IsTrue(ev.Sent);
        }
コード例 #2
0
        public void Test_0336_Upload_Partial_broken_json_3()
        {
            KiiAnalytics.Initialize("appID004", "appKey", KiiAnalytics.Site.JP, "dev004");
            KiiEvent[] events = CreateEvents();

            // set mock
            KiiAnalytics.HttpClientFactory = new MockHttpClientFactory();
            MockHttpClient client = ((MockHttpClientFactory)KiiAnalytics.HttpClientFactory).Client;

            client.AddResponse(200,
                               "{" +
                               "\"errorCode\" : \"PARTIAL_SUCCESS\"," +
                               "\"message\" : \"There are some errors in event data\"," +
                               "\"invalidEvents\" : [ \"not Json\"]}");

            try
            {
                KiiAnalytics.Upload(events);
                Assert.Fail("Exception must be thrown");
            }
            catch (EventUploadException e)
            {
                Assert.AreEqual(0, e.ErrorEvents.Count);
            }
        }
コード例 #3
0
        public void Test_1_3_GetResult_Fail()
        {
            // set mock
            MockHttpClientFactory factory = new MockHttpClientFactory();

            KiiAnalytics.AsyncHttpClientFactory = factory;
            MockHttpClient client = factory.Client;

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

            GroupedResult   result    = null;
            string          ruleId    = null;
            ResultCondition condition = null;
            Exception       exp       = null;
            CountDownLatch  cd        = new CountDownLatch(1);

            KiiAnalytics.GetResult("a", null, (string id, ResultCondition c, GroupedResult r, Exception e) => {
                Interlocked.Exchange(ref result, r);
                Interlocked.Exchange(ref ruleId, id);
                Interlocked.Exchange(ref condition, c);
                Interlocked.Exchange(ref exp, e);
                cd.Signal();
            });

            if (!cd.Wait(new TimeSpan(0, 0, 0, 3)))
            {
                Assert.Fail("Callback not fired.");
            }
            Assert.AreEqual(ruleId, "a");
            Assert.IsNull(condition);
            Assert.IsNull(result);
            Assert.IsNotNull(exp);
            Assert.True(exp is CloudException);
        }
コード例 #4
0
        public void Test_0337_Upload_Partial_broken_json_4()
        {
            KiiAnalytics.Initialize("appID004", "appKey", KiiAnalytics.Site.JP, "dev004");
            KiiEvent[] events = CreateEvents();

            // set mock
            KiiAnalytics.HttpClientFactory = new MockHttpClientFactory();
            MockHttpClient client = ((MockHttpClientFactory)KiiAnalytics.HttpClientFactory).Client;

            client.AddResponse(200,
                               "{" +
                               "\"errorCode\" : \"PARTIAL_SUCCESS\"," +
                               "\"message\" : \"There are some errors in event data\"," +
                               "\"invalidEvents\" : [ {" +
                               "\"index\" : \"not number\"," +
                               "\"errorDetails\" : [ {" +
                               "\"fieldName\" : \"_uploadedAt\"," +
                               "\"errorCode\" : \"UPLOADED_AT_MISSING\"," +
                               "\"message\" : \"You must provide event upload time\"}]" +
                               "}]" +
                               "}");

            try
            {
                KiiAnalytics.Upload(events);
                Assert.Fail("Exception must be thrown");
            }
            catch (EventUploadException e)
            {
                Assert.AreEqual(0, e.ErrorEvents.Count);
            }
        }
コード例 #5
0
        public void Test_0304_Upload_float_min()
        {
            KiiAnalytics.Initialize("appID004", "appKey", KiiAnalytics.Site.JP, "dev004");
            KiiEvent ev = KiiAnalytics.NewEvent("type1");

            ev["page"]  = float.MinValue;
            ev["label"] = "OK";

            // set mock
            KiiAnalytics.HttpClientFactory = new MockHttpClientFactory();
            MockHttpClient client = ((MockHttpClientFactory)KiiAnalytics.HttpClientFactory).Client;

            client.AddResponse(204, "");

            KiiAnalytics.Upload(ev);

            Assert.AreEqual("https://api-jp.kii.com/api/apps/appID004/events", client.RequestUrl[0]);
            Assert.AreEqual("application/vnd.kii.EventRecordList+json", client.RequestContentType[0]);
            JsonArray  array = new JsonArray(client.RequestBody[0]);
            JsonObject json  = array.GetJsonObject(0);
            int        count = ToCount(json.Keys());

            Assert.AreEqual(6, count);
            Assert.AreEqual(float.MinValue, json.GetDouble("page"));
            Assert.AreEqual("OK", json.GetString("label"));
            Assert.AreEqual("dev004", json.GetString("_deviceID"));
            Assert.AreEqual("type1", json.GetString("_type"));
            Assert.IsTrue(json.Has("_triggeredAt"));
            Assert.IsTrue(json.Has("_uploadedAt"));
        }
コード例 #6
0
        public void Test_0000_result()
        {
            // set Response
            client.AddResponse(200, "{" +
                               "\"snapshots\" : [ {" +
                               "\"name\" : \"Male\"," +
                               "\"data\" : [ 222.294835, 184.859009, 453.422571, 185.310889, 434.687488, 315.944617, 218.675664, 332.096156, 474.059216, 427.635396, 607.377385, 182.989111, 267.282833, 237.294397, 585.562209, 127.352572, 456.195061, 529.733865, 455.323995, 304.316517, 275.685962, 291.335683, 354.212864, 106.744223, 483.895313, 457.807643, 370.337862, 353.872758, 454.131286, 424.851845, 484.060775, 408.070000, 281.822881, 479.177081, 460.197312, 523.185927, 490.907883, 514.245721, 216.094391, 328.348445, 435.999564, 380.014523, 400.103032, 405.576053, 187.472656, 444.090072, 431.877222, 544.836822, 217.047206, 297.560631, 314.844519, 474.073309, 364.085242, 552.185623, 546.595184, 288.153741, 557.183213, 96.317067, 265.017995, 385.089756, 300.245837, 386.901327, 322.140900, 277.306892, 466.558671, 410.920488, 609.337438, 304.479284, 497.136333, 310.189396, 281.707101, 234.958195, 264.602315, 284.586213, 251.030762, 371.324380, 263.875690, 329.653625, 388.521379, 361.096650, 469.496049, 196.725086, 452.307670, 307.137883, 318.312414, 248.647910, 276.700819, 189.217764, 546.775207 ]," +
                               "\"pointStart\" : 1338044400000," +
                               "\"pointInterval\" : 86400000}, " +
                               "{" +
                               "\"name\" : \"Female\"," +
                               "\"data\" : [ 346.305236, 501.444413, 617.671229, 537.357017, 355.478067, 404.642204, 364.288033, 565.898442, 270.366472, 111.157234, 304.692874, 377.427459, 297.359837, 446.025727, 194.513834, 227.794766, 496.519506, 382.536019, 322.876513, 523.961579, 305.243624, 335.280346, 394.433233, 204.628791, 331.097080, 345.934077, 317.861409, 309.969498, 500.848069, 282.480485, 409.545528, 422.166471, 397.133416, 368.552844, 392.834897, 396.818330, 315.194726, 187.574257, 381.826013, 545.207723, 339.240000, 84.996984, 486.240724, 328.812197, 369.365575, 171.141350, 427.793929, 290.233798, 443.794539, 243.286860, 311.815673, 341.051886, 340.875463, 260.142600, 381.126592, 276.706563, 211.045746, 530.105022, 228.239281, 337.375485, 301.008514, 309.429648, 277.987930, 467.552527, 310.626487, 308.933878, 210.379692, 184.297412, 289.776182, 594.744936, 463.423854, 326.469224, 289.920369, 291.238148, 408.031207, 244.472051, 308.886730, 522.389382, 461.119893, 291.509892, 354.703656, 422.712123, 279.998337, 360.828966, 251.726391, 253.988308, 176.768056, 253.481142, 325.216381 ]," +
                               "\"pointStart\" : 1338044400000," +
                               "\"pointInterval\" : 86400000}" +
                               "]}");

            GroupedResult result = KiiAnalytics.GetResult("a", null);

            Assert.IsNotNull(result.SnapShots);
            IList <GroupedSnapShot> snapshots = result.SnapShots;

            Assert.AreEqual(2, snapshots.Count);

            GroupedSnapShot snapShot1 = snapshots[0];

            Assert.AreEqual("Male", snapShot1.Name);
            Assert.AreEqual(1338044400000, snapShot1.PointStart);
            Assert.AreEqual(86400000, snapShot1.PointInterval);
            JsonArray data = snapShot1.Data;

            Assert.AreEqual(89, data.Length());

            GroupedSnapShot snapShot2 = snapshots[1];

            Assert.AreEqual("Female", snapShot2.Name);
            Assert.AreEqual(1338044400000, snapShot2.PointStart);
            Assert.AreEqual(86400000, snapShot2.PointInterval);
            data = snapShot2.Data;
            Assert.AreEqual(89, data.Length());
        }
コード例 #7
0
        public void Test_0334_Upload_Partial_broken_json_1()
        {
            KiiAnalytics.Initialize("appID004", "appKey", KiiAnalytics.Site.JP, "dev004");
            KiiEvent[] events = CreateEvents();

            // set mock
            KiiAnalytics.HttpClientFactory = new MockHttpClientFactory();
            MockHttpClient client = ((MockHttpClientFactory)KiiAnalytics.HttpClientFactory).Client;

            client.AddResponse(200, "broken");

            KiiAnalytics.Upload(events);
        }
コード例 #8
0
        public void Test_1_9_Upload_FailByCloudException()
        {
            KiiAnalytics.Initialize("appID004", "appKey", KiiAnalytics.Site.JP, "dev004");
            KiiEvent[] events = CreateEvents();

            // set mock
            MockHttpClientFactory factory = new MockHttpClientFactory();

            KiiAnalytics.AsyncHttpClientFactory = factory;
            MockHttpClient client = factory.Client;

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

            // async upload
            Exception      exp = null;
            CountDownLatch cd  = new CountDownLatch(1);

            KiiAnalytics.Upload((Exception e) => {
                exp = e;
                cd.Signal();
            }, events);

            if (!cd.Wait(new TimeSpan(0, 0, 0, 3)))
            {
                Assert.Fail("Callback not fired.");
            }
            Assert.NotNull(exp);
            Assert.That(exp, Is.InstanceOf <EventUploadException> ());
            EventUploadException ue        = (EventUploadException)exp;
            IList <KiiEvent>     errorList = ue.ErrorEvents;

            Assert.IsFalse(events [0].Sent);
            Assert.IsFalse(events [1].Sent);
            Assert.IsFalse(events [2].Sent);
            Assert.AreEqual(3, errorList.Count);

            KiiEvent error1 = errorList [0];

            Assert.AreEqual(1, error1 ["page"]);
            Assert.AreEqual("OK", error1 ["label"]);

            KiiEvent error2 = errorList [1];

            Assert.AreEqual(2, error2 ["page"]);
            Assert.AreEqual("Cancel", error2 ["label"]);

            KiiEvent error3 = errorList [2];

            Assert.AreEqual(3, error3 ["page"]);
            Assert.AreEqual("Next", error3 ["label"]);
        }
コード例 #9
0
        public void Test_0000_Initialize_CN()
        {
            KiiAnalytics.Initialize("appId", "appKey", KiiAnalytics.Site.CN, "dev001");
            KiiEvent ev = KiiAnalytics.NewEvent("type");

            // set mock
            KiiAnalytics.HttpClientFactory = new MockHttpClientFactory();
            MockHttpClient client = ((MockHttpClientFactory)KiiAnalytics.HttpClientFactory).Client;

            client.AddResponse(204, "");

            KiiAnalytics.Upload(ev);

            Assert.AreEqual("https://api-cn2.kii.com/api/apps/appId/events", client.RequestUrl[0]);
        }
コード例 #10
0
        public void Test_0320_Upload_sent()
        {
            KiiAnalytics.Initialize("appID004", "appKey", KiiAnalytics.Site.JP, "dev004");
            KiiEvent ev = KiiAnalytics.NewEvent("type1");

            ev["page"]  = 1;
            ev["label"] = "OK";

            // set mock
            KiiAnalytics.HttpClientFactory = new MockHttpClientFactory();
            MockHttpClient client = ((MockHttpClientFactory)KiiAnalytics.HttpClientFactory).Client;

            client.AddResponse(204, "");

            KiiAnalytics.Upload(ev);
            // set sent event
            KiiAnalytics.Upload(ev);
        }
コード例 #11
0
        public void Test_1_5_GetResult_CallbackNull()
        {
            // set mock
            MockHttpClientFactory factory = new MockHttpClientFactory();

            KiiAnalytics.AsyncHttpClientFactory = factory;
            MockHttpClient client = factory.Client;

            client.AddResponse(200, "{" +
                               "\"snapshots\" : [ {" +
                               "\"name\" : \"Male\"," +
                               "\"data\" : [ 546.775207 ]," +
                               "\"pointStart\" : 1338044400000," +
                               "\"pointInterval\" : 86400000}]}");

            // call with null callback.
            KiiAnalytics.GetResult("a", null, null);
        }
コード例 #12
0
        public void Test_1_7_Upload()
        {
            KiiAnalytics.Initialize("appID004", "appKey", KiiAnalytics.Site.JP, "dev004");
            KiiEvent ev = KiiAnalytics.NewEvent("type1");

            ev["page"]  = 1;
            ev["label"] = "OK";

            // set mock
            MockHttpClientFactory factory = new MockHttpClientFactory();

            KiiAnalytics.AsyncHttpClientFactory = factory;
            MockHttpClient client = factory.Client;

            client.AddResponse(204, "");

            // async upload
            Exception      exp = null;
            CountDownLatch cd  = new CountDownLatch(1);

            KiiAnalytics.Upload((Exception e) => {
                exp = e;
                cd.Signal();
            }, ev);

            if (!cd.Wait(new TimeSpan(0, 0, 0, 3)))
            {
                Assert.Fail("Callback not fired.");
            }
            Assert.Null(exp);
            Assert.AreEqual("https://api-jp.kii.com/api/apps/appID004/events", client.RequestUrl[0]);
            Assert.AreEqual("application/vnd.kii.EventRecordList+json", client.RequestContentType[0]);
            JsonArray  array = new JsonArray(client.RequestBody[0]);
            JsonObject json  = array.GetJsonObject(0);
            int        count = ToCount(json.Keys());

            Assert.AreEqual(6, count);
            Assert.AreEqual(1, json.GetInt("page"));
            Assert.AreEqual("OK", json.GetString("label"));
            Assert.AreEqual("dev004", json.GetString("_deviceID"));
            Assert.AreEqual("type1", json.GetString("_type"));
            Assert.IsTrue(json.Has("_triggeredAt"));
            Assert.IsTrue(json.Has("_uploadedAt"));
        }
コード例 #13
0
        public void Test_0350_Upload_NullEvent()
        {
            KiiAnalytics.Initialize("appID004", "appKey", KiiAnalytics.Site.JP, "dev004");
            KiiEvent ev = new KiiEvent.NullKiiEvent();

            // set mock
            KiiAnalytics.HttpClientFactory = new MockHttpClientFactory();
            MockHttpClient client = ((MockHttpClientFactory)KiiAnalytics.HttpClientFactory).Client;

            client.AddResponse(204, "");

            KiiAnalytics.Upload(ev);

            Assert.AreEqual("https://api-jp.kii.com/api/apps/appID004/events", client.RequestUrl[0]);
            Assert.AreEqual("application/vnd.kii.EventRecordList+json", client.RequestContentType[0]);
            JsonArray array = new JsonArray(client.RequestBody[0]);

            Assert.AreEqual(0, array.Length());
        }
コード例 #14
0
        public void Test_0313_Upload_50()
        {
            KiiAnalytics.Initialize("appID005", "appKey", KiiAnalytics.Site.JP, "dev005");

            KiiEvent[] eventList = new KiiEvent[50];
            for (int i = 0; i < eventList.Length; ++i)
            {
                KiiEvent ev = KiiAnalytics.NewEvent("type1");
                ev["page"]   = i;
                eventList[i] = ev;
            }

            // set mock
            KiiAnalytics.HttpClientFactory = new MockHttpClientFactory();
            MockHttpClient client = ((MockHttpClientFactory)KiiAnalytics.HttpClientFactory).Client;

            client.AddResponse(204, "");

            KiiAnalytics.Upload(eventList);
        }
コード例 #15
0
        public void Test_0341_Upload_CloudException_broken_json()
        {
            KiiAnalytics.Initialize("appID004", "appKey", KiiAnalytics.Site.JP, "dev004");
            KiiEvent[] events = CreateEvents();

            // set mock
            KiiAnalytics.HttpClientFactory = new MockHttpClientFactory();
            MockHttpClient client = ((MockHttpClientFactory)KiiAnalytics.HttpClientFactory).Client;

            client.AddResponse(new CloudException(400, "broken"));

            try
            {
                KiiAnalytics.Upload(events);
                Assert.Fail("Exception must be thrown");
            }
            catch (EventUploadException e)
            {
                Assert.AreEqual(3, e.ErrorEvents.Count);
            }
        }
コード例 #16
0
        public void TestRequestUrl()
        {
            KiiAnalytics.Initialize("dummyAppId", "dummyAppKey", KiiAnalytics.Site.CN3, "dummyDeviceId");
            MockHttpClientFactory factory = new MockHttpClientFactory();

            KiiAnalytics.HttpClientFactory      = factory;
            KiiAnalytics.AsyncHttpClientFactory = factory;
            MockHttpClient client = (MockHttpClient)factory.Client;

            // send request
            client.AddResponse(200, "{" +
                               "\"snapshots\" : [ {" +
                               "\"name\" : \"Male\"," +
                               "\"data\" : [ 546.775207 ]," +
                               "\"pointStart\" : 1338044400000," +
                               "\"pointInterval\" : 86400000}]}");
            KiiAnalytics.GetResult("ruleId", null, null);

            // check request url.
            Assert.AreEqual("https://api-cn3.kii.com/api/apps/dummyAppId/analytics/ruleId/data", client.RequestUrl[0]);
        }
コード例 #17
0
        public void Test_0332_Upload_Partial_last()
        {
            KiiAnalytics.Initialize("appID004", "appKey", KiiAnalytics.Site.JP, "dev004");
            KiiEvent[] events = CreateEvents();

            // set mock
            KiiAnalytics.HttpClientFactory = new MockHttpClientFactory();
            MockHttpClient client = ((MockHttpClientFactory)KiiAnalytics.HttpClientFactory).Client;

            client.AddResponse(200,
                               "{" +
                               "\"errorCode\" : \"PARTIAL_SUCCESS\"," +
                               "\"message\" : \"There are some errors in event data\"," +
                               "\"invalidEvents\" : [ {" +
                               "\"index\" : 2," +
                               "\"errorDetails\" : [ {" +
                               "\"fieldName\" : \"_uploadedAt\"," +
                               "\"errorCode\" : \"UPLOADED_AT_MISSING\"," +
                               "\"message\" : \"You must provide event upload time\"}]" +
                               "}]" +
                               "}");

            try
            {
                KiiAnalytics.Upload(events);
                Assert.Fail("Exception must be thrown");
            }
            catch (EventUploadException e)
            {
                IList <KiiEvent> errorList = e.ErrorEvents;
                Assert.IsTrue(events[0].Sent);
                Assert.IsTrue(events[1].Sent);
                Assert.IsFalse(events[2].Sent);
                Assert.AreEqual(1, errorList.Count);
                KiiEvent error1 = errorList[0];
                Assert.AreEqual(3, error1["page"]);
                Assert.AreEqual("Next", error1["label"]);
            }
        }
コード例 #18
0
        public void Test_1_8_Upload_PartialSuccess()
        {
            KiiAnalytics.Initialize("appID004", "appKey", KiiAnalytics.Site.JP, "dev004");
            KiiEvent[] events = CreateEvents();

            // set mock
            MockHttpClientFactory factory = new MockHttpClientFactory();

            KiiAnalytics.AsyncHttpClientFactory = factory;
            MockHttpClient client = factory.Client;

            client.AddResponse(200,
                               "{" +
                               "\"errorCode\" : \"PARTIAL_SUCCESS\"," +
                               "\"message\" : \"There are some errors in event data\"," +
                               "\"invalidEvents\" : [" +
                               "{" +
                               "\"index\" : 0," +
                               "\"errorDetails\" : [ {" +
                               "\"fieldName\" : \"_uploadedAt\"," +
                               "\"errorCode\" : \"UPLOADED_AT_MISSING\"," +
                               "\"message\" : \"You must provide event upload time\"}]" +
                               "}," +
                               "{" +
                               "\"index\" : 1," +
                               "\"errorDetails\" : [ {" +
                               "\"fieldName\" : \"_uploadedAt\"," +
                               "\"errorCode\" : \"UPLOADED_AT_MISSING\"," +
                               "\"message\" : \"You must provide event upload time\"}]" +
                               "}," +
                               "{" +
                               "\"index\" : 2," +
                               "\"errorDetails\" : [ {" +
                               "\"fieldName\" : \"_uploadedAt\"," +
                               "\"errorCode\" : \"UPLOADED_AT_MISSING\"," +
                               "\"message\" : \"You must provide event upload time\"}]" +
                               "}" +
                               "]" +
                               "}");

            // async upload
            Exception      exp = null;
            CountDownLatch cd  = new CountDownLatch(1);

            KiiAnalytics.Upload((Exception e) => {
                exp = e;
                cd.Signal();
            }, events);

            if (!cd.Wait(new TimeSpan(0, 0, 0, 3)))
            {
                Assert.Fail("Callback not fired.");
            }
            Assert.NotNull(exp);
            Assert.That(exp, Is.InstanceOf <EventUploadException> ());
            EventUploadException ue        = (EventUploadException)exp;
            IList <KiiEvent>     errorList = ue.ErrorEvents;

            Assert.IsFalse(events [0].Sent);
            Assert.IsFalse(events [1].Sent);
            Assert.IsFalse(events [2].Sent);
            Assert.AreEqual(3, errorList.Count);

            KiiEvent error1 = errorList [0];

            Assert.AreEqual(1, error1 ["page"]);
            Assert.AreEqual("OK", error1 ["label"]);

            KiiEvent error2 = errorList [1];

            Assert.AreEqual(2, error2 ["page"]);
            Assert.AreEqual("Cancel", error2 ["label"]);

            KiiEvent error3 = errorList [2];

            Assert.AreEqual(3, error3 ["page"]);
            Assert.AreEqual("Next", error3 ["label"]);
        }
コード例 #19
0
        public void Test_1_2_GetResult_ConditionNull()
        {
            // set mock
            MockHttpClientFactory factory = new MockHttpClientFactory();

            KiiAnalytics.AsyncHttpClientFactory = factory;
            MockHttpClient client = factory.Client;

            client.AddResponse(200, "{" +
                               "\"snapshots\" : [ {" +
                               "\"name\" : \"Male\"," +
                               "\"data\" : [ 546.775207 ]," +
                               "\"pointStart\" : 1338044400000," +
                               "\"pointInterval\" : 86400000}, " +
                               "{" +
                               "\"name\" : \"Female\"," +
                               "\"data\" : [ 325.216381 ]," +
                               "\"pointStart\" : 1338044400000," +
                               "\"pointInterval\" : 86400000}" +
                               "]}");

            GroupedResult   result    = null;
            string          ruleId    = null;
            ResultCondition condition = null;
            Exception       exp       = null;
            CountDownLatch  cd        = new CountDownLatch(1);

            KiiAnalytics.GetResult("a", null, (string id, ResultCondition c, GroupedResult r, Exception e) => {
                Interlocked.Exchange(ref result, r);
                Interlocked.Exchange(ref ruleId, id);
                Interlocked.Exchange(ref condition, c);
                Interlocked.Exchange(ref exp, e);
                cd.Signal();
            });

            if (!cd.Wait(new TimeSpan(0, 0, 0, 3)))
            {
                Assert.Fail("Callback not fired.");
            }
            Assert.AreEqual(ruleId, "a");
            Assert.IsNull(condition);
            Assert.IsNotNull(result);
            Assert.IsNull(exp);

            Assert.IsNotNull(result.SnapShots);
            IList <GroupedSnapShot> snapshots = result.SnapShots;

            Assert.AreEqual(2, snapshots.Count);

            GroupedSnapShot snapShot1 = snapshots[0];

            Assert.AreEqual("Male", snapShot1.Name);
            Assert.AreEqual(1338044400000, snapShot1.PointStart);
            Assert.AreEqual(86400000, snapShot1.PointInterval);
            JsonArray data = snapShot1.Data;

            Assert.AreEqual(1, data.Length());

            GroupedSnapShot snapShot2 = snapshots[1];

            Assert.AreEqual("Female", snapShot2.Name);
            Assert.AreEqual(1338044400000, snapShot2.PointStart);
            Assert.AreEqual(86400000, snapShot2.PointInterval);
            data = snapShot2.Data;
            Assert.AreEqual(1, data.Length());
        }