【发布时间】:2015-02-13 19:33:04
【问题描述】:
我正在使用 NUnit 2.6.4 测试运行程序。我从加载我的 .csproj 测试的 .nunit 项目文件运行。它一直运行错误版本的依赖项。
背景:
我有使用 NLog 工具的温莎城堡 3.3。我正在使用 NLog 3.2。默认情况下,Windsor 尝试加载 NLog 2.0 并会抛出错误“无法加载 NLog 2.0”。所以我在我的 exe 文件的 app.config 文件中添加了以下内容,以告诉 Windsor 加载 NLog 3.2:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
现在,我来到我的 NUnit。我正在尝试运行我的集成测试(我的单元和功能测试很好,因为我们在这些测试中不使用 IoC),在集成测试中我们使用 Windsor IoC 来确保一切正常。当我运行此集成测试时,我不断收到相同的错误 “找不到 NLog 2.0”。我确保以上内容在我的 test.dll app.config 中,并且还尝试将其添加到 nunit 测试运行器配置文件中。还是不行。如何让 NUnit 确保在测试运行时找到并应用此设置?
【问题讨论】:
标签: c# nunit inversion-of-control castle-windsor nlog