Skip to content

Commit

Permalink
SqlWaitForAg: Updated unit tests to use latest unit test template (ds…
Browse files Browse the repository at this point in the history
…ccommunity#1100)

- Changes to SqlWaitForAg
  -  Updated unit test template to version 1.2.1 (issue dsccommunity#1088)
  • Loading branch information
TraGicCode authored and johlju committed Apr 8, 2018
1 parent 244634e commit a1d3ea4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

- Changes to Unit Tests
- [Michael Fyffe (@TraGicCode)](https://github.com/TraGicCode): Updated
the following resources unit test template to version 1.2.1
- SqlWaitForAG ([issue #1088](https://github.com/PowerShell/SqlServerDsc/issues/1088)).

## 11.1.0.0

- Changes to SqlServerDsc
Expand Down
21 changes: 9 additions & 12 deletions Tests/Unit/MSFT_SqlWaitForAG.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
$script:DSCModuleName = 'SqlServerDsc'
$script:DSCResourceName = 'MSFT_SqlWaitForAG'

#region HEADER

# Unit Test Template Version: 1.2.0
# Unit Test Template Version: 1.2.1
$script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or `
(-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) )
{
& git @('clone','https://github.com/PowerShell/DscResource.Tests.git',(Join-Path -Path $script:moduleRoot -ChildPath '\DSCResource.Tests\'))
& git @('clone','https://github.com/PowerShell/DscResource.Tests.git',(Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))
}

Import-Module (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1') -Force
Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force

$TestEnvironment = Initialize-TestEnvironment `
-DSCModuleName $script:DSCModuleName `
-DSCResourceName $script:DSCResourceName `
-DSCModuleName 'SqlServerDsc' `
-DSCResourceName 'MSFT_SqlWaitForAG' `
-TestType Unit

#endregion HEADER
Expand All @@ -32,7 +29,7 @@ try
{
Invoke-TestSetup

InModuleScope $script:DSCResourceName {
InModuleScope 'MSFT_SqlWaitForAG' {
$mockClusterGroupName = 'AGTest'
$mockRetryInterval = 1
$mockRetryCount = 2
Expand Down Expand Up @@ -78,7 +75,7 @@ try
RetryCount = $mockRetryCount
}

Describe 'MSFT_SqlWaitForAG\Get-TargetResource' -Tag 'Get' {
Describe 'SqlWaitForAG\Get-TargetResource' -Tag 'Get' {
BeforeEach {
$testParameters = $mockDefaultParameters.Clone()

Expand Down Expand Up @@ -142,7 +139,7 @@ try
}


Describe 'MSFT_SqlWaitForAG\Test-TargetResource' -Tag 'Test'{
Describe 'SqlWaitForAG\Test-TargetResource' -Tag 'Test'{
BeforeEach {
$testParameters = $mockDefaultParameters.Clone()

Expand Down Expand Up @@ -191,7 +188,7 @@ try
Assert-VerifiableMock
}

Describe 'MSFT_SqlWaitForAG\Set-TargetResource' -Tag 'Set'{
Describe 'SqlWaitForAG\Set-TargetResource' -Tag 'Set'{
BeforeEach {
$testParameters = $mockDefaultParameters.Clone()

Expand Down

0 comments on commit a1d3ea4

Please sign in to comment.