110,533
社区成员
发帖
与我相关
我的任务
分享
SqlDataReader reader;
//如果我在待测的方法中有
var = reader[0];
//现在我在测试中如何模拟这个运算符,比如Read方法我可以这样
[TestMethod()]
public void OneMehodTest() {
using (ShimsContext.Create()){
ShimSqlDataReader.AllInstances.Read = () => {
return 1;
};
ShimSqlDataReader.AllInstances.GetInt32Int32 = (a, b) =>
{
return 0;
};
}
}