Moq (or possibly another framework) on Mono / MonoTouch
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 开发者_StackOverflowCastle requirements, and building it from source crashes the compiler!
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.
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:
- System, Version=2.0.0
- nunit.core, Version=2.4.8
- nunit.framework, Version=2.4.8
- [code under test]
- System.Core, Version=3.5.0
- Moq.dll
System, nunit.core and nunit.framework are all as provided by Monodevelop.
The Moq I'm using is Moq.4.0.10827/NET35/Moq.dll.
(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!)
精彩评论