Mocking framework for use with xamarin android

后端 未结 3 1097
[愿得一人]
[愿得一人] 2020-12-20 04:44

I am trying to find a mocking framework that works with Xamarin Android. So far I have tried Rhino Mocks and Moq but both depend on System.Web.dll which does not seem to be

3条回答
  •  半阙折子戏
    2020-12-20 05:06

    From what I've observed, there really is no mocking frameworks that work well with Xamarin. On the iOS side, this is mainly due to the inability to use Reflection.Emit because of the code generation restriction imposed by Apple. I realize you're on Android, so that restriction does not apply to you. However, other restrictions arise, like you've found with RhinoMocks. My favorite mocking framework is Moq, but I can't use it with Xamarin because of some of the configuration namespaces that are implemented in .NET, but not in Mono.

    So, your best bet is just manual mocks. I know that's not the answer you want to hear, but it seems to be the consensus.

提交回复
热议问题