我有这种类型的属性:是否有可能来嘲笑一种使用Rhino.Mocks
[RequiresAuthentication]
public class MobileRunReportHandler : IMobileRunReportHandler
{
public void Post(MobileRunReport report)
{
...
}
}
我嘲笑它像这样:
var handler = MockRepository.GenerateStub<IMobileRunReportHandler>();
handler.Stub(x => x.Post(mobileRunReport));
的问题是,所产生的模拟不属于RequiresAuthentication
属性。我如何解决它?
谢谢。
编辑
我想嘲笑的类型与RequiresAuthentication
属性归因,因为我是测试代码使用这个属性。我想知道如何更改我的嘲笑代码,以指示嘲笑框架相应地生成模拟。
的可能重复[嘲讽属性 - C#](http://stackoverflow.com/questions/319002/mocking-attributes-c) – msarchet
我会很高兴如果您向我展示该帖子的确切位置包含我的问题答案,请与您同意。谢谢。 – mark
在什么情况下,您需要将该类归入“RequiresAuthentication”?你能详细说明一点吗? – Jeroen