Reputation: 83
Has anyone been using a .NET mocking framework that they have found compatible with Monotouch? I am curious about compatibility with NMock, NSubstitute, Moq and other frameworks before I attempt to use one.
Xamarin just beefed up its unit testing support, but no mention of a mock framework. FYI, I am hoping to do a lot of my development on VS 2010 for the non-UI bits and move to the iOS platform when the UI comes into play.
Thanks for the help.
Upvotes: 7
Views: 1459
Reputation: 26495
I would recommend just using manual mocking:
interface IClass {
void Method(int x);
}
MockClass : IClass {
public void Method(int x) {
MethodParameter = x;
}
//Assert against this guy
public int MethodParameter { get; private set; }
}
StubClass : IClass {
public void Method(int x) {
//Do nothing
}
}
If I had to guess Rhino Mocks, Moq, etc. have heavy usage of Reflection.Emit (how else could you do the craziness they can do?), which will not run with the AOT compiler on MonoTouch.
Upvotes: 4