You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It 'Should return an object with expected DataFilePath property' {
136
136
$script:result.DataFilePath| Should -Not-BeNullOrEmpty
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
-
}
137
+
$script:result.DataFilePath| Should -BeOfType ([System.String])
138
+
$script:result.DataFilePath| Should -Match'\.mdf$'
145
139
}
146
140
147
141
It 'Should return an object with expected LogFilePath property' {
148
142
$script:result.LogFilePath| Should -Not-BeNullOrEmpty
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
-
}
143
+
$script:result.LogFilePath| Should -BeOfType ([System.String])
144
+
$script:result.LogFilePath| Should -Match'\.ldf$'
157
145
}
158
146
159
147
It 'Should return an object with expected ErrorLogPath property' {
160
148
$script:result.ErrorLogPath| Should -Not-BeNullOrEmpty
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
-
}
149
+
$script:result.ErrorLogPath| Should -BeOfType ([System.String])
150
+
$script:result.ErrorLogPath| Should -Match'ERRORLOG$'
169
151
}
170
152
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])
153
+
It 'Should return TraceFlag property as expected type' {
154
+
# TraceFlag can be null, a single UInt32, or an array
155
+
if ($null-ne$script:result.TraceFlag) {
156
+
# Check if it's either a single UInt32 or UInt32 array
157
+
($script:result.TraceFlag-is [System.UInt32]) -or ($script:result.TraceFlag-is [System.UInt32[]]) | Should -BeTrue -Because 'TraceFlag can be a single value or array depending on how many flags are set'
177
158
} else {
178
-
# TraceFlag can be empty/null if no trace flags are set
179
-
$script:result.TraceFlag| Should -BeNullOrEmpty
159
+
$script:result.TraceFlag| Should -BeNullOrEmpty -Because 'TraceFlag can be empty/null if no trace flags are set'
180
160
}
181
161
}
182
162
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[]])
$script:result.InternalTraceFlag| Should -BeOfType ([System.UInt32])
163
+
It 'Should return InternalTraceFlag property as expected type' {
164
+
# InternalTraceFlag can be null, a single UInt32, or an array
165
+
if ($null-ne$script:result.InternalTraceFlag) {
166
+
# Check if it's either a single UInt32 or UInt32 array
167
+
($script:result.InternalTraceFlag-is [System.UInt32]) -or ($script:result.InternalTraceFlag-is [System.UInt32[]]) | Should -BeTrue -Because 'InternalTraceFlag can be a single value or array depending on how many flags are set'
189
168
} else {
190
-
# InternalTraceFlag can be empty/null if no internal trace flags are set
191
-
$script:result.InternalTraceFlag| Should -BeNullOrEmpty
169
+
$script:result.InternalTraceFlag| Should -BeNullOrEmpty -Because 'InternalTraceFlag can be empty/null if no internal trace flags are set'
192
170
}
193
171
}
194
172
}
195
173
196
174
Context 'When comparing results from different parameter sets' {
197
175
It 'Should return the same results for ByServerName and ByServiceObject parameter sets' {
0 commit comments