I've tried using Moq for unit testing on these platforms and seem unable to do so. Has anyone checked whether this is feasible or not? I think trying to move this to a PCL would help with this matter. I can look into it myself if that is fine? I'm new to helping out with an open source project. I love using moq for testing and would like to use it on those platforms.
Sorry it took me so long to get back to you. I was pulled off Xamarin for a while and now I am back on it. I will look into the Castle DynamicProxy. I believe that Android support Reflection.Emit, but Xamarin.iOS definitely does not.
I'll get back to you on how I do with Castle DynamicProxy.
I'll start looking around and playing with it and get back to you.
Hi @JamWils, have you guys made a decision yet?
@machadogj, unfortunately, I just don't have the time to look into this like I was hoping too. If I ever get the chance I will let you know. It would be great to have moq running on the clients of both iOS and Android. I am spending most of my time on iOS Swift these days. Thanks!
I've made a lot of progress toward a working Xamarin.Android port of Castle.Core. I've submitted the first pull request, but there will need to be two or three more after that before the work is fully upstreamed.
If moq on Xamarin.Android matters to you as well, let @jonorossi know.
There shouldn't be a need to use Cecil or something else as DynamicProxy on the .NET Framework allows you to persist the dynamic assembly it creates to disk. I recall some people doing this to run NHibernate with proxy support under medium trust deployments many years ago. Take a look at the unit tests (in the base class) and you'll see just about every unit test also does this to run peverify after generating code. This might be a solution for iOS.
FYI, I have completed my moq4 port to Xamarin.Android. It passes all of the unit tests using my android branch of Castle. Once that android branch is merged into Castle, I will submit a pull request here for the changes to Moq.