开发者

Moles: moled class does not show all methods

开发者 https://www.devze.com 2023-03-19 18:55 出处:网络
I am running tests on a project where I want to mock (or mole) the class DirectoryEntry from System.DirectoryServices so I can override the Rename() and CommitChanges() methods with a moled method of

I am running tests on a project where I want to mock (or mole) the class DirectoryEntry from System.DirectoryServices so I can override the Rename() and CommitChanges() methods with a moled method of that class. I added the Moles assembly for System.DirectoryServices, and it did create a class called MDirectoryEntry, but only a couple of the methods that DirectoryEntry exposes are showing up. Can anyone tell me why, and how I can do this? I am running 开发者_开发问答Moles v.0.94.51023.0 and Visual Studio 2010 (RTM release).

Thank you!


OK, I figured it out. The methods I was trying to access were instance-based, not static. I just found the AllInstances property and - voila! - there are all of the methods I was trying to find!

I hope this can help someone else new to Moles!

0

精彩评论

暂无评论...
验证码 换一张
取 消