Add tests for PSWorkflow and PSWorkflowUtility

This commit is contained in:
Sergei Vorobev 2016-06-28 16:05:26 -07:00
parent 85f53d3d0b
commit 56599d3514

View file

@ -1,4 +1,11 @@
Describe 'build.psm1 and powershell.exe' {
$originalPSModulePath = $env:PSModulePath
try
{
# load all modules only from $env:DEVPATH !!!
$env:PSModulePath = "$($env:DEVPATH)\Modules"
# this Describe makes sure we build all the dlls we want and load them from the right place
Describe 'build.psm1 and powershell.exe' {
Context '$env:DEVPATH assemblies loading' {
It 'has $env:DEVPATH set' {
$env:DEVPATH | Should Not Be $null
@ -36,17 +43,11 @@ Describe 'build.psm1 and powershell.exe' {
Join-Path $env:DEVPATH Microsoft.PowerShell.Workflow.ServiceCore.dll)
}
}
}
}
Describe 'Modules for the packge' {
# this Describe makes sure we binplace all the files, like psd1, psm1, ps1xml and load usable modules from them
Describe 'Modules for the packge' {
Context '$env:DEVPATH Modules loading' {
$originalPSModulePath = $env:PSModulePath
try
{
# load all modules only from $env:DEVPATH !!!
$env:PSModulePath = "$($env:DEVPATH)\Modules"
It 'loads Microsoft.PowerShell.LocalAccounts' {
try
{
@ -84,11 +85,36 @@ Describe 'Modules for the packge' {
Remove-Module -ErrorAction SilentlyContinue PsScheduledJob
}
}
It 'loads PSWorkflowUtility' {
try
{
Import-Module PSWorkflowUtility -ErrorAction Stop
Invoke-AsWorkflow -Expression { 'foo' } | Should Be 'foo'
}
finally
{
$env:PSModulePath = $originalPSModulePath
Remove-Module -ErrorAction SilentlyContinue PSWorkflowUtility
}
}
}
It 'loads PSWorkflow' {
try
{
Import-Module PSWorkflow -ErrorAction Stop
New-PSWorkflowExecutionOption | Should Not Be $null
}
finally
{
Remove-Module -ErrorAction SilentlyContinue PSWorkflow
}
}
}
}
}
finally
{
$env:PSModulePath = $originalPSModulePath
}