Пример #1
0
        public async Task QueryFile()
        {
            LCQuery <LCFile> query = LCFile.GetQuery();
            LCFile           file  = await query.Get(avatar.ObjectId);

            Assert.NotNull(file.Url);
            TestContext.WriteLine(file.Url);
            TestContext.WriteLine(file.GetThumbnailUrl(32, 32));
        }
Пример #2
0
        public async Task QueryFile()
        {
            LCQuery <LCFile> query = LCFile.GetQuery();
            LCFile           file  = await query.Get("5e0dbfa0562071008e21c142");

            Assert.NotNull(file.Url);
            TestContext.WriteLine(file.Url);
            TestContext.WriteLine(file.GetThumbnailUrl(32, 32));
        }
Пример #3
0
        public async Task FileACL()
        {
            LCUser user = await LCUser.LoginAnonymously();

            LCFile file = new LCFile("avatar", AvatarFilePath);
            LCACL  acl  = new LCACL();

            acl.SetUserReadAccess(user, true);
            file.ACL = acl;
            await file.Save();

            LCQuery <LCFile> query  = LCFile.GetQuery();
            LCFile           avatar = await query.Get(file.ObjectId);

            Assert.NotNull(avatar.ObjectId);

            await LCUser.LoginAnonymously();

            try {
                LCFile forbiddenAvatar = await query.Get(file.ObjectId);
            } catch (LCException e) {
                Assert.AreEqual(e.Code, 403);
            }
        }