@@ -105,18 +105,18 @@ function Initialize-TestEnvironment
105105 $ResourceType = ' Mof' ,
106106
107107 [Parameter ()]
108- [ValidateSet (' AllSigned' , ' Bypass' , ' RemoteSigned' , ' Unrestricted' )]
108+ [ValidateSet (' AllSigned' , ' Bypass' , ' RemoteSigned' , ' Unrestricted' )]
109109 [String ]
110110 $ProcessExecutionPolicy ,
111111
112112 [Parameter ()]
113- [ValidateSet (' AllSigned' , ' Bypass' , ' RemoteSigned' , ' Unrestricted' )]
113+ [ValidateSet (' AllSigned' , ' Bypass' , ' RemoteSigned' , ' Unrestricted' )]
114114 [String ]
115115 $MachineExecutionPolicy
116116 )
117117
118118 Write-Verbose - Message " Initializing test environment for $TestType testing of $DscResourceName in module $Module "
119- $ModuleUnderTest = Import-Module $Module - PassThru - ErrorAction Stop
119+ $ModuleUnderTest = ( Import-Module $Module - PassThru - ErrorAction Stop) | Where-Object - FilterScript { $_ .Name -eq $Module } # The Where-Object filter is added to fix issue #97
120120 $moduleRootFilePath = $ModuleUnderTest.ModuleBase
121121 $moduleManifestFilePath = Join-Path - Path $moduleRootFilePath - ChildPath " $ ( $ModuleUnderTest.Name ) .psd1"
122122
@@ -130,7 +130,7 @@ function Initialize-TestEnvironment
130130 }
131131
132132 # Import the module to test
133- if ($TestType -in (' Unit' , ' All' ))
133+ if ($TestType -in (' Unit' , ' All' ))
134134 {
135135 switch ($ResourceType )
136136 {
@@ -206,7 +206,7 @@ function Initialize-TestEnvironment
206206
207207 Set-PSModulePath - Path $newPSModulePath
208208
209- if ($TestType -in (' Integration' , ' All' ))
209+ if ($TestType -in (' Integration' , ' All' ))
210210 {
211211 <#
212212 Making sure setting up the LCM & Machine Path makes sense...
0 commit comments