File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ Describe 'Disable-SqlDscDatabaseSnapshotIsolation' -Tag 'Public' {
9595
9696 $script :setSnapshotIsolationCalled = $false
9797 $script :setSnapshotIsolationValue = $null
98+ $script :refreshCalled = $false
9899
99100 $mockDatabaseObject | Add-Member - MemberType ' ScriptMethod' - Name ' SetSnapshotIsolation' - Value {
100101 param ($Enable )
@@ -114,6 +115,7 @@ Describe 'Disable-SqlDscDatabaseSnapshotIsolation' -Tag 'Public' {
114115
115116 $mockDatabaseObject | Add-Member - MemberType ' ScriptMethod' - Name ' Refresh' - Value {
116117 # Mock implementation - in real SMO this updates properties from server
118+ $script :refreshCalled = $true
117119 } - Force
118120
119121 $mockServerObject = New-Object - TypeName ' Microsoft.SqlServer.Management.Smo.Server'
@@ -153,10 +155,12 @@ Describe 'Disable-SqlDscDatabaseSnapshotIsolation' -Tag 'Public' {
153155 # Reset state for this test
154156 $mockDatabaseObject.SnapshotIsolationState = ' Enabled'
155157 $script :setSnapshotIsolationCalled = $false
158+ $script :refreshCalled = $false
156159
157160 $null = Disable-SqlDscDatabaseSnapshotIsolation - ServerObject $mockServerObject - Name ' TestDatabase' - Force - Refresh
158161
159162 $mockDatabaseObject.SnapshotIsolationState | Should - Be ' Disabled'
163+ $script :refreshCalled | Should - BeTrue - Because ' Refresh should be called when -Refresh is specified'
160164 }
161165 }
162166
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ Describe 'Enable-SqlDscDatabaseSnapshotIsolation' -Tag 'Public' {
9595
9696 $script :setSnapshotIsolationCalled = $false
9797 $script :setSnapshotIsolationValue = $null
98+ $script :refreshCalled = $false
9899
99100 $mockDatabaseObject | Add-Member - MemberType ' ScriptMethod' - Name ' SetSnapshotIsolation' - Value {
100101 param ($Enable )
@@ -114,6 +115,7 @@ Describe 'Enable-SqlDscDatabaseSnapshotIsolation' -Tag 'Public' {
114115
115116 $mockDatabaseObject | Add-Member - MemberType ' ScriptMethod' - Name ' Refresh' - Value {
116117 # Mock implementation - in real SMO this updates properties from server
118+ $script :refreshCalled = $true
117119 } - Force
118120
119121 $mockServerObject = New-Object - TypeName ' Microsoft.SqlServer.Management.Smo.Server'
@@ -153,10 +155,12 @@ Describe 'Enable-SqlDscDatabaseSnapshotIsolation' -Tag 'Public' {
153155 # Reset state for this test
154156 $mockDatabaseObject.SnapshotIsolationState = ' Disabled'
155157 $script :setSnapshotIsolationCalled = $false
158+ $script :refreshCalled = $false
156159
157160 $null = Enable-SqlDscDatabaseSnapshotIsolation - ServerObject $mockServerObject - Name ' TestDatabase' - Force - Refresh
158161
159162 $mockDatabaseObject.SnapshotIsolationState | Should - Be ' Enabled'
163+ $script :refreshCalled | Should - BeTrue - Because ' Refresh should be called when -Refresh is specified'
160164 }
161165 }
162166
You can’t perform that action at this time.
0 commit comments