有关样板框架单元测试的问题 [英] Issue with boilerplate framwork unit testing

查看:96
本文介绍了有关样板框架单元测试的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





目前我正在使用锅炉框架,在进行统一测试时我遇到了错误。







消息:System.IO.FileLoadException:无法加载文件或程序集'Microsoft.Extensions.DependencyInjection.Abstractions,Version = 1.1.0.0, Culture = neutral,PublicKeyToken = adb9793829ddae60'或其中一个依赖项。定位的程序集的清单定义与程序集引用不匹配。 (HRESULT异常:0x80131040)





请帮我解决这个问题。



提前致谢。



我的尝试:



实际上我不知道单元测试用例。所以我没有尝试任何东西。

Hi,

Presently i am working with boilerlate framework, while doing unity testing i am getting below error.



Message: System.IO.FileLoadException : Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


please help me out of this.

Thanks in advance.

What I have tried:

Actually i have no idea about unit test cases. so i did not tried anything.

推荐答案

这里的问题与单元测试本身无关。问题是您要么没有单元测试程序集中引用的Microsoft.Extensions.DependencyInjection.Abstractions,要么缺少此程序集的依赖项,或者您的单元测试程序集引用了此程序集的错误版本。这里发生的是,即使您的单元测试没有任何调用此程序集的代码(因此您的单元测试编译的原因),但它依赖于它存在,因为您的实际代码正在寻求使用它。由于这是来自nuget软件包,您只需要在主项目中添加与单元测试程序集完全相同的nuget引用。
The problem you have here has nothing to do with the unit tests, per se. The problem is that you either don't have Microsoft.Extensions.DependencyInjection.Abstractions referenced in your unit test assembly, or a dependency of this assembly is missing, or you have the wrong version of this assembly referenced by your unit test assembly. What is happening here is that, even though your unit test doesn't have any code that calls into this assembly (hence the reason your unit test compiles) but it's relying on it being there because your actual code is looking to use it. As this is from a nuget package, all you need do is add exactly the same nuget reference to your unit test assembly as you have in your main project.


这篇关于有关样板框架单元测试的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆