File tree 1 file changed +22
-0
lines changed
CustomPSScriptAnalyzerRules/Tests/Integration 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ Describe " Testing rule Measure-PascalCase against ExampleScript.ps1" {
3
+
4
+ $ExampleResults = Invoke-ScriptAnalyzer - Path " $ ( $PSScriptRoot ) \..\..\ExampleScript.ps1" - CustomRulePath " $ ( $PSScriptRoot ) \..\..\MBAnalyzerRules.psm1"
5
+
6
+ $VariableNames = $ExampleResults.Extent.Text | ForEach-Object { ($_ -split ' = ' )[0 ].Trim(' $' ) }
7
+ $TestCases = @ (
8
+ @ { ExpectedViolation = ' statusUrl' },
9
+ @ { ExpectedViolation = ' errorUrl' },
10
+ @ { ExpectedViolation = ' NAMESPACE' },
11
+ @ { ExpectedViolation = ' uwfInstance' },
12
+ @ { ExpectedViolation = ' UWFEnabled' }
13
+ )
14
+
15
+ It " Should return 6 violations" {
16
+ $ExampleResults.Count | Should Be 6
17
+ }
18
+ It " Detected violations should contain <ExpectedViolation>" - TestCases $TestCases {
19
+ Param ($ExpectedViolation )
20
+ $VariableNames -contains $ExpectedViolation | Should Be $True
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments