And*_*hov 6 .net unit-testing mocking nsubstitute
我有一个界面,定义如下
public interface IFoo
{
object this[string key] { get; }
}
Run Code Online (Sandbox Code Playgroud)
如何使用NSubstitute模拟这个索引器?
Dav*_*pak 11
调用索引器然后使用Returns:
var sub = Substitute.For<IFoo>();
sub["hello"].Returns("world");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1634 次 |
| 最近记录: |