Example #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 Login()
        {
            await ParseUser.Login(username, password);

            ParseUser current = await ParseUser.GetCurrent();

            Assert.NotNull(current.ObjectId);
        }
        public async Task IsAuthenticated()
        {
            ParseUser currentUser = await ParseUser.Login(username, password);

            bool isAuthenticated = await currentUser.IsAuthenticated();

            TestContext.WriteLine(isAuthenticated);
            Assert.IsTrue(isAuthenticated);
        }
        public async Task RelateObject()
        {
            ParseUser currentUser = await ParseUser.Login(username, password);

            ParseObject account = new ParseObject("Account");

            account["user"] = currentUser;
            await account.Save();
        }
Example #5
0
        public async Task Query()
        {
            await ParseUser.Login("game", "play");

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

            TestContext.WriteLine(account.ObjectId);
            Assert.NotNull(account.ObjectId);
        }
        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);
        }
Example #7
0
        public async Task Serialization()
        {
            await ParseUser.Login("hello", "world");

            ParseQuery <ParseObject> query = new ParseQuery <ParseObject>("Account")
            {
                IncludeACL = true
            };

            query.OrderByDescending("createdAt");
            ReadOnlyCollection <ParseObject> accounts = await query.Find();

            foreach (ParseObject account in accounts)
            {
                TestContext.WriteLine($"public read access: {account.ACL.PublicReadAccess}");
                TestContext.WriteLine($"public write access: {account.ACL.PublicWriteAccess}");
            }
        }