使用三层架构+EF添加单元测试

在运行测试的时候抛异常了:

“System.InvalidOperationException”类型的异常在 mscorlib.dll 中发生,但未在用户代码中进行处理

The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

使用三层架构+EF添加单元测试_第1张图片

经过一些列的百度最后,看到这篇博客https://blog.csdn.net/haipurui0001/article/details/79355160的一句话,就尝试了一下,居然成功了

奈何本人梅闻花,只能把这4个都引用进去(这四个dll都可以在当前项目的packages中可以找到)

使用三层架构+EF添加单元测试_第2张图片

 

 将这些dll引入后,再次测试成功了,做一下笔记

使用三层架构+EF添加单元测试_第3张图片

 

 

 

 

你可能感兴趣的:(使用三层架构+EF添加单元测试)