【发布时间】:2018-12-13 18:10:55
【问题描述】:
有这个接口:
public interface ICandyManager
{
IReadOnlyList<string> GetCandies(in ReadOnlySpan<byte> bytes);
}
当我尝试使用 nsubstitute 模拟接口时:
ICandyManager nb = Substitute.For<ICandyManager>();
我收到以下错误:
Message: System.TypeLoadException : Signature of the body and declaration in a method implementation do not match. Type: 'Castle.Proxies.ICandyManager'. Assembly: 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
对此有什么解决方法?显然我可以初始化真实类型,但我希望能够模拟它。
【问题讨论】: