Ejemplo n.º 1
0
        public void TestManagerAddClientContextCustomAttribute()
        {
            string KEY1   = "key1";
            string KEY2   = "key2";
            string VALUE1 = "value1";
            string VALUE2 = "value2";
            string appId  = "dummy-id";

            MobileAnalyticsManager manager = GetMobileAnalyticsManager(appId);

            manager.AddClientContextCustomAttribute(KEY1, VALUE1);
            manager.AddClientContextCustomAttribute(KEY2, VALUE2);

            string clientContextString = manager.ClientContext.ToJsonString();

            Assert.IsTrue(clientContextString.IndexOf("custom") > 0);
            Assert.IsTrue(clientContextString.IndexOf(KEY1) > 0);
            Assert.IsTrue(clientContextString.IndexOf(KEY2) > 0);

            Assert.IsTrue(clientContextString.IndexOf("custom") < clientContextString.IndexOf(KEY1));
            Assert.IsTrue(clientContextString.IndexOf("custom") < clientContextString.IndexOf(KEY2));
            Assert.IsTrue(clientContextString.IndexOf(KEY1) < clientContextString.IndexOf(VALUE1));
            Assert.IsTrue(clientContextString.IndexOf(KEY2) < clientContextString.IndexOf(VALUE2));
        }