Tests/Get-RefsForRepository.Tests.ps1

Describe "Get-RefsForRepository" {
    InModuleScope Tecman.Tfs.Tools {
        Mock Get-ProjectName {return 'Random Project'}
        Mock Invoke-TFSAPI {}
        Mock Get-RepositoryId {}

        It 'should error when neither repo id or repo name supplied' {
            {Get-RefsForRepository -ProjectName 'Random'} | should throw 'Please supply'
        }

        It 'should call Get-RepositoryID if repo name supplied but not id' {            
            Get-RefsForRepository -ProjectName 'Random' -RepositoryName 'Bananas'
            Assert-MockCalled Get-RepositoryId
            Assert-MockCalled Invoke-TFSAPI
        }
    }
}