在UWP应用嘲讽框架 [英] Mocking framework in UWP Apps
问题描述
我试着去找到一个很好的嘲弄框架,以单元测试我UWP应用程序,BT似乎所有好的嘲讽的基础设施(MOQ,RhinoMocks的等)的理解依靠这是不是在UWP支持动态代理。
Im trying to find a good mocking framework to Unittest my UWP App, bt it seems that all good Mocking infrastructures (MOQ, RhinoMocks etc) understandably rely on Dynamic Proxies which is not supported in UWP.
看起来MOQ知道这个限制:
https://github.com /起订量/ moq4 /问题/ 195
It looks like MOQ knows of this limitation: https://github.com/Moq/moq4/issues/195
And Microsoft is less than helpful in this situation: https://social.msdn.microsoft.com/Forums/en-US/652b9d16-c4ab-401c-9239-0af01108e460/uwp-is-there-any-indication-that-windows-10-uwp-universal-applications-will-support-code-emitting?forum=wpdevelop
有没有单元测试UWP应用任何嘲讽的基础设施?或者有什么想法,如果动态代理支持,随时进来不久的将来UWP?
Is there any Mocking infrastructure for unittesting UWP apps? Or any ideas if Dynamic Proxy support is coming anytime in the near future for UWP?
谢谢!
推荐答案
我们(微软BigPark工作室)刚刚发布嘲弄的框架,与UWP兼容,.NetCore和.NET Framework(的NuGet Etg.SimpleStubs
)。该框架使用罗斯林生成存根。
We (Microsoft BigPark Studio) have just released a mocking framework that is compatible with UWP, .NetCore and .Net Framework (Nuget Etg.SimpleStubs
). The framework uses Roslyn to generate stubs.
要解决在UWP在 Reflection.Emit的
限制,框架生成存根在编译时。存根产生和在一个步骤中(在生成)编译。如果你曾经使用VS假货,经验是非常相似的。
To get around the Reflection.Emit
restriction in UWP, the framework generates the stubs at compile time. The stubs are generated and compiled in one step (during the build). If you've ever used VS Fakes, the experience is very similar.
SimpleStubs是开源的,并可以作为的NuGet:
SimpleStubs is opensource and available as a NuGet:
文件:的 https://github.com/Microsoft/SimpleStubs
的NuGet:的 https://www.nuget.org/packages/Etg.SimpleStubs/
这篇关于在UWP应用嘲讽框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!