绑定重定向不适用于ReSharper的NUnit测试运行器中的多个测试项目

时间:2014-02-25 15:47:48

标签: .net resharper

我使用NSubstitute v1.7.1.0和AutoFixture.AutoNSubstitute v3.16.5。显然,AutoFixture是针对旧版本的NSubsitute编译的。

在测试中,我得到了例外:

System.IO.FileNotFoundException : Could not load file or assembly 'NSubstitute,
Version=1.4.3.0, Culture=neutral, PublicKeyToken=92dd2e9066daa5ca' or one of its
dependencies. The system cannot find the file specified.

所以我添加了一个绑定重定向到我的测试项目(如建议here):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="NSubstitute" publicKeyToken="92dd2e9066daa5ca" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.7.1.0" newVersion="1.7.1.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

仍然有例外。我做错了什么?


编辑: 当我使用AutoFixture创建类的实例而不是接口(myFixture.Create<MyClass>()而不是myFixture.Create<MyInterface>())时,问题就消失了。

1 个答案:

答案 0 :(得分:2)

问题是由ReSharper的测试运行员引起的。如this answer所述,在增加ReSharper的新“并行运行到X组件”选项后,它就消失了。

相关问题