[英]Entity Framework Core FromSqlRaw mock test cases
I am creating a integration test for api method which have some query like below我正在为 api 方法创建一个集成测试,该方法有如下一些查询
public async static Task<IEnumerable<T>> ForSysAll<T>(this DbSet<T> dbSet,int id) where T : class
{
return await dbSet.FromSqlRaw($"SELECT * FROM dbo.TableName Where Id = {0}",id).ToListAsync();
}
This is working fine while I run with API code.当我使用 API 代码运行时,这工作正常。 But when I am trying to debug/run with test case.但是当我尝试使用测试用例进行调试/运行时。 It throws an exception which is:- System.NotImplementedException: Unhandled method: FromSqlOnQueryable
它抛出一个异常:- System.NotImplementedException: Unhandled method: FromSqlOnQueryable
Can anyone having any idea for this?任何人都可以对此有任何想法吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.