我正在尝试设置 Moles 以在我们的单元测试中使用。我们使用的是xunit,所以我是using
痣附带的 Xunit 扩展 (Microsoft.Moles.Framework.Xunit
)。但是,当我们运行 Xunit 1.7 时,Moles 提示我没有运行版本 1.6.1.1521(带有 FileLoadException
)。
Moles Manual (第 28 页)确实说:
xUnit.net Version:
1.5.0.1479 (for other xUnit.net versions, recompile the attribute from sources)
这就是我卡住的地方——这个 xunit 扩展的源代码在某处可用吗?还是我必须使用 Moles 需要的特定版本的 xunit?
最佳答案
您不能在 moles.runner.exe.config
中定义程序集绑定(bind)重定向吗? ?
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity
name="xunit.dll"
publicKeyToken="8d05b1bb7a6fdb6c" />
<bindingRedirect oldVersion="1.5.0.1479" newVersion="1.6.1.1521" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
关于.net - 将 Moles 与 XUnit 一起使用 - 错误的 dll 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5971581/