Esempio n. 1
0
        public async Task Include()
        {
            LCQuery <LCObject> query = new LCQuery <LCObject>("Hello");

            query.Include("objectValue");
            LCObject hello = await query.Get("5e0d55aedd3c13006a53cd87");

            LCObject world = hello["objectValue"] as LCObject;

            TestContext.WriteLine(world["content"]);
            Assert.AreEqual(world["content"], "7788");
        }
Esempio n. 2
0
        public async Task Include()
        {
            LCObject.RegisterSubclass <Hello>("Hello", () => new Hello());
            LCObject.RegisterSubclass <World>("World", () => new World());

            LCQuery <Hello> helloQuery = new LCQuery <Hello>("Hello");

            helloQuery.Include("objectValue");
            Hello hello = await helloQuery.Get("5e0d55aedd3c13006a53cd87");

            World world = hello.World;

            TestContext.WriteLine(hello.ObjectId);
            Assert.AreEqual(hello.ObjectId, "5e0d55aedd3c13006a53cd87");
            TestContext.WriteLine(world.ObjectId);
            Assert.AreEqual(world.ObjectId, "5e0d55ae21460d006a1ec931");
            Assert.AreEqual(world.Content, "7788");
        }
Esempio n. 3
0
        public async Task Include()
        {
            Hello hello = new Hello {
                World = new World {
                    Content = "7788"
                }
            };
            await hello.Save();

            LCQuery <LCObject> query = new LCQuery <LCObject>("Hello");

            query.Include("objectValue");
            Hello queryHello = (await query.Get(hello.ObjectId)) as Hello;
            World world      = queryHello.World;

            TestContext.WriteLine(world.Content);
            Assert.AreEqual(world.Content, "7788");
        }
Esempio n. 4
0
        public async Task InQuery()
        {
            LCQuery <LCObject> worldQuery = new LCQuery <LCObject>("World");

            worldQuery.WhereEqualTo("content", "7788");
            LCQuery <LCObject> helloQuery = new LCQuery <LCObject>("Hello");

            helloQuery.WhereMatchesQuery("objectValue", worldQuery);
            helloQuery.Include("objectValue");
            ReadOnlyCollection <LCObject> hellos = await helloQuery.Find();

            Assert.Greater(hellos.Count, 0);
            foreach (LCObject item in hellos)
            {
                LCObject world = item["objectValue"] as LCObject;
                Assert.AreEqual(world["content"], "7788");
            }
        }
Esempio n. 5
0
        public async Task NotInQuery()
        {
            LCQuery <LCObject> worldQuery = new LCQuery <LCObject>("World");

            worldQuery.WhereEqualTo("content", "7788");
            LCQuery <LCObject> helloQuery = new LCQuery <LCObject>("Hello");

            helloQuery.WhereDoesNotMatchQuery("objectValue", worldQuery);
            helloQuery.Include("objectValue");
            ReadOnlyCollection <LCObject> hellos = await helloQuery.Find();

            Assert.Greater(hellos.Count, 0);
            foreach (LCObject item in hellos)
            {
                LCObject world = item["objectValue"] as LCObject;
                Assert.IsTrue(world == null ||
                              world["content"] == null ||
                              world["content"] as string != "7788");
            }
        }