Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveDirectoryDsc.Common: Refactor Remove-DuplicateMembers #443

Closed
johlju opened this issue Jul 22, 2019 · 2 comments · Fixed by #471
Closed

ActiveDirectoryDsc.Common: Refactor Remove-DuplicateMembers #443

johlju opened this issue Jul 22, 2019 · 2 comments · Fixed by #471
Labels
enhancement The issue is an enhancement request.

Comments

@johlju
Copy link
Member

johlju commented Jul 22, 2019

This function could be replaced by a one-liner

We could do this

return [System.Array] ($members | Sort-Object -Unique)

Instead of this

https://github.com/PowerShell/xActiveDirectory/blob/621e28538148b5d668ae5eca673af42cdfe567e2/Modules/xActiveDirectory.Common/xActiveDirectory.Common.psm1#L679-L708

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Jul 22, 2019
@johlju
Copy link
Member Author

johlju commented Jul 22, 2019

The unit test should validate that the comparison is case-insensitive.

@johlju
Copy link
Member Author

johlju commented Jul 22, 2019

Another suggestion from the Slack channel was

param (
    [System.Collections.Generic.List[String]]$members = 'one', 'One'
)

return New-Object System.Collections.Generic.HashSet[String]($members, [System.StringComparer]::InvariantCultureIgnoreCase)

@johlju johlju changed the title xActiveDIrectory.Common: Refactor Remove-DuplicateMembers xActiveDirectory.Common: Refactor Remove-DuplicateMembers Jul 22, 2019
@johlju johlju changed the title xActiveDirectory.Common: Refactor Remove-DuplicateMembers ActiveDirectoryDsc.Common: Refactor Remove-DuplicateMembers Jul 28, 2019
@johlju johlju added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Aug 5, 2019
johlju added a commit that referenced this issue Aug 6, 2019
- Changes to ActiveDirectoryDsc.Common:
  - Refactor `Remove-DuplicateMembers` and added more unit tests (issue #443).
  - Minor cleanup in `Test-Members` because of the improved `Remove-DuplicateMembers`.
  - Minor cleanup in `Assert-MemberParameters` because of the improved `Remove-DuplicateMembers`.
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant