@@ -86,33 +86,30 @@ Describe "Test importing correct customized rules" {
8686 $customizedRulePath.Count | Should Be 1
8787 }
8888
89- if (! $testingLibraryUsage )
90- {
91- It " will show the custom rule when given a rule folder path with trailing backslash" {
92- $customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule\ | Where-Object {$_.RuleName -eq $measure }
93- $customizedRulePath.Count | Should Be 1
94- }
89+ It " will show the custom rule when given a rule folder path with trailing backslash" {
90+ $customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule\ | Where-Object {$_.RuleName -eq $measure }
91+ $customizedRulePath.Count | Should Be 1
92+ }
9593
96- It " will show the custom rules when given a glob" {
97- $customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.RuleName -match $measure }
98- $customizedRulePath.Count | Should be 4
99- }
94+ It " will show the custom rules when given a glob" {
95+ $customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.RuleName -match $measure }
96+ $customizedRulePath.Count | Should be 4
97+ }
10098
101- It " will show the custom rules when given recurse switch" {
102- $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath " $directory \samplerule" , " $directory \samplerule\samplerule2" | Where-Object {$_.RuleName -eq $measure }
103- $customizedRulePath.Count | Should be 5
104- }
99+ It " will show the custom rules when given recurse switch" {
100+ $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath " $directory \samplerule" , " $directory \samplerule\samplerule2" | Where-Object {$_.RuleName -eq $measure }
101+ $customizedRulePath.Count | Should be 5
102+ }
105103
106- it " will show the custom rules when given glob with recurse switch" {
107- $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.RuleName -eq $measure }
108- $customizedRulePath.Count | Should be 5
109- }
110-
111- it " will show the custom rules when given glob with recurse switch" {
112- $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.RuleName -eq $measure }
113- $customizedRulePath.Count | Should be 3
114- }
104+ It " will show the custom rules when given glob with recurse switch" {
105+ $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.RuleName -eq $measure }
106+ $customizedRulePath.Count | Should be 5
115107 }
108+
109+ It " will show the custom rules when given glob with recurse switch" {
110+ $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.RuleName -eq $measure }
111+ $customizedRulePath.Count | Should be 3
112+ }
116113 }
117114
118115 Context " Test Invoke-ScriptAnalyzer with customized rules" {
@@ -126,33 +123,46 @@ Describe "Test importing correct customized rules" {
126123 $customizedRulePath.Count | Should Be 1
127124 }
128125
129- if (! $testingLibraryUsage )
130- {
131- It " will show the custom rule in the results when given a rule folder path with trailing backslash" {
132- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule\ | Where-Object {$_.Message -eq $message }
133- $customizedRulePath.Count | Should Be 1
134- }
126+ It " will show the custom rule in the results when given a rule folder path with trailing backslash" {
127+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule\ | Where-Object {$_.Message -eq $message }
128+ $customizedRulePath.Count | Should Be 1
129+ }
135130
136- It " will show the custom rules when given a glob" {
137- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.Message -eq $message }
138- $customizedRulePath.Count | Should be 3
139- }
131+ It " will show the custom rules when given a glob" {
132+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.Message -eq $message }
133+ $customizedRulePath.Count | Should be 3
134+ }
140135
141- It " will show the custom rules when given recurse switch" {
142- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule | Where-Object {$_.Message -eq $message }
143- $customizedRulePath.Count | Should be 3
144- }
136+ It " will show the custom rules when given recurse switch" {
137+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule | Where-Object {$_.Message -eq $message }
138+ $customizedRulePath.Count | Should be 3
139+ }
145140
146- it " will show the custom rules when given glob with recurse switch" {
147- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.Message -eq $message }
148- $customizedRulePath.Count | Should be 4
149- }
141+ It " will show the custom rules when given glob with recurse switch" {
142+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.Message -eq $message }
143+ $customizedRulePath.Count | Should be 4
144+ }
150145
151- it " will show the custom rules when given glob with recurse switch" {
152- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.Message -eq $message }
153- $customizedRulePath.Count | Should be 3
154- }
146+ It " will show the custom rules when given glob with recurse switch" {
147+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.Message -eq $message }
148+ $customizedRulePath.Count | Should be 3
155149 }
150+
151+ It " Using IncludeDefaultRules Switch with CustomRulePath" {
152+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomRulePath $directory \samplerule\samplerule.psm1 - IncludeDefaultRules
153+ $customizedRulePath.Count | Should Be 2
154+ }
155+
156+ It " Using IncludeDefaultRules Switch without CustomRulePath" {
157+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - IncludeDefaultRules
158+ $customizedRulePath.Count | Should Be 1
159+ }
160+
161+ It " Not Using IncludeDefaultRules Switch and without CustomRulePath" {
162+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1
163+ $customizedRulePath.Count | Should Be 1
164+ }
165+
156166 }
157167}
158168
0 commit comments