Mono/MonoTouch 上的 Moq(或可能是另一个框架) [英] Moq (or possibly another framework) on Mono / MonoTouch

查看:17
本文介绍了Mono/MonoTouch 上的 Moq(或可能是另一个框架)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始了一些 MonoTouch 开发,我尝试过让 Moq 为我的单元测试工作,但失败了.二进制版本失败,因为它正在寻找 System v2.0,我认为这符合它的 Castle 要求,而从源代码构建它会使编译器崩溃!

I've just started some MonoTouch development and I've tried, and failed, to get Moq working for my unit tests. The binary version fails because it's looking for System v2.0, which I assume is down to its Castle requirements, and building it from source crashes the compiler!

我的问题是有没有人让 Moq 在 Mono 上工作(触摸部分应该无关紧要,我没有将它部署到手机上!),或者对任何其他模拟框架有任何乐趣吗?失败了,我又回到自己的滚动,这有点痛苦.

My question is has anyone gotten Moq to work on Mono (the touch part should be irrelevant, I'm not deploying it to the phone!), or had any joy with any of the other mocking frameworks? Failing that I'm back to rolling my own, which is a bit of a pain.

推荐答案

我现在正在使用 Moq 和 Monodevelop 来测试 Monotouch 应用程序的非 Monotouch 部分,我没有遇到任何问题.对于目标运行时,我的测试项目和被测代码都使用 Mono/.NET 3.5,作为参考,它有:

I'm using Moq right now with Monodevelop to test the non-Monotouch parts of a Monotouch app, and I haven't had any trouble. For the target runtime, my test project and the code under test both use Mono / .NET 3.5, and for references, it's got:

  • 系统,版本=2.0.0
  • nunit.core,版本=2.4.8
  • nunit.framework,版本=2.4.8
  • [测试中的代码]
  • System.Core,版本=3.5.0
  • Moq.dll

System、nunit.core 和 nunit.framework 均由 Monodevelop 提供.

System, nunit.core and nunit.framework are all as provided by Monodevelop.

我使用的最小起订量是 Moq.4.0.10827/NET35/Moq.dll.

The Moq I'm using is Moq.4.0.10827/NET35/Moq.dll.

(我没有运气对 Monotouch 部件进行 NUnit 测试——我假设是因为当测试运行时,没有电话或模拟器,所以 Monotouch 包装的本机代码无法运行.我有分离出应用程序的非 iOS 特定部分并设置两个单独的解决方案,一个用于实际构建,另一个用于单元测试可以进行单元测试的部分.如果您做得更远,请告诉我!)

(I haven't had any luck NUnit-testing the Monotouch parts -- I assume because when the tests are running, there's no phone or simulator, so the native code Monotouch is wrapping can't run. I've had to separate out the non-iOS-specific parts of the app and set up two separate solutions, one for real builds and one for unit testing the parts that can be unit tested. If you've gotten farther than that, let me know!)

这篇关于Mono/MonoTouch 上的 Moq(或可能是另一个框架)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆