|
| 1 | +Describe 'Discover_AddRemovePrograms Tests' { |
| 2 | + |
| 3 | + Context 'Parameters for Discover_AddRemovePrograms'{ |
| 4 | + |
| 5 | + It 'Has a Parameter called MountPath' { |
| 6 | + $Function.Parameters.Keys.Contains('MountPath') | Should Be 'True' |
| 7 | + } |
| 8 | + It 'MountPath Parameter is Identified as Mandatory being True' { |
| 9 | + [String]$Function.Parameters.MountPath.Attributes.Mandatory | Should be 'True' |
| 10 | + } |
| 11 | + It 'MountPath Parameter is of String Type' { |
| 12 | + $Function.Parameters.MountPath.ParameterType.FullName | Should be 'System.String' |
| 13 | + } |
| 14 | + It 'MountPath Parameter is member of ParameterSets' { |
| 15 | + [String]$Function.Parameters.MountPath.ParameterSets.Keys | Should Be '__AllParameterSets' |
| 16 | + } |
| 17 | + It 'MountPath Parameter Position is defined correctly' { |
| 18 | + [String]$Function.Parameters.MountPath.Attributes.Position | Should be '0' |
| 19 | + } |
| 20 | + It 'Does MountPath Parameter Accept Pipeline Input?' { |
| 21 | + [String]$Function.Parameters.MountPath.Attributes.ValueFromPipeline | Should be 'False' |
| 22 | + } |
| 23 | + It 'Does MountPath Parameter Accept Pipeline Input by PropertyName?' { |
| 24 | + [String]$Function.Parameters.MountPath.Attributes.ValueFromPipelineByPropertyName | Should be 'False' |
| 25 | + } |
| 26 | + It 'Does MountPath Parameter use advanced parameter Validation? ' { |
| 27 | + $Function.Parameters.MountPath.Attributes.TypeID.Name -contains 'ValidateNotNullOrEmptyAttribute' | Should Be 'False' |
| 28 | + $Function.Parameters.MountPath.Attributes.TypeID.Name -contains 'ValidateNotNullAttribute' | Should Be 'False' |
| 29 | + $Function.Parameters.MountPath.Attributes.TypeID.Name -contains 'ValidateScript' | Should Be 'False' |
| 30 | + $Function.Parameters.MountPath.Attributes.TypeID.Name -contains 'ValidateRangeAttribute' | Should Be 'False' |
| 31 | + $Function.Parameters.MountPath.Attributes.TypeID.Name -contains 'ValidatePatternAttribute' | Should Be 'False' |
| 32 | + } |
| 33 | + It 'Has Parameter Help Text for MountPath '{ |
| 34 | + $function.Definition.Contains('.PARAMETER MountPath') | Should Be 'True' |
| 35 | + } |
| 36 | + It 'Has a Parameter called OutputPath' { |
| 37 | + $Function.Parameters.Keys.Contains('OutputPath') | Should Be 'True' |
| 38 | + } |
| 39 | + It 'OutputPath Parameter is Identified as Mandatory being True' { |
| 40 | + [String]$Function.Parameters.OutputPath.Attributes.Mandatory | Should be 'True' |
| 41 | + } |
| 42 | + It 'OutputPath Parameter is of String Type' { |
| 43 | + $Function.Parameters.OutputPath.ParameterType.FullName | Should be 'System.String' |
| 44 | + } |
| 45 | + It 'OutputPath Parameter is member of ParameterSets' { |
| 46 | + [String]$Function.Parameters.OutputPath.ParameterSets.Keys | Should Be '__AllParameterSets' |
| 47 | + } |
| 48 | + It 'OutputPath Parameter Position is defined correctly' { |
| 49 | + [String]$Function.Parameters.OutputPath.Attributes.Position | Should be '1' |
| 50 | + } |
| 51 | + It 'Does OutputPath Parameter Accept Pipeline Input?' { |
| 52 | + [String]$Function.Parameters.OutputPath.Attributes.ValueFromPipeline | Should be 'False' |
| 53 | + } |
| 54 | + It 'Does OutputPath Parameter Accept Pipeline Input by PropertyName?' { |
| 55 | + [String]$Function.Parameters.OutputPath.Attributes.ValueFromPipelineByPropertyName | Should be 'False' |
| 56 | + } |
| 57 | + It 'Does OutputPath Parameter use advanced parameter Validation? ' { |
| 58 | + $Function.Parameters.OutputPath.Attributes.TypeID.Name -contains 'ValidateNotNullOrEmptyAttribute' | Should Be 'False' |
| 59 | + $Function.Parameters.OutputPath.Attributes.TypeID.Name -contains 'ValidateNotNullAttribute' | Should Be 'False' |
| 60 | + $Function.Parameters.OutputPath.Attributes.TypeID.Name -contains 'ValidateScript' | Should Be 'False' |
| 61 | + $Function.Parameters.OutputPath.Attributes.TypeID.Name -contains 'ValidateRangeAttribute' | Should Be 'False' |
| 62 | + $Function.Parameters.OutputPath.Attributes.TypeID.Name -contains 'ValidatePatternAttribute' | Should Be 'False' |
| 63 | + } |
| 64 | + It 'Has Parameter Help Text for OutputPath '{ |
| 65 | + $function.Definition.Contains('.PARAMETER OutputPath') | Should Be 'True' |
| 66 | + } |
| 67 | + } |
| 68 | + Context "Function $($function.Name) - Help Section" { |
| 69 | + |
| 70 | + It "Function $($function.Name) Has show-help comment block" { |
| 71 | + |
| 72 | + $function.Definition.Contains('<#') | should be 'True' |
| 73 | + $function.Definition.Contains('#>') | should be 'True' |
| 74 | + } |
| 75 | + |
| 76 | + It "Function $($function.Name) Has show-help comment block has a.SYNOPSIS" { |
| 77 | + |
| 78 | + $function.Definition.Contains('.SYNOPSIS') -or $function.Definition.Contains('.Synopsis') | should be 'True' |
| 79 | + |
| 80 | + } |
| 81 | + |
| 82 | + It "Function $($function.Name) Is an advanced function" { |
| 83 | + |
| 84 | + $function.CmdletBinding | should be 'True' |
| 85 | + $function.Definition.Contains('param') -or $function.Definition.Contains('Param') | should be 'True' |
| 86 | + } |
| 87 | + |
| 88 | + } |
| 89 | + |
| 90 | + } |
| 91 | + |
| 92 | + |
0 commit comments