嘲讽框架与Android的xamarin使用框架、Android、xamarin

由网友(美是姐的本性)分享简介:我试图找到一种嘲弄框架与Xamarin的Andr​​oid工程。到目前为止,我已经尝试犀牛制品和起订量,但都依赖于System.Web.dll中这似乎并没有被Xamarin支持。我已经包括了System.Web.Services引用到我的项目,没有运气。I am trying to find a mocking fr...

我试图找到一种嘲弄框架与Xamarin的Andr​​oid工程。到目前为止,我已经尝试犀牛制品和起订量,但都依赖于System.Web.dll中这似乎并没有被Xamarin支持。我已经包括了System.Web.Services引用到我的项目,没有运气。

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 supported by Xamarin. I have included the System.Web.Services reference to my project with no luck.

所以我的问题是嘲讽的框架存在与Xamarin项目兼容?这仅仅是简单的嘲讽甚至没有特定的Andr​​oid类之类的活动,但一个可以两者结合起来是最好的。

So my question is what mocking frameworks out there are compatible with Xamarin projects? This is just for simple mocking not even specific android classes like activities, although one that could combine both would be best.

推荐答案

从我所观察到的,实在是没有与Xamarin合作以及嘲讽框架。在iOS的一面,这主要是由于无法使用,因为苹果施加的code世代限制的Reflection.Emit的。我知道你是在Android上,这样的限制并不适用于你。然而,其他限制出现,就像你与RhinoMocks的发现。我最喜欢嘲弄框架是起订量,但在单我不能与Xamarin使用它,因为一些在.NET中实现的配置命名空间,但不是。

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.

阅读全文

相关推荐

最新文章