Пример #1
0
        public void TestRemove()
        {
            AVObject obj = AVObject.Create("Corgi");

            obj["gogo"] = true;
            Assert.True(obj.ContainsKey("gogo"));

            obj.Remove("gogo");
            Assert.False(obj.ContainsKey("gogo"));

            IObjectState state = new MutableObjectState
            {
                ObjectId   = "waGiManPutr4Pet1r",
                ClassName  = "Pagi",
                CreatedAt  = new DateTime(),
                ServerData = new Dictionary <string, object>()
                {
                    { "username", "kevin" },
                    { "sessionToken", "se551onT0k3n" }
                }
            };

            obj = AVObjectExtensions.FromState <AVObject>(state, "Corgi");
            Assert.True(obj.ContainsKey("username"));
            Assert.True(obj.ContainsKey("sessionToken"));

            obj.Remove("username");
            Assert.False(obj.ContainsKey("username"));
            Assert.True(obj.ContainsKey("sessionToken"));
        }
Пример #2
0
        /// <summary>
        /// 删除属性
        /// </summary>
        public async void DeletePropertiesWithId()
        {
            AVObject character = AVObject.CreateWithoutData("Sport", "5b446160fe88c20035fd9dcc");
            await character.FetchAsync().ContinueWith(t =>
            {
                Console.WriteLine("FetchAsync:ID:" + t.Id);
                Console.WriteLine("character:ID:" + character.ObjectId);

                character.Remove("grade");
                character.SaveAsync();
            });
        }
Пример #3
0
        /// <summary>
        /// 删除
        /// </summary>
        public async void DeleteObjWithId()
        {
            AVObject character = AVObject.CreateWithoutData("Sport", "5b44644aee920a003b2eb726");
            await character.DeleteAsync().ContinueWith(t =>
            {
                Console.WriteLine("Delete:ID:" + t.Id);
                Console.WriteLine("character:ID:" + character.ObjectId);

                character.Remove("grage");
                character.SaveAsync();
            });
        }
Пример #4
0
    void updataData()
    {
        //updata data
        AVObject ao = AVUser.CurrentUser;

        ao["testA"] = "a5";

        //add remove
        ao.Add("testB", "b1");
        ao.Remove("testA");

        //link focusType 使用链接对象
        AVObject sceneData = new AVObject("GirType");

        sceneData["typeName"] = "class1";
        ao["SceneData"]       = sceneData;

        //Async
        ao.SaveAsync();
    }
Пример #5
0
        public void TestKeys()
        {
            IObjectState state = new MutableObjectState
            {
                ObjectId   = "waGiManPutr4Pet1r",
                ClassName  = "Pagi",
                CreatedAt  = new DateTime(),
                ServerData = new Dictionary <string, object>()
                {
                    { "username", "kevin" },
                    { "sessionToken", "se551onT0k3n" }
                }
            };
            AVObject obj = AVObjectExtensions.FromState <AVObject>(state, "Omitted");

            Assert.AreEqual(2, obj.Keys.Count);

            obj["additional"] = true;
            Assert.AreEqual(3, obj.Keys.Count);

            obj.Remove("username");
            Assert.AreEqual(2, obj.Keys.Count);
        }