Skip to content

Commit

Permalink
Improve unittests for Update-VSTeamAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
woehrl01 committed Feb 28, 2020
1 parent fcd3c28 commit 9a4b521
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions unit/test/agents.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ InModuleScope VSTeam {

Assert-MockCalled Invoke-RestMethod -Exactly -Scope It -Times 1 -ParameterFilter {
$Method -eq 'Post' -and
$Uri -eq "https://dev.azure.com/test/_apis/distributedtask/pools/36/messages?api-version=$([VSTeamVersions]::DistributedTask)&agentId=950"
$Uri -like "*https://dev.azure.com/test/_apis/distributedtask/pools/36/messages*" -and
$Uri -like "*api-version=$([VSTeamVersions]::DistributedTask)*" -and
$Uri -like "*agentId=950*"
}
}
}
Expand All @@ -148,7 +150,7 @@ InModuleScope VSTeam {
Mock Invoke-RestMethod { throw 'boom' }

It 'should update the agent with passed in Id' {
{ Disable-VSTeamAgent -Pool 36 -Id 950 } | Should Throw
{ Update-VSTeamAgent -Pool 36 -Id 950 } | Should Throw
}
}
}
Expand Down

0 comments on commit 9a4b521

Please sign in to comment.