Skip to content

Commit b7e83a6

Browse files
committed
Add test for pipeline input handling in Get-SqlDscStartupParameter
1 parent eaffdcd commit b7e83a6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/Unit/Public/Get-SqlDscStartupParameter.Tests.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,26 @@ Describe 'Get-SqlDscStartupParameter' -Tag 'Public' {
251251
Should -Invoke -CommandName Get-SqlDscManagedComputerService -Exactly -Times 0 -Scope It
252252
}
253253
}
254+
255+
Context 'When passing a service object via pipeline' {
256+
It 'Should accept ServiceObject from pipeline and return correct results' {
257+
$result = $mockServiceObject | Get-SqlDscStartupParameter
258+
259+
Should -ActualValue $result -BeOfType (InModuleScope -ScriptBlock { [StartupParameters] })
260+
261+
Should -ActualValue $result.TraceFlag -BeOfType 'System.UInt32[]'
262+
Should -ActualValue $result.DataFilePath -BeOfType 'System.String[]'
263+
Should -ActualValue $result.LogFilePath -BeOfType 'System.String[]'
264+
Should -ActualValue $result.ErrorLogPath -BeOfType 'System.String[]'
265+
266+
$result.DataFilePath | Should -Be 'C:\Program Files\Microsoft SQL Server\MSSQL16.SQL2022\MSSQL\DATA\master.mdf'
267+
$result.LogFilePath | Should -Be 'C:\Program Files\Microsoft SQL Server\MSSQL16.SQL2022\MSSQL\DATA\log.ldf'
268+
$result.ErrorLogPath | Should -Be 'C:\Program Files\Microsoft SQL Server\MSSQL16.SQL2022\MSSQL\Log\ERRORLOG'
269+
$result.TraceFlag | Should -BeNullOrEmpty
270+
271+
Should -Invoke -CommandName Get-SqlDscManagedComputerService -Exactly -Times 0 -Scope It
272+
}
273+
}
254274
}
255275

256276
Context 'When one trace flag exist' {

0 commit comments

Comments
 (0)