鉴于此界面:
public interface ITest
{
bool this[string parameter] { get; }
}
如何查看已接收的索引器来电?
ITest test = Substitute.For<ITest>();
test.Received()["value"]; // Won't compile
答案 0 :(得分:0)
编译错误是:
错误CS0201:只能将赋值,调用,递增,递减,等待和新对象表达式用作语句(CS0201)
要解决此问题,您可以进行虚拟分配:
ITest test = Substitute.For<ITest>();
var ignored = test.Received()["value"];