1
鉴于这种接口:如何检查收到的呼叫到索引与NSubstitute
public interface ITest
{
bool this[string parameter] { get; }
}
如何检查索引接电话?
ITest test = Substitute.For<ITest>();
test.Received()["value"]; // Won't compile
鉴于这种接口:如何检查收到的呼叫到索引与NSubstitute
public interface ITest
{
bool this[string parameter] { get; }
}
如何检查索引接电话?
ITest test = Substitute.For<ITest>();
test.Received()["value"]; // Won't compile
编译器错误是:
错误CS0201:只有分配,调用,递增,递减,在等待着,新对象表达式可以作为一个声明(CS0201)
要解决此问题,您可以执行虚拟分配:
ITest test = Substitute.For<ITest>();
var ignored = test.Received()["value"];