更新时间:2021-07-21 07:53:28
存根方法使用返回,以表明我应该将其返回后,例如:
After stubbing the method use "Return" to indicate what should it return, for example:
_mockRepository
.Stub(x => x.GetModuleKindPropertyNames(Arg<string>.Is.Anything))
.Return(Enumerable.Empty<string>().AsQueryable());
另外,更改这一行:
Also, change this line:
_controller.GetModulePropertyName(Arg<string>.Is.Anything);
这样:
_controller.GetModulePropertyName(string.Empty);
作为例外解释 - 精氨酸仅在模拟的定义中使用
As the exception explains - Arg is only to be used in mock definitions.