Resharper从其他位置运行UnitTest [英] Resharper runs UnitTest from different location
问题描述
当我使用Visual Studio运行单元测试时,它运行良好,因为它从所有程序集所在的项目目录中运行。 但是当我使用resharper运行它时,在
When I run unit tests with Visual Studio it works fine, because it runs from project directory where all assemblies are. But when I run it with resharper it goes with error on
var services = Assembly.Load("SomeAssembly");
有错误
无法加载文件或程序集'SomeAssembly'或其
依赖项之一。系统找不到指定的文件。
Could not load file or assembly 'SomeAssembly' or one of its dependencies. The system cannot find the file specified..
所以我已经尝试过
var path = Assembly.GetExecutingAssembly().Location;
,它不是项目之一。
C:\Users\ * UserName * \AppData\Local\Temp\TestResults\ ... \Out\
C:\Users\*UserName*\AppData\Local\Temp\TestResults\...\Out\
,没有'SomeAssembly'。
这是如何在单元测试中发生的,但在NUnit中却没有,这是什么想法?
推荐答案
Resharper影子复制程序集以在默认情况下进行测试。如果关闭卷影复制,它将在bin文件夹中运行,并且测试应通过。 此处是有关将其关闭的说明。
Resharper shadow copies assemblies for testing by default. If you turn off shadow-copy, it will run in the bin folder and the test should pass. Here are some instructions on turning it off.
这篇关于Resharper从其他位置运行UnitTest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!