This repository was archived by the owner on Feb 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
This repository was archived by the owner on Feb 24, 2021. It is now read-only.
Example validation: Fails if a parameter has a ValidateSet #242
Copy link
Copy link
Open
Labels
enhancementThe issue is an enhancement request.The issue is an enhancement request.help wantedThe issue is up for grabs for anyone in the community.The issue is up for grabs for anyone in the community.
Description
The following code does not take in account if there are a validate set on a mandatory parameter.
Also, this code should be split out to a separate function.
DscResource.Tests/Meta.Tests.ps1
Lines 697 to 710 in 7956b15
| <# | |
| Check for mandatory parameters. | |
| Assume the parameters are all in the 'all' parameter set. | |
| #> | |
| $isParameterMandatory = $exampleCommand.Parameters[$parameterName].ParameterSets['__AllParameterSets'].IsMandatory | |
| if ($isParameterMandatory) | |
| { | |
| <# | |
| Convert '1' to the type that the parameter expects. | |
| Using '1' since it can be converted to String, Numeric | |
| and Boolean. | |
| #> | |
| $exampleParameters.Add($parameterName, ('1' -as $parameterType)) | |
| } |
Metadata
Metadata
Assignees
Labels
enhancementThe issue is an enhancement request.The issue is an enhancement request.help wantedThe issue is up for grabs for anyone in the community.The issue is up for grabs for anyone in the community.