【发布时间】:2017-11-03 12:04:03
【问题描述】:
我正在使用一个包含很多类的 dll。我想为这些类实现动态接口,然后我可以通过模拟对它们进行单元测试。
有办法吗?
例子:
dll有一个类Communicator
public class Comunicator
{
public void Execute()
{
//execute something
}
}
有没有办法让这个类动态地实现下面的接口?
public interface IComunicator
{
void Execute();
}
这样我想要下面的属性
public IComunicator Comunicator{ get; set; }
能够理解这个作业
Comunicator = new Comunicator();
【问题讨论】:
-
这个问题不清楚。
-
当您尝试从 dll 实现接口时发生了什么?你有吗?
-
对不起,我现在对我的问题做了更好的解释