Tests/Get-ARMtemplateScript.Tests.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
#$here = Split-Path -Parent $MyInvocation.MyCommand.Path #$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.' #. "$here\$sut" $modulePath = Split-Path $PSScriptRoot -Parent $modulepath = Join-Path -Path $modulePath -ChildPath posharm.psd1 Import-Module $modulePath Describe "Get-ARMtemplateScript" { Context "Single variable added to template" { New-ARMTemplate $expected = @{ Name = "test" Value = "foo-bar" } New-ARMvariable @expected | Add-ARMvariable $variableScript = Get-ARMtemplate | Get-ARMtemplateScript $scriptBlock = [scriptblock]::Create($variableScript) It "Invoking the script should not throw" { { $scriptBlock.Invoke() } | Should Not Throw } It "Invoking the script should create a new variable" { ((Get-ARMtemplate).variables.psobject.properties | Measure-Object).Count | Should be 1 } } } Remove-Module -name posharm -ErrorAction SilentlyContinue |