コード例 #1
0
        public void CanCreateAccessList()
        {
            Task<CMUserResponse<CMUserProfileMock>> loginResponse = userService.Login<CMUserProfileMock> (user);
            loginResponse.Wait ();

            Assert.AreEqual (loginResponse.Result.Status, HttpStatusCode.OK);
            Assert.That (loginResponse.Result.HasErrors, Is.False);
            Assert.AreEqual (loginResponse.Result.CMUser.Profile.GetType (), typeof(CMUserProfileMock));
            Assert.AreEqual (loginResponse.Result.CMUser.Profile.FavoriteCafe, "CloudMine Coffee to Go");
            Assert.AreEqual (loginResponse.Result.CMUser.Session, user.Session); // ensure session set

            var acl = new CMAccessList () {
                Permissions = new CMAccessListPermission[] {
                    CMAccessListPermission.r,
                    CMAccessListPermission.u
                },
                Members =  new string[] { user.UserID }
            };

            IAccessListService accessService = new AccessListService (app, api);
            Task<CMResponse> createAccessListTask = accessService.CreateAccessList (user, acl);
            createAccessListTask.Wait ();

            Assert.AreEqual (createAccessListTask.Result.Status, HttpStatusCode.OK);

            acl.Permissions = new CMAccessListPermission[] {
                CMAccessListPermission.r
            };

            Task<CMResponse> modifyAccessListTask = accessService.ModifyAccessList (user, acl);
            modifyAccessListTask.Wait ();

            Assert.AreEqual (modifyAccessListTask.Result.Status, HttpStatusCode.OK);

            HCPMock obj = new HCPMock () {
                AccessListIDs = new string[] { acl.ID }
            };
        }
コード例 #2
0
 public Task<CMResponse> ModifyAccessList(CMUser user, CMAccessList acl)
 {
     return APIService.Request (this.Application, "user/access", HttpMethod.Put, CMSerializer.ToStream (acl), new CMRequestOptions (null, user));
 }