. $PSScriptRoot\..\..\Load-PesterModules.ps1 $here = Split-Path -Parent $MyInvocation.MyCommand.Path $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.' $functionPath = Join-Path -Path $here -ChildPath $sut Write-Host "Overriding SUT: $functionPath" Import-Module $functionPath -Force $moduleForMock = "" Describe "Get-DynamicAwsRegionParameter" { Context "Logic" { Mock -CommandName Get-SupportedAwsRegions -ModuleName $moduleForMock -MockWith { return @( "mexico-south-55", "australia-west-99" )} It "Uses the Specified Parameter Name" { $testParamName = "SupaFly" $param = Get-DynamicAwsRegionParameter -DynamicParameterName $testParamName $param.Keys | Should -BeExactly $testParamName } It "Uses the Specified ParameterSet Name" { $testParamSetName = "wOne" $param = Get-DynamicAwsRegionParameter -ParameterSetName $testParamSetName $param.Values.Attributes.ParameterSetName | Should -BeExactly $testParamSetName } It "Is a Mandatory Parameter if Specified" { $param = Get-DynamicAwsRegionParameter -IsMandatoryParameter $param.Values.Attributes.Mandatory | Should -BeTrue } It "Creates a Validate Set with Valid AWS Profile Names" { $param = Get-DynamicAwsRegionParameter $param.Values.Attributes.ValidValues | Should -Be @( "mexico-south-55", "australia-west-99") } } }