@@ -134,28 +134,62 @@ Describe 'Get-SqlDscStartupParameter' -Tag @('Integration_SQL2017', 'Integration
134134
135135 It ' Should return an object with expected DataFilePath property' {
136136 $script :result.DataFilePath | Should -Not - BeNullOrEmpty
137- $script :result.DataFilePath | Should - BeOfType ([System.String []])
138- $script :result.DataFilePath [0 ] | Should -Match ' \.mdf$'
137+ # PowerShell unwraps single-element arrays to scalars, so we need to handle both cases
138+ if ($script :result.DataFilePath -is [System.Array ]) {
139+ $script :result.DataFilePath | Should - BeOfType ([System.String []])
140+ $script :result.DataFilePath [0 ] | Should -Match ' \.mdf$'
141+ } else {
142+ $script :result.DataFilePath | Should - BeOfType ([System.String ])
143+ $script :result.DataFilePath | Should -Match ' \.mdf$'
144+ }
139145 }
140146
141147 It ' Should return an object with expected LogFilePath property' {
142148 $script :result.LogFilePath | Should -Not - BeNullOrEmpty
143- $script :result.LogFilePath | Should - BeOfType ([System.String []])
144- $script :result.LogFilePath [0 ] | Should -Match ' \.ldf$'
149+ # PowerShell unwraps single-element arrays to scalars, so we need to handle both cases
150+ if ($script :result.LogFilePath -is [System.Array ]) {
151+ $script :result.LogFilePath | Should - BeOfType ([System.String []])
152+ $script :result.LogFilePath [0 ] | Should -Match ' \.ldf$'
153+ } else {
154+ $script :result.LogFilePath | Should - BeOfType ([System.String ])
155+ $script :result.LogFilePath | Should -Match ' \.ldf$'
156+ }
145157 }
146158
147159 It ' Should return an object with expected ErrorLogPath property' {
148160 $script :result.ErrorLogPath | Should -Not - BeNullOrEmpty
149- $script :result.ErrorLogPath | Should - BeOfType ([System.String []])
150- $script :result.ErrorLogPath [0 ] | Should -Match ' ERRORLOG$'
161+ # PowerShell unwraps single-element arrays to scalars, so we need to handle both cases
162+ if ($script :result.ErrorLogPath -is [System.Array ]) {
163+ $script :result.ErrorLogPath | Should - BeOfType ([System.String []])
164+ $script :result.ErrorLogPath [0 ] | Should -Match ' ERRORLOG$'
165+ } else {
166+ $script :result.ErrorLogPath | Should - BeOfType ([System.String ])
167+ $script :result.ErrorLogPath | Should -Match ' ERRORLOG$'
168+ }
151169 }
152170
153- It ' Should return TraceFlag property as an array' {
154- $script :result.TraceFlag | Should - BeOfType ([System.UInt32 []])
171+ It ' Should return TraceFlag property as an array or single value' {
172+ # PowerShell unwraps single-element arrays to scalars, so we need to handle both cases
173+ if ($script :result.TraceFlag -is [System.Array ]) {
174+ $script :result.TraceFlag | Should - BeOfType ([System.UInt32 []])
175+ } elseif ($script :result.TraceFlag -ne $null ) {
176+ $script :result.TraceFlag | Should - BeOfType ([System.UInt32 ])
177+ } else {
178+ # TraceFlag can be empty/null if no trace flags are set
179+ $script :result.TraceFlag | Should - BeNullOrEmpty
180+ }
155181 }
156182
157- It ' Should return InternalTraceFlag property as an array' {
158- $script :result.InternalTraceFlag | Should - BeOfType ([System.UInt32 []])
183+ It ' Should return InternalTraceFlag property as an array or single value' {
184+ # PowerShell unwraps single-element arrays to scalars, so we need to handle both cases
185+ if ($script :result.InternalTraceFlag -is [System.Array ]) {
186+ $script :result.InternalTraceFlag | Should - BeOfType ([System.UInt32 []])
187+ } elseif ($script :result.InternalTraceFlag -ne $null ) {
188+ $script :result.InternalTraceFlag | Should - BeOfType ([System.UInt32 ])
189+ } else {
190+ # InternalTraceFlag can be empty/null if no internal trace flags are set
191+ $script :result.InternalTraceFlag | Should - BeNullOrEmpty
192+ }
159193 }
160194 }
161195
0 commit comments