I would like to write unit test for wmi c# code, but couldn't mock managementObjectCollection class
Hi,
I wrote a method to uinistall one of our services running on windows.
I am using ManagementObjectSearcher to filter out the service and invoke "Uninstall" method.
There is code coverage requirement need to be meet. I need to write a UT to get coverage.
I am using Microsoft's fakes framework.
I would like to mock the returned collection from search.Get(). I am able to use reflection to get the constructor, however, couldn't initialized it properly.
{Void .ctor(System.Management.ManagementScope, System.Management.EnumerationOptions, System.Management.IEnumWbemClassObject)}
I don't know how to create the 3rd parameter, and not sure how to populate the collection.
Any help is appreciated, thanks in advance.
Thanks,
Shuwpan