是否可以使用Rhino Mocks来模拟WindowsImpersonationContext?Rhino Mocks嘲笑WindowsImpersonationContext
我得到:
system.missingMethodException而:无法找到匹配的参数的构造函数 ----> system.missingMethodException而:在类的构造 'WindowsImpersonationContextProxy04bee852de914d5b8a47d6776edc4cb3'
var windowsImpersonationContext = mockRepository.Stub<WindowsImpersonationContext>();
mockImpersonation.Stub(x => x.ImpersonateUser("username", "domain", "password")).Return(windowsImpersonationContext);
这里是我的代码我需要模拟
public interface IImpersonation
{
WindowsImpersonationContext ImpersonateUser(string sUsername, string sDomain, string sPassword);
}
PFF,该代码只有3行,并且您的变量名拼写错误。可能犀牛是不高兴的。好的,我嘲笑你的代码。 – rook 2010-07-26 16:09:36
非常有趣....! – Coppermill 2010-07-27 10:46:26