@@ -47,6 +47,14 @@ AfterAll {
4747}
4848
4949Describe ' Assert-SetupActionProperties' - Tag ' Private' {
50+ BeforeAll {
51+ Mock - CommandName Get-FileVersion - MockWith {
52+ return [PSCustomObject ] @ {
53+ ProductVersion = ' 16.0.1000.6'
54+ }
55+ }
56+ }
57+
5058 Context ' When all properties are valid for setup action '' <MockSetupAction>'' ' - ForEach @ (
5159 @ {
5260 MockSetupAction = ' Install'
@@ -100,6 +108,7 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
100108 It ' Should not throw an exception' {
101109 InModuleScope - Parameters $_ - ScriptBlock {
102110 $null = Assert-SetupActionProperties - Property @ {
111+ MediaPath = $TestDrive
103112 ValidProperty = ' Value'
104113 } - SetupAction $MockSetupAction - ErrorAction ' Stop'
105114 }
@@ -118,6 +127,7 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
118127 InModuleScope - Parameters $_ - ScriptBlock {
119128 {
120129 Assert-SetupActionProperties - Property @ {
130+ MediaPath = $TestDrive
121131 $MockParameterName = ' Value'
122132 } - SetupAction ' NotUsed'
123133 } | Should - Throw - ErrorId ' ARCP0001,Assert-RequiredCommandParameter' # cSpell: disable-line
@@ -162,6 +172,7 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
162172 It ' Should throw the correct error' {
163173 InModuleScope - Parameters $_ - ScriptBlock {
164174 {
175+ $MockParameters.MediaPath = $TestDrive
165176 $MockParameters.Role = ' SPI_AS_NewFarm'
166177
167178 Assert-SetupActionProperties - Property $MockParameters - SetupAction ' NotUsed'
@@ -175,6 +186,7 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
175186 InModuleScope - ScriptBlock {
176187 {
177188 Assert-SetupActionProperties - Property @ {
189+ MediaPath = $TestDrive
178190 SecurityMode = ' SQL'
179191 } - SetupAction ' NotUsed'
180192 } | Should - Throw - ErrorId ' ARCP0001,Assert-RequiredCommandParameter' # cSpell: disable-line
@@ -188,6 +200,7 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
188200 MockFileStreamLevel = $_
189201 } - ScriptBlock {
190202 $null = Assert-SetupActionProperties - Property @ {
203+ MediaPath = $TestDrive
191204 FileStreamLevel = $MockFileStreamLevel
192205 } - SetupAction ' NotUsed' - ErrorAction ' Stop'
193206 }
@@ -201,6 +214,7 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
201214 } - ScriptBlock {
202215 {
203216 Assert-SetupActionProperties - Property @ {
217+ MediaPath = $TestDrive
204218 FileStreamLevel = $MockFileStreamLevel
205219 } - SetupAction ' NotUsed'
206220 } | Should - Throw - ErrorId ' ARCP0001,Assert-RequiredCommandParameter' # cSpell: disable-line
@@ -238,6 +252,7 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
238252 InModuleScope - Parameters $_ - ScriptBlock {
239253 {
240254 Assert-SetupActionProperties - Property @ {
255+ MediaPath = $TestDrive
241256 $MockParameterName = ' AccountName'
242257 } - SetupAction ' NotUsed'
243258 } | Should - Throw - ErrorId ' ARCP0001,Assert-RequiredCommandParameter' # cSpell: disable-line
@@ -274,7 +289,8 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
274289 It ' Should not throw an exception' {
275290 InModuleScope - Parameters $_ - ScriptBlock {
276291 $null = Assert-SetupActionProperties - Property @ {
277- $MockParameterName = ' AccountName'
292+ MediaPath = $TestDrive
293+ $MockParameterName = ' AccountName'
278294 ($MockParameterName -replace ' Account' , ' Password' ) = ' Password'
279295 } - SetupAction ' NotUsed' - ErrorAction ' Stop'
280296 }
@@ -316,6 +332,7 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
316332 It ' Should not throw an exception' {
317333 InModuleScope - Parameters $_ - ScriptBlock {
318334 $null = Assert-SetupActionProperties - Property @ {
335+ MediaPath = $TestDrive
319336 $MockParameterName = ' myMSA$'
320337 } - SetupAction ' NotUsed' - ErrorAction ' Stop'
321338 }
@@ -553,6 +570,7 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
553570 InModuleScope - Parameters $_ - ScriptBlock {
554571 {
555572 Assert-SetupActionProperties - Property @ {
573+ MediaPath = $TestDrive
556574 ASServerMode = ' PowerPivot'
557575 } - SetupAction $MockSetupAction
558576 } | Should - Throw - ErrorId ' ASAP0001,Assert-SetupActionProperties' # cSpell: disable-line
@@ -569,10 +587,51 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
569587 InModuleScope - Parameters $_ - ScriptBlock {
570588 {
571589 Assert-SetupActionProperties - Property @ {
590+ MediaPath = $TestDrive
572591 RsInstallMode = ' DefaultNativeMode'
573592 } - SetupAction $MockSetupAction
574593 } | Should - Throw - ErrorId ' ASAP0002,Assert-SetupActionProperties' # cSpell: disable-line
575594 }
576595 }
577596 }
597+
598+ Context ' When specifying AllowDqRemoval with SQL Server version older than 2025 (17.x)' {
599+ BeforeAll {
600+ Mock - CommandName Get-FileVersion - MockWith {
601+ return [PSCustomObject ] @ {
602+ ProductVersion = ' 16.0.1000.6'
603+ }
604+ }
605+ }
606+
607+ It ' Should throw an exception' {
608+ InModuleScope - ScriptBlock {
609+ {
610+ Assert-SetupActionProperties - Property @ {
611+ MediaPath = $TestDrive
612+ AllowDqRemoval = $true
613+ } - SetupAction ' Upgrade'
614+ } | Should - Throw - ErrorId ' ASAP0003,Assert-SetupActionProperties' # cSpell: disable-line
615+ }
616+ }
617+ }
618+
619+ Context ' When specifying AllowDqRemoval with SQL Server 2025 (17.x)' {
620+ BeforeAll {
621+ Mock - CommandName Get-FileVersion - MockWith {
622+ return [PSCustomObject ] @ {
623+ ProductVersion = ' 17.0.1000.6'
624+ }
625+ }
626+ }
627+
628+ It ' Should not throw an exception' {
629+ InModuleScope - ScriptBlock {
630+ $null = Assert-SetupActionProperties - Property @ {
631+ MediaPath = $TestDrive
632+ AllowDqRemoval = $true
633+ } - SetupAction ' Upgrade' - ErrorAction ' Stop'
634+ }
635+ }
636+ }
578637}
0 commit comments