在VB.Net上使用最小起订量的经验 [英] Experiences using moq with VB.Net

查看:63
本文介绍了在VB.Net上使用最小起订量的经验的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很喜欢moq模拟框架.我已经在几个项目上使用过它.不幸的是,我的一位客户要求我们使用VB.Net.不是我的偏爱,但是,.Net是.Net,对吧?

I really like the moq mocking framework. I've used it on several projects. Unfortunately, one of my customers is demanding we use VB.Net. Not my preference, but hey, .Net is .Net, right?

我听说起订量在VB上存在一些问题.这是真的?是这样,是什么麻烦呢?鉴于.Net的语言不可知性,我希望它能正常工作.

I've heard that moq has some trouble with VB. Is this true? Is so, what sorts of trouble? I would expect it to work fine given the language agnostic nature of .Net.

我应该考虑将其他模拟框架与VB一起使用吗?

Should I look into using some other mocking framework for use with VB?

推荐答案

VB.net关于模拟框架的主要问题是,与C#相反,VB没有匿名方法,只有Lambda表达式(无法声明一个匿名Action委托).

The main problem of VB.net with regards to mocking frameworks is that, contrary to C#, VB does not have anonymous methods, only Lambda expressions (no way to declare an anonymous Action delegate).

这严重限制了可能性. 具有参数的属性也存在一个已知问题.

This severely limits the possibilities. There is also a known issue with properties with parameters.

此外,lambdas的语言语法无法带来与C#一样清晰的可读性(请不要大笑,我是VB用户,每天都想念一些C#功能),这部分是因为最小起订量的吸引力.

Also, the syntax of the language for lambdas does not lead to something as clean as C#, readability-wise (no flames please, I'm a VB user and I miss some C# features every day), and that's partly the attraction for Moq.

我所知道的唯一对VB有所帮助的测试框架是 TypeMock .他们试图设计一些与VB语法融合的东西.

The only testing framework I know of that did something with regards to VB is TypeMock. They tried to design something that blends with the VB syntax.

这篇关于在VB.Net上使用最小起订量的经验的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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