像框架.NET甚至可以模拟静态类,私有方法等任何JMockit [英] Any JMockit like framework for .net which can even mock static classes, private methods, etc

查看:228
本文介绍了像框架.NET甚至可以模拟静态类,私有方法等任何JMockit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用JMockit - HTTP://$c$c.google.com/p / jmockit / 以嘲弄了的东西,在做单元测试在Java中。不像其他的框架,它是在JVM字节code顶不上仪器库。它可以模拟静态类,方法甚至私人领域和方法了。

I used JMockit - http://code.google.com/p/jmockit/ for mocking out stuffs while doing unit testing in java. Unlike other frameworks it is on top of JVM byte code not on instrumentation libraries. It can mock static classes, methods even private fields and methods too.

需要相似类型的框架.NET的,有没有?

Require similar kind of framework for .net, is there any ?

推荐答案

有几个人:

TypeMock的隔离.NET

TypeMock's Isolator .NET

模拟和伪造的unmockable(包括静态,非公开的,密封)

Mock and fake the unmockable (including statics, non-public, sealed)

Telerik的 JustMock

您可以假冒的对象,如非虚方法,密封类和   静态方法和类,非公共成员和类型,特点   往往不能提供免费的嘲弄框架。

You can fake objects like non-virtual methods, sealed classes and static methods and classes, non-public members and types, features often not available in free mocking frameworks.

不过,他们两个是商业产品。

But both of them are commercial products.

我还没有使用它,但你也可以对 EX与鼹鼠这是一个微软的研究项目,以帮助单元测试:

I haven't used it but you also can have a look on Pex and Mole it's a Microsoft research project to help unit testing:

痣允许更换任何.NET方法与委托。痣   通过弯路的方式,并提供隔离支持单元测试   存根。的摩尔框架设置有Pex的,或可安装   本身作为Microsoft Visual Studio的插件。

Moles allows to replace any .NET method with a delegate. Moles supports unit testing by providing isolation by way of detours and stubs. The Moles framework is provided with Pex, or can be installed by itself as a Microsoft Visual Studio add-in.

我不知道任何其他的免费模拟一切框架.NET。

I don't know any another free "mock everything" framework for .NET.

这篇关于像框架.NET甚至可以模拟静态类,私有方法等任何JMockit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆