Ejemplo n.º 1
0
        public void TestFetchSelect()
        {
            Task.Run(async() =>
            {
                for (var i = 0; i < 5; i++)
                {
                    var item = new NCMBObject("Test");
                    item.Set("message", "Test message");
                    item.Set("number", i);
                    await item.Save();

                    var item2 = new NCMBObject("Test2");
                    item2.Set("message", "Test message");
                    item2.Set("num", i);
                    await item2.Save();
                }

                var q1 = new NCMBQuery("Test");
                var q2 = new NCMBQuery("Test2");

                q2.InString("num", new int[] { 1, 4 });

                var t     = q2.FetchAll();
                var items = await q1.Select("number", "num", q2).FetchAll();
                foreach (var item in items)
                {
                    var num = item.GetInt("number");
                    Assert.IsTrue(num == 4 || num == 1);
                }

                var query = new NCMBQuery("Test");
                items     = await query.FetchAll();
                foreach (var item in items)
                {
                    await item.Delete();
                }
                query = new NCMBQuery("Test2");
                items = await query.FetchAll();
                foreach (var item in items)
                {
                    await item.Delete();
                }
            }).GetAwaiter().GetResult();
        }