Private/Get-OriAzBopInternalPackage.ps1
<#
.DESCRIPTION Since is not possible to Mock Get-Package due dynamic block should be the function sparated for unit test resons Note: See more on https://github.com/pester/Pester/issues/604 .SYNOPSIS Since is not possible to Mock Get-Package due dynamic block should be the function sparated for unit test resons Note: See more on https://github.com/pester/Pester/issues/604 .PARAMETER GetPackageParams Parameters for one Get-Package .EXAMPLE Get-Package -Name 'bla' -RequiredVersion '1.2.3' #> function Get-OriAzBopInternalPackage { [CmdletBinding()] param ( [parameter(Mandatory = $true, HelpMessage = 'Parameters for one Artifact while install')] [Hashtable] $GetPackageParams ) #in case of any error we want to stop execution, in stderr having the error. Use try-catch to handle errors if needed. $ErrorActionPreference = "Stop"; Write-Verbose "-- Get-OriAzBopInternalPackage --" Write-Verbose "GetPackageParams: $(ConvertTo-Json $GetPackageParams) " $toReturn = Get-Package @GetPackageParams Write-Verbose "-- End of Get-OriAzBopInternalPackage --" return($toReturn) } |