protected override void ProcessRecord() { foreach (var curId in Id) { try { var request = GroupMemberRequestFactory.CreateRemoveGroupMemberRequest(GroupName, Scope.Equals(GroupScope.Global), curId); if (ShouldProcess(curId.ToString())) { RequestHandler.ExecuteSuccessfully(request); } } catch (ReportableException e) { WriteError(e.ErrorRecord); } } }
public void AddAndRemoveMember(bool globalGroup) { var user = GetAbritraryUser(); var group = DoAddGroup(_testGroupName, globalGroup, true).Data; var addRequest = GroupMemberRequestFactory.CreateAddGroupMemberRequest(group.Name, globalGroup, user.Id); var addResponse = RequestHandler.Execute <DataspaceResponse>(addRequest); Assert.True(addResponse.Success, addResponse.Message); var removeRequest = GroupMemberRequestFactory.CreateRemoveGroupMemberRequest(group.Name, globalGroup, user.Id); var removeResponse = RequestHandler.Execute <DataspaceResponse>(removeRequest); Assert.True(removeResponse.Success); var request = GroupMemberRequestFactory.CreateGetGroupMembersRequest(0, 30, _testGroupName, globalGroup); var members = RequestHandler.ExecuteAndUnpack <List <NamedObject> >(request); Assert.AreEqual(0, members.Count); }