-
-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot Mock Get-ADGroup #294
Comments
Hmm, it worked for me when I ran that code on my system, but that's PowerShell 5.0 on Windows 8.1. I'll see if I can reproduce it on a system similar to yours when I have time. |
Thanks for the quick response. I can't give you the full error message since it's in a darknet but it seems to try to convert a Dictionary of ADPropertyValueCollection to a KeyValuePair of ADPropertyValueCollection. |
Well, the good news is that I was able to reproduce it, and blindly stumble over a fix. I can even tell you more or less why I didn't see the problem on my Windows 8.1 system: the AD module changed quite a bit in that version of the RSAT tools, and the object returned by the AD cmdlets' GetDynamicParameters() methods no longer implements any interfaces (including IEnumerable, which was part of the problem.) Beyond that, I'm scratching my head. I'm not sure why this exception came up, even with the goofy old AD module code. Seems like it should have worked, but oh well, we can work around it. |
Weird ActiveDirectory module is weird. Fixes pester#294. There are no automated tests to verify this yet; we either need to run the test on a 2008 R2 system with the RSAT feature installed, or write some C# code to reproduce the behavior of the AD module. (The latter would be preferable, but will take some more time.)
The following code fails for me:
It fails with the error:
I am running Pester 3.3.5 on PowerShell 3.0 on Windows 7.
The text was updated successfully, but these errors were encountered: