Skip to content

Commit

Permalink
Fix tests after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed May 16, 2020
1 parent 7543600 commit 9aff055
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions tests/Unit/SqlServerDsc.Common.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,10 @@ Describe 'SqlServerDsc.Common\Restart-SqlService' -Tag 'RestartSqlService' {
It 'Should restart SQL Service and running SQL Agent service' {
{ Restart-SqlService -ServerName $env:COMPUTERNAME -InstanceName 'MSSQLSERVER' } | Should -Not -Throw

# Assert-MockCalled -CommandName Connect-SQL -ParameterFilter {
# # Make sure we assert just the first call to Connect-SQL
# $PSBoundParameters.ContainsKey('ErrorAction') -eq $false
# } -Scope It -Exactly -Times 1
Assert-MockCalled -CommandName Connect-SQL -ParameterFilter {
# Make sure we assert just the first call to Connect-SQL
$PSBoundParameters.ContainsKey('ErrorAction') -eq $false
} -Scope It -Exactly -Times 1

Assert-MockCalled -CommandName Restart-SqlClusterService -Scope It -Exactly -Times 0 -ModuleName $script:subModuleName
Assert-MockCalled -CommandName Get-Service -Scope It -Exactly -Times 1
Expand Down Expand Up @@ -1843,7 +1843,7 @@ Describe 'SqlServerDsc.Common\Update-AvailabilityGroupReplica' -Tag 'UpdateAvail
$mockErrorMessage | Should -Not -BeNullOrEmpty

# Support both Pester 4 and 5.
if ((Get-Module pester).Version -ge '5.0.0.0')
if ((Get-Module -Name Pester).Version -ge '5.0.0')
{
$mockErrorMessage = $mockErrorMessage + '*'
}
Expand Down Expand Up @@ -1887,22 +1887,22 @@ Describe 'SqlServerDsc.Common\Test-LoginEffectivePermissions' -Tag 'TestLoginEff
}
}
}
}

$testLoginEffectiveServerPermissionsParams = @{
ServerName = 'Server1'
InstanceName = 'MSSQLSERVER'
Login = 'NT SERVICE\ClusSvc'
Permissions = @()
}
$testLoginEffectiveServerPermissionsParams = @{
ServerName = 'Server1'
InstanceName = 'MSSQLSERVER'
Login = 'NT SERVICE\ClusSvc'
Permissions = @()
}

$testLoginEffectiveLoginPermissionsParams = @{
ServerName = 'Server1'
InstanceName = 'MSSQLSERVER'
Login = 'NT SERVICE\ClusSvc'
Permissions = @()
SecurableClass = 'LOGIN'
SecurableName = 'Login1'
}
$testLoginEffectiveLoginPermissionsParams = @{
ServerName = 'Server1'
InstanceName = 'MSSQLSERVER'
Login = 'NT SERVICE\ClusSvc'
Permissions = @()
SecurableClass = 'LOGIN'
SecurableName = 'Login1'
}
}

Expand Down Expand Up @@ -3150,9 +3150,8 @@ Describe 'SqlServerDsc.Common\Invoke-SqlScript' -Tag 'InvokeSqlScript' {
BeforeAll {
$throwMessage = "Failed to import SQLPS module."

Mock -CommandName Import-SQLPSModule -MockWith {
throw $throwMessage
}
Mock -CommandName Import-SQLPSModule -MockWith {
throw $throwMessage
}
}

Expand Down

0 comments on commit 9aff055

Please sign in to comment.