Skip to content

Instantly share code, notes, and snippets.

@alx9r
Created January 12, 2017 23:03
Show Gist options
  • Save alx9r/7749f3a0657941d0b5839128dcf19feb to your computer and use it in GitHub Desktop.
Save alx9r/7749f3a0657941d0b5839128dcf19feb to your computer and use it in GitHub Desktop.
Import-Module Pester
Import-Module AzureRM.Resources
Get-Command New-AzureRmResourceGroupDeployment | % ModuleName
[string](Get-Module AzureRM.Resources).Version
$PSVersionTable
Push-Location (Get-Module Pester).ModuleBase
$allVersions = git tag |
% {
try { [version]$_ }
catch {}
}
$recentVersions = $allVersions |
? { $_.Major -ge 3 }
foreach ( $version in $recentVersions )
{
Describe "Checkout Pester $version" {
It "git checkout version" {
git checkout "tags/$version" 2>&1
}
}
Write-Host 'Reload Pester'
Remove-Module Pester -Force
Import-Module Pester -Force
Describe "Test with Pester $version" {
It 'confirm Pester version' {
(Get-Module Pester).Version | Should be $version
}
Mock New-AzureRmResourceGroupDeployment
It 'this throws Exception calling "GetDynamicParameters"' {
{ New-AzureRmResourceGroupDeployment -ResourceGroupName Test -TemplateFile Test } |
Should throw 'GetDynamicParameters'
}
}
}
Pop-Location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment