From 3dd686027ce9768956f10b5d21ad27ef0dbf1cf0 Mon Sep 17 00:00:00 2001 From: James Truher Date: Tue, 13 Sep 2016 12:19:17 -0700 Subject: [PATCH 1/2] Add get-runspace -name test, remove runspace.close from AfterAll, dispose alone will suffice --- test/powershell/SDK/PSDebugging.Tests.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/powershell/SDK/PSDebugging.Tests.ps1 b/test/powershell/SDK/PSDebugging.Tests.ps1 index 1e016eb8e..af289febf 100644 --- a/test/powershell/SDK/PSDebugging.Tests.ps1 +++ b/test/powershell/SDK/PSDebugging.Tests.ps1 @@ -232,6 +232,9 @@ Describe "Runspace Debugging API tests" -tag CI { $associationId = [guid]::newguid() $runspaceInfo = [PSStandaloneMonitorRunspaceInfo]::new($runspace) } + AfterAll { + $runspace.Dispose() + } It "DebuggerUtils StartMonitoringRunspace requires non-null debugger" { try { From eaef22686ffe4aa5310a6ec51af3e5122981dbca Mon Sep 17 00:00:00 2001 From: James Truher Date: Tue, 13 Sep 2016 12:21:01 -0700 Subject: [PATCH 2/2] Add a test for get-runspace -name and remove the runspace close from AfterAll block --- .../Microsoft.PowerShell.Utility/RunspaceCmdlets.Tests.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/RunspaceCmdlets.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/RunspaceCmdlets.Tests.ps1 index 815ab62a3..5f5a0feff 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/RunspaceCmdlets.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/RunspaceCmdlets.Tests.ps1 @@ -12,6 +12,10 @@ Describe "Get-Runspace cmdlet tests" -Tag "CI" { $runspace = get-runspace -instanceid $CurrentRunspace.InstanceId $runspace.InstanceId | Should be $ExpectedInstanceId } + It "Get-Runspace with runspace name should return the correct runspace" { + $runspace = get-runspace -name $currentRunspace.Name + $runspace.InstanceId | Should be $ExpectedInstanceId + } It "Get-Runspace with runspace Id should return the correct runspace" { $runspace = get-runspace -id $CurrentRunspace.Id $runspace.InstanceId | Should be $ExpectedInstanceId @@ -24,7 +28,6 @@ Describe "Get-Runspace cmdlet tests" -Tag "CI" { $r2 = [runspacefactory]::CreateRunspace() } AfterAll { - $r1.Close() $r1.Dispose() $r2.Dispose() }