Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi folks,
i am trying to write nunit for the methods which uses WMI.
and i am not succeded in that. and now im doubting whether nunit can be done for methods which uses WMI.
if it is possible kindly give me some sample code.
Posted

1 solution

You need not really write NUnint for WMI.
These functions can be mocked[^] and you can assume is that either WMI will give you correct results or they will give you incorrect results.

You can then write test cases for these two result types.

Instead of Moles you can use other third parties that are available. Choose what you are comfortable with.
 
Share this answer
 
Comments
valiant123 2-May-13 5:56am    
thanks for the suggestion.
and in my scenerio, i need to maintain a session through out in order to retrive the values through WMI and for maintaining session i need to give the login credentials.
other 3rd parties in the sense? please mention what are they.
Abhinav S 2-May-13 6:05am    
For sessions, login credentials etc you never use the real code. You only use objects that are mocked and that act as if they were the real session etc.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900