Resharper 从不同位置运行 UnitTest [英] Resharper runs UnitTest from different location

查看:35
本文介绍了Resharper 从不同位置运行 UnitTest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 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;

而且它不是项目之一.这是

and it's not project one. It's

C:Users*UserName*AppDataLocalTempTestResults...Out

C:Users*UserName*AppDataLocalTempTestResults...Out

并且没有'SomeAssembly'.如何正确配置 resharper 或像 Visual Studio 一样收集所有程序集?

and there is no 'SomeAssembly'. How do I configure resharper correctly or collect all assemblies like Visual Studio does?

单元测试会发生这种情况,但 NUnit 不会,有什么想法吗?

推荐答案

默认情况下,Resharper 卷影副本程序集用于测试.如果您关闭 shadow-copy,它将在 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屋!

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