更新时间:2022-06-20 02:15:40
只要选中你需要假以的任何方法的虚拟
(而不是私人)。然后,你将能够创建一个假的,可以覆盖的方法。
Simply mark any method you need to fake as virtual
(and not private). Then you will be able to create a fake that can override the method.
如果您使用新莫克和LT;类型>
键,你没有一个无参数的构造函数,那么你可以通过参数上面调用的参数,因为它需要一个类型参数对象
If you use new Mock<Type>
and you don't have a parameterless constructor then you can pass the parameters as the arguments of The above call as it takes a type of param Objects