问题描述
编写单元测试时,我喜欢使用Rhino Mocks.
When I write unit tests I like to use Rhino Mocks.
因此,当我启动第一个Windows Store应用程序时,我自然首先要进行单元测试.当我尝试通过 NuGet RhinoMocks 添加时/a>我收到以下错误
So when I started my first Windows Store application I naturally started with my unit tests first. When I tried to add RhinoMocks via NuGet I recieved the following error
我的起订量也有同样的问题.
I had the same issue with Moq.
是否存在用于.NETCor,Version = v4.5的模拟框架?
Is there a mocking framework for .NETCor,Version=v4.5?
推荐答案
大多数模拟框架都基于Reflection.Emit
.不幸的是,Reflection.Emit
不在WinRT中.这意味着您不能做动态代理. (即运行时模拟).这就留下了在编译时被引用的模拟的预生成.我知道的唯一框架是Moq的实验分支: https://github.com/mbrit/moqrt
Most mocking frameworks are based on Reflection.Emit
. Unfortunately Reflection.Emit
isn't in WinRT. This means you can't do dynamic proxies. (I.e. Run-time mocking). This leaves pre-generation of mocks that get referenced at compile-time. The only framework I know of is an experimental branch of Moq: https://github.com/mbrit/moqrt
这篇关于Windows Store应用程序的单元测试库中选择的模拟框架是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!