fsprojects / Foq

A unit testing framework for F#
http://www.slideshare.net/ptrelford/foq-17062247
Apache License 2.0
79 stars 31 forks source link

Support for Xamarin Android #5

Open elevine opened 8 years ago

elevine commented 8 years ago

Currently, there are few options for mocking/faking libraries that can run on Xamarin Android. Most libraries like moq and fakeiteasy rely on Castle.Core, which does not have a build for Xamarin Android. Since Foq does not have this dependency, it seems like it has a good chance to work for that platform

I hacked up something quick, and was able to get Foq and the C# tests to run on Xamarin. The issues I encountered were that LinqTests.TestSetupFuncWithReturnsLambda failed with an exception related to bad IL code (seems to be a Mono problem) and Microsoft.FSharp.Control does not seem to be available for Xamarin. I encountered a few more failures running the F# tests on Mono too.

This brings me to my questions:

  1. Is Foq a viable option for Xamarin Android?
    • It seems that there are issues/limitations with F# on Mono. Its not clear to me if any of them would be a showstopper.
      1. If so, would a pull request be accepted that added a Xamarin Android build?
    • Foq on Codeplex has some more recent commits, so its not clear to me where the project lives.
ptrelford commented 7 years ago

Hi elevine and apologies for the excessively delayed response, I did not have any notifications turned on for this project, and no one pinged me. Both Castle.Core and Foq use code generation via Reflection.Emit, I think this is likely to be problematic on Android which I believe doesn't permit code generation. P.S. sorry for the confusion on project location, the project started on CodePlex but has been migrated to GH. If an issue is raised on CodePlex I fix it there and copy the change over to GH, and vice versa. The Nuget packages are generated from the CodePlex version so the last update is likely to be on CodePlex.

elevine commented 7 years ago

Hi @ptrelford - I've sinced moved onto another job and I'm not currently working on any .Net or Xamarin stuff. However, we did mange to get Castle.Core and Moq working on Android while I was still there. Here are the forks if you are interested:

If I am remembering correctly, Reflection.Emit is supported for Xamarin Android (but not iOS as far as I know).

Mocking libraries for Xamarin Android are an unfulfilled niche, and Foq seemed like it wasn't far from being able to meet that need. It might be worth considering for your roadmap.

jonathanfishbein1 commented 7 years ago

Hello, Do you have plans to implement .net standard?

Thank you Jonathan