Add tests for PSWorkflow and PSWorkflowUtility
This commit is contained in:
parent
85f53d3d0b
commit
56599d3514
1 changed files with 73 additions and 47 deletions
|
@ -1,3 +1,10 @@
|
|||
$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' {
|
||||
|
@ -38,15 +45,9 @@ Describe 'build.psm1 and powershell.exe' {
|
|||
}
|
||||
}
|
||||
|
||||
# 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
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue