Tests/Get-AppJsonForProjectAndRepo.Tests.ps1
Describe Get-AppJsonForProjectAndRepo { Import-Module Tecman.Tfs.Tools InModuleScope Tecman.Tfs.Tools { Mock Get-ProjectName {'test project'} Mock Get-RepositoryId {} Mock Invoke-TFSAPI {'{"name": "some other dependency"}'} Context 'Microsoft dependency' { It 'should return an empty JSON object' { Get-AppJsonForProjectAndRepo -ProjectName 'System Application' -RepositoryName '' -Publisher 'Microsoft' | should be '{}' } } Context 'Any other publisher' { It 'should return a depdency' { Get-AppJsonForProjectAndRepo -ProjectName 'Some dependency' -RepositoryName '' Assert-MockCalled Invoke-TFSAPI -Times 1 } } } } |