Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Borgquite committed Aug 12, 2024
1 parent da90e10 commit a4a9faa
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 34 deletions.
30 changes: 13 additions & 17 deletions tests/Unit/DSC_SqlScript.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,16 @@ Describe 'SqlScript\Get-TargetResource' -Tag 'Get' {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

$mockTestParametersTimeout = $mockDefaultParameters.Clone()
$mockTestParametersTimeout.QueryTimeout = 30
$mockGetTargetResourceParameters.QueryTimeout = 30

$result = Get-TargetResource @mockTestParametersTimeout
$result = Get-TargetResource @mockGetTargetResourceParameters

$result | Should -BeOfType [System.Collections.Hashtable]
$result.Id | Should -Be $mockTestParametersTimeout.Id
$result.ServerInstance | Should -Be $mockTestParametersTimeout.ServerInstance
$result.SetFilePath | Should -Be $mockTestParametersTimeout.SetFilePath
$result.GetFilePath | Should -Be $mockTestParametersTimeout.GetFilePath
$result.TestFilePath | Should -Be $mockTestParametersTimeout.TestFilePath
$result.Id | Should -Be $mockGetTargetResourceParameters.Id
$result.ServerInstance | Should -Be $mockGetTargetResourceParameters.ServerInstance
$result.SetFilePath | Should -Be $mockGetTargetResourceParameters.SetFilePath
$result.GetFilePath | Should -Be $mockGetTargetResourceParameters.GetFilePath
$result.TestFilePath | Should -Be $mockGetTargetResourceParameters.TestFilePath
}
}
}
Expand Down Expand Up @@ -212,10 +211,9 @@ Describe 'SqlScript\Set-TargetResource' -Tag 'Set' {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

$mockTestParametersTimeout = $mockDefaultParameters.Clone()
$mockTestParametersTimeout.QueryTimeout = 30
$mockSetTargetResourceParameters.QueryTimeout = 30

{ Set-TargetResource @mockTestParametersTimeout } | Should -Not -Throw
{ Set-TargetResource @mockSetTargetResourceParameters } | Should -Not -Throw
}
}
}
Expand Down Expand Up @@ -288,10 +286,9 @@ Describe 'SqlScript\Test-TargetResource' {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

$mockTestParametersTimeout = $mockDefaultParameters.Clone()
$mockTestParametersTimeout.QueryTimeout = 30
$mockTestTargetResourceParameters.QueryTimeout = 30

$result = Test-TargetResource @mockTestParametersTimeout
$result = Test-TargetResource @mockTestTargetResourceParameters

$result | Should -BeTrue
}
Expand All @@ -311,10 +308,9 @@ Describe 'SqlScript\Test-TargetResource' {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

$mockTestParametersTimeout = $mockDefaultParameters.Clone()
$mockTestParametersTimeout.QueryTimeout = 30
$mockTestTargetResourceParameters.QueryTimeout = 30

$result = Test-TargetResource @mockTestParametersTimeout
$result = Test-TargetResource @mockTestTargetResourceParameters

$result | Should -BeFalse
}
Expand Down
30 changes: 13 additions & 17 deletions tests/Unit/DSC_SqlScriptQuery.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,16 @@ Describe 'SqlScriptQuery\Get-TargetResource' -Tag 'Get' {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

$mockTestParametersTimeout = $mockDefaultParameters.Clone()
$mockTestParametersTimeout.QueryTimeout = 30
$mockGetTargetResourceParameters.QueryTimeout = 30

$result = Get-TargetResource @mockTestParametersTimeout
$result = Get-TargetResource @mockGetTargetResourceParameters

$result | Should -BeOfType [System.Collections.Hashtable]
$result.Id | Should -Be $mockTestParametersTimeout.Id
$result.ServerInstance | Should -Be $mockTestParametersTimeout.ServerInstance
$result.GetQuery | Should -Be $mockTestParametersTimeout.GetQuery
$result.SetQuery | Should -Be $mockTestParametersTimeout.SetQuery
$result.TestQuery | Should -Be $mockTestParametersTimeout.TestQuery
$result.Id | Should -Be $mockGetTargetResourceParameters.Id
$result.ServerInstance | Should -Be $mockGetTargetResourceParameters.ServerInstance
$result.GetQuery | Should -Be $mockGetTargetResourceParameters.GetQuery
$result.SetQuery | Should -Be $mockGetTargetResourceParameters.SetQuery
$result.TestQuery | Should -Be $mockGetTargetResourceParameters.TestQuery
}
}
}
Expand Down Expand Up @@ -212,10 +211,9 @@ Describe 'SqlScriptQuery\Set-TargetResource' -Tag 'Set' {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

$mockTestParametersTimeout = $mockDefaultParameters.Clone()
$mockTestParametersTimeout.QueryTimeout = 30
$mockSetTargetResourceParameters.QueryTimeout = 30

{ Set-TargetResource @mockTestParametersTimeout } | Should -Not -Throw
{ Set-TargetResource @mockSetTargetResourceParameters } | Should -Not -Throw
}
}
}
Expand Down Expand Up @@ -288,10 +286,9 @@ Describe 'SqlScriptQuery\Test-TargetResource' {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

$mockTestParametersTimeout = $mockDefaultParameters.Clone()
$mockTestParametersTimeout.QueryTimeout = 30
$mockTestTargetResourceParameters.QueryTimeout = 30

$result = Test-TargetResource @mockTestParametersTimeout
$result = Test-TargetResource @mockTestTargetResourceParameters

$result | Should -BeTrue
}
Expand All @@ -311,10 +308,9 @@ Describe 'SqlScriptQuery\Test-TargetResource' {
InModuleScope -ScriptBlock {
Set-StrictMode -Version 1.0

$mockTestParametersTimeout = $mockDefaultParameters.Clone()
$mockTestParametersTimeout.QueryTimeout = 30
$mockTestTargetResourceParameters.QueryTimeout = 30

$result = Test-TargetResource @mockTestParametersTimeout
$result = Test-TargetResource @mockTestTargetResourceParameters

$result | Should -BeFalse
}
Expand Down

0 comments on commit a4a9faa

Please sign in to comment.