Skip to content

Commit

Permalink
Add new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
igoravl committed Aug 13, 2024
1 parent 51cc9fe commit 7fa5bb8
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions PS/_Tests/Identity/Group/GetTfsGroupMember.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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] <Object>
# [[-Member] <string>]
# [-Recurse]
# [-Collection <Object>]
# [-Server <Object>] [<CommonParameters>]

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 @('[email protected]', 'Project Administrators')
}
}
}

0 comments on commit 7fa5bb8

Please sign in to comment.