简体   繁体   English

It.IsAny<t> 用于类型的单元测试:- params Action<iresultsreader> []</iresultsreader></t>

[英]It.IsAny<T> for unit testing for type:- params Action<IResultsReader>[]

I am writing unit test and i have this function:-我正在编写单元测试,我有这个 function:-

void QueryMultipleFromStoredProcedure(string sproc, object parameters, params Action<IResultsReader>[] readerFuncs);

I am not sure what is the type for params Action< IResultsReader >[].我不确定 params Action< IResultsReader >[] 的类型是什么。 I wrote this in my unit test:-我在单元测试中写了这个:-

mockDataInfrastructure.Setup(x => x.QueryMultipleFromStoredProcedure(It.IsAny<string>(), It.IsAny<object>(), It.IsAny<T>));

what would be the last one return type?最后一种返回类型是什么?

You can simply reuse the same interface as in the signature of your method:您可以简单地重用与方法签名中相同的接口:

mock.Setup(x => x.QueryMultipleFromStoredProcedure(It.IsAny<string>(), It.IsAny<object>(), It.IsAny<Action<IResultsReader>[]>()));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM