- 什么是predominant .NET 3.0框架的嘲讽? [英] What are the predominant .NET 3.0 mocking frameworks?

查看:150
本文介绍了 - 什么是predominant .NET 3.0框架的嘲讽?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要preface这一点,我爱起订量。我希望我能在.NET 3.0中使用它。但不幸的是,我不能,但我还是喜欢用嘲笑的单元测试。另外,我用犀牛过,但我绝对讨厌它。要多一些描述性的,不过,这是因为界面感觉笨重,直观的 - 它可以处理 - 和文档可以是可怕的或不存在的 - 它不能

To preface this, I love Moq. I wish I could use it in .NET 3.0. Sadly, however, I cannot, but I would still like to use mocks for unit testing purposes. Also, I've used Rhino before, but I absolutely hate it. To be a little more descriptive, though, it's because the interface feels clunky and unintuitive--which can be dealt with--and the documentation is either horrible or non-existent--which can't.

我的问题的实质是,是否还有其他的体面记载的,直观的,流畅的界面框架,在那里为C#2.0 / .NET3.0,还是我坚持撞我的头犀牛在没有最小起订量

The essence of my question is whether there are other decently-documented, intuitive, fluent-interface frameworks out there for C#2.0/.NET3.0, or whether I'm stuck banging my head against Rhino in the absence of Moq.

推荐答案

我个人区分为三类嘲讽框架(在顺序出现):

I personally distinguish three kinds of mocking frameworks(in order of emergence):

  1. 使用字符串方法名ALA NMock2 / NUnit的嘲笑安排,法,断言(AAA)。 pretty的易得去,但不是强类型。如果方法/属性被重新命名则测试会在运行时失败。

  1. Arrange-Act-Assert (AAA) using string method names ala NMock2/NUnit Mocks. Pretty easy to get going but is not strongly typed. If method/property is renamed then the test will fail at runtime.

记录 - 重放ALA犀牛嘲笑。我完全同意你的观点,语法很烂,我讨厌使用它。它完全强类型的,所以当你重构的方法,测试保持最新。

Record-and-replay ala Rhino Mocks. I totally agree with you, the syntax sucks and I hate using it. It is fully strongly typed so when you refactor a method, the test stays up to date.

AAA使用lambda表达式和前pressions。这些措施包括最小起订量,犀牛制品和Typemock隔离器的最新版本的AAA级。到目前为止,最好的语法,但需要.NET 3.5。

AAA using lambdas and expressions. These include MOQ, Latest AAA releases of Rhino Mocks and Typemock Isolator. By far the best syntax, but requires .NET 3.5.

如果.NET 3.5是不可用的,恐怕你要挑最邪恶 - 可怕的犀牛制品语法或后期绑定的方法/属性名称

If .NET 3.5 is unavailable, I am afraid that you have to pick the least evil - horrible Rhino Mocks syntax or late binding to method/property names.

PS。微软有其所谓的痣自己的隔离框架。我没有检查出来自己,但它应该是相当强大的(即嘲讽静态方法,非公开方式等)。检查出来这里

PS. Microsoft has its own isolation framework called Moles. I haven't checked it out myself, but it's supposed to be fairly powerful (i.e. mocking static methods, non-public methods etc). Check it out here.

这篇关于 - 什么是predominant .NET 3.0框架的嘲讽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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