Mocking structure for use with xamarin android

I am trying to find a mocking structure that works with Xamarin Android. So far I have tried Rhino Mocks and Moq, but both of them depend on System.Web.dll, which does not seem to be supported by Xamarin. I have included the System.Web.Services link to my project with no luck.

So my question is, what ridiculous frameworks are there compatible with Xamarin projects? This is just for simple bullying, even for certain classes of androids, such as actions, although it is best to combine both.

+1
source share
2 answers

From what I have observed, there really are no funny frameworks that work well with Xamarin. On the iOS side, this is mainly due to the inability to use Reflection.Emit due to the limited code generation imposed by Apple. I understand that you are on Android, so the restriction does not apply to you. However, other restrictions arise, as you have already seen in RhinoMocks. My favorite fake structure is Moq, but I can't use it with Xamarin because of some namespaces that are implemented in .NET but not in Mono.

So, your best bet is just hand layouts. I know that this is not the answer you want to hear, but it seems to be a consensus.

+1
source

You can use True Fakes ( http://truefakes.net ) fake structure to solve your problems. It does not use Reflection.Emit at run time, but it automatically generates mocks at compile time and adds it to the assembly where unit tests are performed. This allows you to use True Fakes to write unit tests with a completely isolated proven system for Xamarin.Android and Xamarin.iOS and run them directly on the device!

You can add it to your project through NuGet ( https://www.nuget.org/packages/TrueFakes/ ). For more information about True Fakes, see http://truefakes.net .

PS. Im a developer of fake True Fakes frames.

+3
source

All Articles