【发布时间】:2012-01-18 08:40:09
【问题描述】:
我想绕过一个内部方法调用,因此模拟了它。模拟的方法委托看起来像:
public Microsoft.Moles.Framework.MolesDelegates.OutOutFunc<string,string,string,
byte[]> GetlineStringStringOutStringOut { set; }
现在,在我的测试中,当我尝试访问这个模拟方法时:
GetlineStringStringOutStringOut = (a,b,c) => {return bytearray};
出现一个错误,说参数 2 和 3 必须用 out 关键字声明,但是当我用 out 关键字声明它们时,它根本无法编译。我阅读了其他 SO 问题和答案,似乎无法完成。
是否可以为此提供用户定义的委托?如果有,请举个例子。
编辑:
我试图声明我自己的委托与模拟委托具有相同的签名
static delegate byte[] MyFunc<String, String, String>
(string a, out string b, out string c);
但我不确定在调用模拟委托方法时如何调用它?
【问题讨论】:
标签: c# unit-testing moles