diff --git a/VSTeam.psd1 b/VSTeam.psd1 index afa842233..557ddb0bc 100644 --- a/VSTeam.psd1 +++ b/VSTeam.psd1 @@ -13,7 +13,7 @@ RootModule = '' # Version number of this module. - ModuleVersion = '2.1.1' + ModuleVersion = '2.1.2' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/src/common.ps1 b/src/common.ps1 index ea88d25dd..4b3a94fbc 100644 --- a/src/common.ps1 +++ b/src/common.ps1 @@ -351,7 +351,16 @@ function _buildProjectNameDynamicParam { $arrSet = _getProjects if ($arrSet) { + # If $Mandatory is false we need to add '' to the arrSet or they will not be able + # to omit this parameter + if($Mandatory -eq $false){ + # We can't use .Add("") because the collection is of a fixed size. But we can + # use += because a new array is created that contains everything we want. + $arrSet += ""; + } + Write-Verbose "arrSet = $arrSet" + $ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($arrSet) # Add the ValidateSet to the attributes collection diff --git a/unit/test/git.Tests.ps1 b/unit/test/git.Tests.ps1 index 2636ec835..3fb310f3f 100644 --- a/unit/test/git.Tests.ps1 +++ b/unit/test/git.Tests.ps1 @@ -49,7 +49,7 @@ InModuleScope git { Get-VSTeamGitRepository - It 'Should create VSAccount' { + It 'Should return all repos for all projects' { Assert-VerifiableMocks } } @@ -59,7 +59,7 @@ InModuleScope git { Get-VSTeamGitRepository -id 00000000-0000-0000-0000-000000000000 - It 'Should create VSAccount' { + It 'Should return a single repo by id' { Assert-VerifiableMocks } } @@ -69,7 +69,7 @@ InModuleScope git { Get-VSTeamGitRepository -Name 'test' - It 'Should create VSAccount' { + It 'Should return a single repo by name' { Assert-VerifiableMocks } }