Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个定义如下的接口
public interface IFoo { object this[string key] { get; } }
如何使用 NSubstitute 模拟这个索引器?
调用索引器然后使用Returns:
Returns
var sub = Substitute.For<IFoo>(); sub["hello"].Returns("world");