@@ -51,18 +51,83 @@ Describe "Test importing correct customized rules" {
51
51
}
52
52
53
53
Context " Test Get-ScriptAnalyzer with customized rules" {
54
- It " will show the customized rule" {
54
+ It " will show the custom rule" {
55
55
$customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule\samplerule.psm1 | Where-Object {$_.RuleName -eq $measure }
56
56
$customizedRulePath.Count | Should Be 1
57
57
}
58
-
58
+
59
+ It " will show the custom rule when given a rule folder path" {
60
+ $customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule | Where-Object {$_.RuleName -eq $measure }
61
+ $customizedRulePath.Count | Should Be 1
62
+ }
63
+
64
+ if (! $testingLibraryUsage )
65
+ {
66
+ It " will show the custom rule when given a rule folder path with trailing backslash" {
67
+ $customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule\ | Where-Object {$_.RuleName -eq $measure }
68
+ $customizedRulePath.Count | Should Be 1
69
+ }
70
+
71
+ It " will show the custom rules when given a glob" {
72
+ $customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.RuleName -match $measure }
73
+ $customizedRulePath.Count | Should be 4
74
+ }
75
+
76
+ It " will show the custom rules when given recurse switch" {
77
+ $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule | Where-Object {$_.RuleName -eq $measure }
78
+ $customizedRulePath.Count | Should be 3
79
+ }
80
+
81
+ it " will show the custom rules when given glob with recurse switch" {
82
+ $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.RuleName -eq $measure }
83
+ $customizedRulePath.Count | Should be 5
84
+ }
85
+
86
+ it " will show the custom rules when given glob with recurse switch" {
87
+ $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.RuleName -eq $measure }
88
+ $customizedRulePath.Count | Should be 3
89
+ }
90
+ }
59
91
}
60
92
61
93
Context " Test Invoke-ScriptAnalyzer with customized rules" {
62
- It " will show the customized rule in the results" {
94
+ It " will show the custom rule in the results" {
63
95
$customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule\samplerule.psm1 | Where-Object {$_.Message -eq $message }
64
96
$customizedRulePath.Count | Should Be 1
65
97
}
98
+
99
+ It " will show the custom rule in the results when given a rule folder path" {
100
+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule | Where-Object {$_.Message -eq $message }
101
+ $customizedRulePath.Count | Should Be 1
102
+ }
103
+
104
+ if (! $testingLibraryUsage )
105
+ {
106
+ It " will show the custom rule in the results when given a rule folder path with trailing backslash" {
107
+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule\ | Where-Object {$_.Message -eq $message }
108
+ $customizedRulePath.Count | Should Be 1
109
+ }
110
+
111
+ It " will show the custom rules when given a glob" {
112
+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.Message -eq $message }
113
+ $customizedRulePath.Count | Should be 3
114
+ }
115
+
116
+ It " will show the custom rules when given recurse switch" {
117
+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule | Where-Object {$_.Message -eq $message }
118
+ $customizedRulePath.Count | Should be 3
119
+ }
120
+
121
+ it " will show the custom rules when given glob with recurse switch" {
122
+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.Message -eq $message }
123
+ $customizedRulePath.Count | Should be 4
124
+ }
125
+
126
+ it " will show the custom rules when given glob with recurse switch" {
127
+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.Message -eq $message }
128
+ $customizedRulePath.Count | Should be 3
129
+ }
130
+ }
66
131
}
132
+ }
67
133
68
- }
0 commit comments