From a1d3ea44e70a37c653fa793f5cd083bf1e1a2634 Mon Sep 17 00:00:00 2001 From: Michael Fyffe <6224270+TraGicCode@users.noreply.github.com> Date: Sun, 8 Apr 2018 04:03:51 -0500 Subject: [PATCH] SqlWaitForAg: Updated unit tests to use latest unit test template (#1100) - Changes to SqlWaitForAg - Updated unit test template to version 1.2.1 (issue #1088) --- CHANGELOG.md | 5 +++++ Tests/Unit/MSFT_SqlWaitForAG.Tests.ps1 | 21 +++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 490fd5dfc..a28de53fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Tests/Unit/MSFT_SqlWaitForAG.Tests.ps1 b/Tests/Unit/MSFT_SqlWaitForAG.Tests.ps1 index 226dd6a65..20fddd345 100644 --- a/Tests/Unit/MSFT_SqlWaitForAG.Tests.ps1 +++ b/Tests/Unit/MSFT_SqlWaitForAG.Tests.ps1 @@ -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 @@ -32,7 +29,7 @@ try { Invoke-TestSetup - InModuleScope $script:DSCResourceName { + InModuleScope 'MSFT_SqlWaitForAG' { $mockClusterGroupName = 'AGTest' $mockRetryInterval = 1 $mockRetryCount = 2 @@ -78,7 +75,7 @@ try RetryCount = $mockRetryCount } - Describe 'MSFT_SqlWaitForAG\Get-TargetResource' -Tag 'Get' { + Describe 'SqlWaitForAG\Get-TargetResource' -Tag 'Get' { BeforeEach { $testParameters = $mockDefaultParameters.Clone() @@ -142,7 +139,7 @@ try } - Describe 'MSFT_SqlWaitForAG\Test-TargetResource' -Tag 'Test'{ + Describe 'SqlWaitForAG\Test-TargetResource' -Tag 'Test'{ BeforeEach { $testParameters = $mockDefaultParameters.Clone() @@ -191,7 +188,7 @@ try Assert-VerifiableMock } - Describe 'MSFT_SqlWaitForAG\Set-TargetResource' -Tag 'Set'{ + Describe 'SqlWaitForAG\Set-TargetResource' -Tag 'Set'{ BeforeEach { $testParameters = $mockDefaultParameters.Clone()