Add parameter validation functions and enhance tests for configuration data

This commit is contained in:
Torsten Brendgen
2026-06-27 14:22:37 +02:00
parent 3e017fc926
commit 086020c3df
7 changed files with 371 additions and 28 deletions

View File

@@ -21,6 +21,16 @@ function Assert-ConfigurationDataParameterAllowedValue {
return
}
if($Value -is [System.Array] -and $Value -isnot [string]){
foreach($Item in @($Value)){
if($AllowedValues -notcontains $Item){
throw "Parameter [$Name] value [$Item] is not allowed. Allowed values are: $($AllowedValues -join ', ')."
}
}
return
}
if($AllowedValues -notcontains $Value){
throw "Parameter [$Name] value [$Value] is not allowed. Allowed values are: $($AllowedValues -join ', ')."
}