@@ -6,6 +6,7 @@ $directory = Split-Path $MyInvocation.MyCommand.Path
66$settingsTestDirectory = [System.IO.Path ]::Combine($directory , " SettingsTest" )
77$project1Root = [System.IO.Path ]::Combine($settingsTestDirectory , " Project1" )
88$project2Root = [System.IO.Path ]::Combine($settingsTestDirectory , " Project2" )
9+ $settingsTypeName = ' Microsoft.Windows.PowerShell.ScriptAnalyzer.Settings'
910
1011Describe " Settings Precedence" {
1112 Context " settings object is explicit" {
@@ -33,8 +34,7 @@ Describe "Settings Precedence" {
3334Describe " Settings Class" {
3435 Context " When an empty hashtable is provided" {
3536 BeforeAll {
36- $settings = New-Object - TypeName ' Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.Settings' `
37- - ArgumentList @ {}
37+ $settings = New-Object - TypeName $settingsTypeName - ArgumentList @ {}
3838 }
3939
4040 ' IncludeRules' , ' ExcludeRules' , ' Severity' , ' RuleArguments' | ForEach-Object {
@@ -47,8 +47,7 @@ Describe "Settings Class" {
4747 Context " When a string is provided for IncludeRules in a hashtable" {
4848 BeforeAll {
4949 $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 }
5251 }
5352
5453 It " Should return an IncludeRules array with 1 element" {
@@ -69,8 +68,7 @@ Describe "Settings Class" {
6968 }
7069 }
7170 }
72- $settings = New-Object - TypeName ' Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.Settings' `
73- - ArgumentList $settingsHashtable
71+ $settings = New-Object - TypeName $settingsTypeName - ArgumentList $settingsHashtable
7472 }
7573
7674 It " Should return the rule arguments" {
@@ -88,7 +86,7 @@ Describe "Settings Class" {
8886
8987 Context " When a settings file path is provided" {
9088 BeforeAll {
91- $settings = New-Object - TypeName ' Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.Settings ' `
89+ $settings = New-Object - TypeName $settingsTypeName `
9290 - ArgumentList ([System.IO.Path ]::Combine($project1Root , " ExplicitSettings.psd1" ))
9391 }
9492
0 commit comments