Skip to content

馃┕ [Patch]: Add support for array input for New-DynamicParam#22

Description

Describe the change

Add support for array input for New-DynamicParam

Context 'Integration - Pipelined construction - more pipeline' {
    BeforeAll {
        filter Test-DynParam {
            <#
                .SYNOPSIS
                This is a test of dynamic parameters.
            #>
            [CmdletBinding()]
            param (
                [Parameter()]
                [ValidateSet('A', 'B', 'C')]
                [string]$Param1
            )

            dynamicparam {
                $params = @(
                    @{
                        Name        = 'Variable'
                        Type        = [string]
                        ValidateSet = Get-Variable | Select-Object -ExpandProperty Name
                    },
                    @{
                        Name        = 'EnvironmentVariable'
                        Type        = [string]
                        ValidateSet = Get-ChildItem -Path env: | Select-Object -ExpandProperty Name
                    }
                )
                $params | New-DynamicParam | New-DynamicParamDictionary
            }

            process {
                $Variable = $PSBoundParameters['Variable']
                $EnvironmentVariable = $PSBoundParameters['EnvironmentVariable']

                Write-Verbose "Variable:            $Variable"
                Write-Verbose "EnvironmentVariable: $EnvironmentVariable"
            }
        }
    }

    It 'Test-DynParam should not throw an exception' {
        { Test-DynParam -Variable HOME -EnvironmentVariable RUNNER_OS -Verbose } | Should -Not -Throw
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions