如何在实现接口的抽象类中模拟受保护的抽象方法 [英] How to mock a protected abstract method in a abstract class which implements aninterface
本文介绍了如何在实现接口的抽象类中模拟受保护的抽象方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如:
考虑实现接口的抽象类
公共抽象类ClassA: IClassA
{
protected abstract string Method();
}
那么如何使用MOQ模拟框架模拟Method()。
请帮助!!!!
解决方案
< blockquote>如何在MOQ讨论论坛(Google Group)上阅读专门讨论抽象类的讨论:[ ^ ]。
然后,考虑向该群组发送消息?当然,我永远不会低估CodeProject很快就会出现正确答案的可能性。
For Example:
Consider a abstract class implementing an interface
public abstract class ClassA : IClassA
{
protected abstract string Method();
}
So how can I mock Method() using MOQ mocking framework.
Please help!!!!
解决方案
How about reading discussions on the MOQ discussion forum (Google Group) that deal specifically with Abstract Classes: [^].
And, then, consider posting a message to that group ? Of course, I would never under-estimate the possibility of someone on CodeProject showing up soon with righteous answer.
这篇关于如何在实现接口的抽象类中模拟受保护的抽象方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文