Example #1
0
        public static async Task Update()
        {
            // Arrange
            var group       = new Response.ApplicationGroup();
            var permission  = new Response.Permission();
            var permissions = new Response.PermissionsSetId {
                Permissions = new[] { permission, }
            };

            var mock = Substitute.For <IFor>();

            mock
            .IdentitiesAsync()
            .Returns(new Response.ApplicationGroups {
                Identities = new[] { group }
            });
            mock
            .PermissionSetAsync(group)
            .Returns(permissions);

            // Act
            var target = new ManagePermissions(mock);
            await target.SetToAsync(4);

            // Assert
            await mock
            .Received()
            .UpdateAsync(group, permissions, permission);

            permission
            .PermissionId
            .ShouldBe(4);
        }
Example #2
0
        public Task UpdateAsync(Response.ApplicationGroup identity,
                                Response.PermissionsSetId permissionSet, Response.Permission permission)
        {
            if (identity == null)
            {
                throw new ArgumentNullException(nameof(identity));
            }

            return(_client.PostAsync(Requests.Permissions.ManagePermissions(_projectId),
                                     new ManagePermissionsData(identity.TeamFoundationId, permissionSet.DescriptorIdentifier,
                                                               permissionSet.DescriptorIdentityType, permission.PermissionToken, permission).Wrap()));
        }