예제 #1
0
        public async Task UserReadAndWrite()
        {
            await ParseUser.Login("hello", "world");

            ParseObject account     = new ParseObject("Account");
            ParseUser   currentUser = await ParseUser.GetCurrent();

            ParseACL acl = ParseACL.CreateWithOwner(currentUser);

            account.ACL        = acl;
            account["balance"] = 512;
            await account.Save();

            Assert.IsTrue(acl.GetUserReadAccess(currentUser));
            Assert.IsTrue(acl.GetUserWriteAccess(currentUser));

            ParseQuery <ParseObject> query = new ParseQuery <ParseObject>("Account");
            ParseObject result             = await query.Get(account.ObjectId);

            TestContext.WriteLine(result.ObjectId);
            Assert.NotNull(result.ObjectId);

            await ParseUser.Logout();

            result = await query.Get(account.ObjectId);

            Assert.IsNull(result);
        }
        public async Task LoginBySessionToken()
        {
            ParseUser currentUser = await ParseUser.Login(username, password);

            string sessionToken = currentUser.SessionToken;
            await ParseUser.Logout();

            await ParseUser.BecomeWithSessionToken(sessionToken);

            ParseUser current = await ParseUser.GetCurrent();

            Assert.NotNull(current.ObjectId);
        }