@@ -19,7 +19,7 @@ Describe "Test available parameters" {
19
19
It " has a Path parameter" {
20
20
$params.ContainsKey (" Path" ) | Should Be $true
21
21
}
22
-
22
+
23
23
It " accepts string" {
24
24
$params [" Path" ].ParameterType.FullName | Should Be " System.String"
25
25
}
@@ -29,8 +29,8 @@ Describe "Test available parameters" {
29
29
It " has a ScriptDefinition parameter" {
30
30
$params.ContainsKey (" ScriptDefinition" ) | Should Be $true
31
31
}
32
-
33
- It " accepts string" {
32
+
33
+ It " accepts string" {
34
34
$params [" ScriptDefinition" ].ParameterType.FullName | Should Be " System.String"
35
35
}
36
36
}
@@ -69,6 +69,16 @@ Describe "Test available parameters" {
69
69
}
70
70
}
71
71
72
+ Context " SaveDSCResourceDependency parameter" {
73
+ It " has the parameter" {
74
+ $params.ContainsKey (" SaveDscResourceDependency" ) | Should Be $true
75
+ }
76
+
77
+ It " is a switch parameter" {
78
+ $params [" SaveDscResourceDependency" ].ParameterType.FullName | Should Be " System.Management.Automation.SwitchParameter"
79
+ }
80
+ }
81
+
72
82
Context " It has 2 parameter sets: File and ScriptDefinition" {
73
83
It " Has 2 parameter sets" {
74
84
$sa.ParameterSets.Count | Should Be 2
@@ -144,14 +154,14 @@ Describe "Test Path" {
144
154
if (! $testingLibraryUsage )
145
155
{
146
156
# There is probably a more concise way to do this but for now we will settle for this!
147
- Function GetFreeDrive ($freeDriveLen ) {
157
+ Function GetFreeDrive ($freeDriveLen ) {
148
158
$ordA = 65
149
159
$ordZ = 90
150
160
$freeDrive = " "
151
161
$freeDriveName = " "
152
162
do {
153
163
$freeDriveName = (1 .. $freeDriveLen | % {[char ](Get-Random - Maximum $ordZ - Minimum $ordA )}) -join ' '
154
- $freeDrive = $freeDriveName + " :"
164
+ $freeDrive = $freeDriveName + " :"
155
165
}while (Test-Path $freeDrive )
156
166
$freeDrive , $freeDriveName
157
167
}
@@ -180,7 +190,7 @@ Describe "Test Path" {
180
190
Context " When given a directory" {
181
191
$withoutPathWithDirectory = Invoke-ScriptAnalyzer - Recurse $directory \RecursionDirectoryTest
182
192
$withPathWithDirectory = Invoke-ScriptAnalyzer - Recurse - Path $directory \RecursionDirectoryTest
183
-
193
+
184
194
It " Has the same count as without Path parameter" {
185
195
$withoutPathWithDirectory.Count -eq $withPathWithDirectory.Count | Should Be $true
186
196
}
@@ -206,7 +216,7 @@ Describe "Test ExcludeRule" {
206
216
207
217
It " excludes 3 rules" {
208
218
$noViolations = Invoke-ScriptAnalyzer $directory \..\Rules\BadCmdlet.ps1 - ExcludeRule $rules | Where-Object {$rules -contains $_.RuleName }
209
- $noViolations.Count | Should Be 0
219
+ $noViolations.Count | Should Be 0
210
220
}
211
221
}
212
222
@@ -329,23 +339,23 @@ Describe "Test CustomizedRulePath" {
329
339
It " When supplied with a collection of paths" {
330
340
$customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomRulePath (" $directory \CommunityAnalyzerRules" , " $directory \SampleRule" , " $directory \SampleRule\SampleRule2" )
331
341
$customizedRulePath.Count | Should Be 3
332
- }
342
+ }
333
343
334
344
}
335
345
336
346
337
347
Context " When used incorrectly" {
338
- It " file cannot be found" {
348
+ It " file cannot be found" {
339
349
try
340
350
{
341
351
Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomRulePath " Invalid CustomRulePath"
342
352
}
343
353
catch
344
354
{
345
355
if (-not $testingLibraryUsage )
346
- {
347
- $Error [0 ].FullyQualifiedErrorId | should match " PathNotFound,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand"
348
- }
356
+ {
357
+ $Error [0 ].FullyQualifiedErrorId | should match " PathNotFound,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand"
358
+ }
349
359
}
350
360
}
351
361
}
0 commit comments