.net – 在XUnit中使用Moles – 错误的dll版本

我正在尝试设置Moles以用于我们的单元测试.我们正在使用xunit,所以我使用的是带有moles的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中定义程序集绑定重定向吗?

<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>

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...