Public/Tests/Get-ParameterValues.Tests.ps1
|
BeforeAll { $env:TCS_CONFIG_ROOT = Join-Path -Path $TestDrive -ChildPath 'config' $env:TCS_SKIP_UPDATE_CHECK = '1' $env:TCS_TELEMETRY_OPTOUT = '1' $ModuleRoot = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent Import-Module -Name (Join-Path -Path $ModuleRoot -ChildPath 'tcs.core.psd1') -Force } AfterAll { Remove-Module -Name tcs.core -Force -ErrorAction SilentlyContinue } Describe 'Get-ParameterValues' { It 'Removes common parameters and null values' { $bound = @{ Name = 'a'; Empty = $null; Verbose = $true; WhatIf = $true; ErrorAction = 'Stop' } $result = Get-ParameterValues -PSBoundParametersHash $bound @($result.Keys) | Should -Be @('Name') } It 'Applies Exclude and Include' { $bound = @{ A = 1; B = 2; C = 3 } (Get-ParameterValues -PSBoundParametersHash $bound -Exclude 'A').Keys | Sort-Object | Should -Be @('B', 'C') @((Get-ParameterValues -PSBoundParametersHash $bound -Include 'C').Keys) | Should -Be @('C') } } |