【问题标题】:VS2010 Professional using Moles...receive error "System.InvalidOperationException : Could not start Moles host."VS2010 Professional 使用 Moles ...收到错误“System.InvalidOperationException:无法启动 Moles 主机。”
【发布时间】:2014-03-27 17:37:13
【问题描述】:

我的情况类似于 user2768132 的问题 (VS2010 pro not able to start Moles host),但是,我有一些不同之处。我也尝试了 SouthShoreAK 的建议,但它并没有解决我的问题。请原谅类似的帖子。

我在工作中和 Moles 都是这个项目的新手,所以我可能会遗漏一些简单/明显的东西。我们还在使用 Moles 框架编写单元测试用例,但无法调试或运行涉及 Moling 一个公共静态类的单元测试。

系统 - Win-7 Professional SP1
.NET - .NET v4.0.30319 SP1 版本
VS - VS2010 专业版 v10.0.40219.1
痣 - v0.94.51023.0

解决方案构建成功。 6 个简单的单元测试(即不是 Moling 静态类)通过,但需要 Moles 处理静态类的一个单元测试中止。

中止测试的错误:

Error   3/26/2014 2:26:06 PM    System.InvalidOperationException: Could not start Moles host. Please review the Test Run Errors for more information.
   at Microsoft.Moles.VsHost.Agent.HostTestAdapterDriver.EnsureHostAdapter()
   at Microsoft.Moles.VsHost.Agent.HostTestAdapterDriver.Microsoft.VisualStudio.TestTools.Execution.IBaseAdapter.Run(ITestElement testElement, ITestContext testContext)
   at Microsoft.Moles.VsHost.Agent.MolesAgentAdapter.Run(ITestElement testElement, ITestContext testContext)

我的 fuslogvw 是空的,并且在程序集加载过程中没有发现任何错误。 我发现与 user2768132 相同的博客提到从 VS2010 IDE 文件夹下的 privateassemblies 文件夹中删除 .exe.config 文件。我这样做了,它也没有解决我的问题。

我相信测试是 32 位的。话虽如此,我尝试了 SouthShoreAK 将测试设置编辑为 64 位并将位数行添加到 AssemblyInfo.cs 文件底部的建议。不幸的是,这也没有解决我的问题。最初通过的简单测试会失败,需要 Moles 的单元测试会出错,说 Moles 无法加载,因为找不到键“Moles”。我撤消了这些更改,我又回到了起点。

有人有什么想法/建议吗?

谢谢, 史蒂夫

【问题讨论】:

    标签: c# visual-studio-2010 unit-testing moles


    【解决方案1】:

    答案是确保在测试项目的“属性”的“构建”选项卡中将“平台目标”参数设置为 x86。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-28
      • 2011-08-22
      • 2011-08-23
      • 2011-06-01
      相关资源
      最近更新 更多