.net - 将 Moles 与 XUnit 一起使用 - 错误的 dll 版本

标签 .net dll xunit moles pex-and-moles

我正在尝试设置 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/

相关文章:

c# - 使用 ForPartsOf 并模拟异步方法时,NSubstitute 返回 NullReferenceException

asp.net-core - 找不到类型或命名空间名称 'Startup'

.net - 如何在 .Net Core 中引用 Microsoft.Office.Core (office.dll)

.net - 哪一个更好 ? URLReWriter.net 或 URLReWriting.NET

c# - 调试从 C# 调用的 VC++ 6 DLL

asp.net - 通过不同的 Web 应用程序共享相同的 dll 而无需复制

c# - 非 DataTable 数据源的 DataGrid MappingName 是什么?

.net - 可以使用反射覆盖 IEnumerable<T> 中的项目吗?

c# - DllExport 未创建入口点

unit-testing - 使用 xUnit 单元测试异常消息