From 23c9b934eff88beee5710a476b83ec0b0f6258f0 Mon Sep 17 00:00:00 2001 From: Ilya Date: Sat, 15 Jul 2017 00:02:58 +0400 Subject: [PATCH] Fix C# tests for ValidateSetValuesGenerator (#4253) --- .../Classes/Scripting.Classes.Attributes.Tests.ps1 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/powershell/Language/Classes/Scripting.Classes.Attributes.Tests.ps1 b/test/powershell/Language/Classes/Scripting.Classes.Attributes.Tests.ps1 index d378a1abf..2b8a9e756 100644 --- a/test/powershell/Language/Classes/Scripting.Classes.Attributes.Tests.ps1 +++ b/test/powershell/Language/Classes/Scripting.Classes.Attributes.Tests.ps1 @@ -290,9 +290,12 @@ Describe 'ValidateSet support a dynamically generated set' -Tag "CI" { } '@ - $testAssemply = "$TestDrive\tst-$(New-Guid).dll" - Add-Type -TypeDefinition $a -OutputAssembly $testAssemply - Import-Module $testAssemply + $cls = Add-Type -TypeDefinition $a -PassThru | select -First 1 + $testModule = Import-Module $cls.Assembly -PassThru + } + + AfterAll { + Remove-Module -ModuleInfo $testModule } It 'Throw if IValidateSetValuesGenerator is not implemented' { @@ -433,7 +436,7 @@ Describe 'ValidateSet support a dynamically generated set' -Tag "CI" { [GenValuesWithExpiration]::temp = $true return [string[]]("Test1","TestString2","Test2") } - + } }