예제 #1
0
        public async Task AddAndRemove()
        {
            LCObject parent = new LCObject("Parent");
            LCObject c1     = new LCObject("Child");

            parent.AddRelation("children", c1);
            LCObject c2 = new LCObject("Child");

            parent.AddRelation("children", c2);
            await parent.Save();

            LCRelation <LCObject> relation = parent["children"] as LCRelation <LCObject>;
            LCQuery <LCObject>    query    = relation.Query;
            int count = await query.Count();

            TestContext.WriteLine($"count: {count}");
            Assert.AreEqual(count, 2);

            parent.RemoveRelation("children", c2);
            await parent.Save();

            int count2 = await query.Count();

            TestContext.WriteLine($"count: {count2}");
            Assert.AreEqual(count2, 1);
        }
예제 #2
0
        public async Task Count()
        {
            LCQuery <LCObject> query = new LCQuery <LCObject>("Account");

            query.WhereGreaterThan("balance", 200);
            int count = await query.Count();

            TestContext.WriteLine(count);
            Assert.Greater(count, 0);
        }