コード例 #1
0
        public void TestFetchWithCount()
        {
            Task.Run(async() =>
            {
                for (var i = 0; i < 5; i++)
                {
                    var item = new NCMBObject("QueryTest");
                    item.Set("message", "Test message");
                    item.Set("number", i);
                    await item.Save();
                }

                var query = new NCMBQuery("QueryTest");
                query.GreaterThan("number", 3);
                var items = await query.Count().FetchAll();
                Assert.AreEqual(1, query.GetCount());
                query = new NCMBQuery("QueryTest");
                query.GreaterThanOrEqualTo("number", 3);
                items = await query.Count().FetchAll();
                Assert.AreEqual(2, query.GetCount());

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