@@ -6,6 +6,7 @@ $directory = Split-Path $MyInvocation.MyCommand.Path
6
6
$settingsTestDirectory = [System.IO.Path ]::Combine($directory , " SettingsTest" )
7
7
$project1Root = [System.IO.Path ]::Combine($settingsTestDirectory , " Project1" )
8
8
$project2Root = [System.IO.Path ]::Combine($settingsTestDirectory , " Project2" )
9
+ $settingsTypeName = ' Microsoft.Windows.PowerShell.ScriptAnalyzer.Settings'
9
10
10
11
Describe " Settings Precedence" {
11
12
Context " settings object is explicit" {
@@ -33,8 +34,7 @@ Describe "Settings Precedence" {
33
34
Describe " Settings Class" {
34
35
Context " When an empty hashtable is provided" {
35
36
BeforeAll {
36
- $settings = New-Object - TypeName ' Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.Settings' `
37
- - ArgumentList @ {}
37
+ $settings = New-Object - TypeName $settingsTypeName - ArgumentList @ {}
38
38
}
39
39
40
40
' IncludeRules' , ' ExcludeRules' , ' Severity' , ' RuleArguments' | ForEach-Object {
@@ -47,8 +47,7 @@ Describe "Settings Class" {
47
47
Context " When a string is provided for IncludeRules in a hashtable" {
48
48
BeforeAll {
49
49
$ruleName = " PSAvoidCmdletAliases"
50
- $settings = New-Object - TypeName ' Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.Settings' `
51
- - ArgumentList @ { IncludeRules = $ruleName }
50
+ $settings = New-Object - TypeName $settingsTypeName - ArgumentList @ { IncludeRules = $ruleName }
52
51
}
53
52
54
53
It " Should return an IncludeRules array with 1 element" {
@@ -69,8 +68,7 @@ Describe "Settings Class" {
69
68
}
70
69
}
71
70
}
72
- $settings = New-Object - TypeName ' Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.Settings' `
73
- - ArgumentList $settingsHashtable
71
+ $settings = New-Object - TypeName $settingsTypeName - ArgumentList $settingsHashtable
74
72
}
75
73
76
74
It " Should return the rule arguments" {
@@ -88,7 +86,7 @@ Describe "Settings Class" {
88
86
89
87
Context " When a settings file path is provided" {
90
88
BeforeAll {
91
- $settings = New-Object - TypeName ' Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.Settings ' `
89
+ $settings = New-Object - TypeName $settingsTypeName `
92
90
- ArgumentList ([System.IO.Path ]::Combine($project1Root , " ExplicitSettings.psd1" ))
93
91
}
94
92
0 commit comments