diff --git a/PS/_Tests/Identity/Group/GetTfsGroupMember.Tests.ps1 b/PS/_Tests/Identity/Group/GetTfsGroupMember.Tests.ps1 index 5aeb56f9..981e4f7c 100644 --- a/PS/_Tests/Identity/Group/GetTfsGroupMember.Tests.ps1 +++ b/PS/_Tests/Identity/Group/GetTfsGroupMember.Tests.ps1 @@ -2,7 +2,40 @@ Describe (($MyInvocation.MyCommand.Name -split '\.')[-3]) { - Context 'Integration Tests' { - Write-Warning "$(Split-Path $PSCommandPath -Leaf): Test not implemented" + BeforeAll { + $collectionName = (Get-TfsTeamProjectCollection -Current).Name + } + + Context '__AllParameterSets' { + # Get-TfsGroupMember + # [-Group] + # [[-Member] ] + # [-Recurse] + # [-Collection ] + # [-Server ] [] + + It 'Should get all members of a server-level group' { + $members = Get-TfsGroupMember -Group '[TEAM FOUNDATION]\Enterprise Service Accounts' + $members | Should -BeOfType [Microsoft.VisualStudio.Services.Identity.Identity] + $members.AccountName | Should -Be 'TeamFoundationService (TEAM FOUNDATION)' + } + + It 'Should get all members of a collection-level group' { + $members = Get-TfsGroupMember -Group "[$collectionName]\Project Collection Service Accounts" + $members | Should -BeOfType [Microsoft.VisualStudio.Services.Identity.Identity] + $members.AccountName | Should -Be 'Enterprise Service Accounts' + } + + It 'Should get all members of a project-level group' { + $members = Get-TfsGroupMember -Group "[$tfsProject]\Endpoint Administrators" + $members | Should -BeOfType [Microsoft.VisualStudio.Services.Identity.Identity] + $members.AccountName | Should -Be 'Project Administrators' + } + + It 'Should get all members of a group recursively' { + $members = Get-TfsGroupMember -Group "[$tfsProject]\Endpoint Administrators" -Recurse + $members | Should -BeOfType [Microsoft.VisualStudio.Services.Identity.Identity] + $members.AccountName | Sort-Object | Should -Be @('igor@tshooter.com.br', 'Project Administrators') + } } } \ No newline at end of file