예제 #1
0
        public async Task QueryFollowersAndFollowees()
        {
            await LCUser.BecomeWithSessionToken(user2.SessionToken);

            LCQuery <LCObject>            query   = user2.FolloweeQuery();
            ReadOnlyCollection <LCObject> results = await query.Find();

            Assert.Greater(results.Count, 0);
            foreach (LCObject item in results)
            {
                Assert.IsTrue(item["followee"] is LCObject);
                Assert.AreEqual(user1.ObjectId, (item["followee"] as LCObject).ObjectId);
            }

            query   = user2.FollowerQuery();
            results = await query.Find();

            Assert.Greater(results.Count, 0);
            foreach (LCObject item in results)
            {
                Assert.IsTrue(item["follower"] is LCObject);
                Assert.AreEqual(user3.ObjectId, (item["follower"] as LCObject).ObjectId);
            }

            LCFollowersAndFollowees followersAndFollowees = await user2.GetFollowersAndFollowees(true, true, true);

            Assert.AreEqual(followersAndFollowees.FollowersCount, 1);
            Assert.AreEqual(followersAndFollowees.FolloweesCount, 1);
        }