Add parameter validation functions and enhance tests for configuration data
This commit is contained in:
@@ -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 ', ')."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user