什么是VB.NET最好的模拟框架?

时间:2023-01-20 08:34:45

What's the best mocking framework syntax-wise and capability-wise ?

什么是最好的模拟框架语法和功能方面的?

My problem: Most mocking frameworks use lambda expressions now, which are really ugly to write in VB.NET, so is there any framework that has nice syntax without lambdas or has fluent syntax that doesn't need lambdas?

我的问题:现在大多数模拟框架都使用lambda表达式,这在VB.NET中写得非常难看,那么是否有任何框架具有良好的语法而没有lambdas或者具有不需要lambdas的流畅语法?

4 个解决方案

#1


2  

I think capability wise Typemock is the best framework for .Net, instead of working within the runtime it hooks into the CLR and can intercept about any call. This enables you to mock and test anything you want. Some people think it's too powerful. It allows you to test anything while usually the fact that you can't test something is a good warning that there's something wrong with your design. Also it's not free.

我认为功能明智的Typemock是.Net的最佳框架,而不是在它挂接到CLR的运行时内工作,并且可以拦截任何调用。这使您可以模拟和测试任何您想要的东西。有些人认为它太强大了。它允许您测试任何东西,而通常情况下,您无法测试某些东西是一个很好的警告,您的设计有问题。它也不是免费的。

I mainly use Rhino Mocks. It has a really readable syntax, especially the new AAA syntax. Moq is quite new and should be good too, syntax wise. Although I haven't tested it yet.

我主要使用Rhino Mocks。它具有非常易读的语法,尤其是新的AAA语法。 Moq很新,也应该很好,语法明智。虽然我还没有测试过。

#2


0  

rhino mocks.

But you could have trouble with the new lambda-expression syntax (especially when setting expectations on subs) so either use the new syntax or be prepared to work around it.

但是你可能会遇到新的lambda表达式语法(特别是在设置对subs的期望时),所以要么使用新语法,要么准备解决它。

#3


0  

Typemock's VB APIs are very simple to use, and it has all kinds of functionality like faking Shared functions.

Typemock的VB API使用起来非常简单,它具有伪装共享功能等各种功能。

#4


0  

FYI, Isolator has VB.NET specific API so you should be able to use it easily: http://www.typemock.com/vbpage.php

仅供参考,Isolator具有VB.NET特定的API,因此您应该可以轻松使用它:http://www.typemock.com/vbpage.php

However, it is a commercial product.

但是,它是一种商业产品。

#1


2  

I think capability wise Typemock is the best framework for .Net, instead of working within the runtime it hooks into the CLR and can intercept about any call. This enables you to mock and test anything you want. Some people think it's too powerful. It allows you to test anything while usually the fact that you can't test something is a good warning that there's something wrong with your design. Also it's not free.

我认为功能明智的Typemock是.Net的最佳框架,而不是在它挂接到CLR的运行时内工作,并且可以拦截任何调用。这使您可以模拟和测试任何您想要的东西。有些人认为它太强大了。它允许您测试任何东西,而通常情况下,您无法测试某些东西是一个很好的警告,您的设计有问题。它也不是免费的。

I mainly use Rhino Mocks. It has a really readable syntax, especially the new AAA syntax. Moq is quite new and should be good too, syntax wise. Although I haven't tested it yet.

我主要使用Rhino Mocks。它具有非常易读的语法,尤其是新的AAA语法。 Moq很新,也应该很好,语法明智。虽然我还没有测试过。

#2


0  

rhino mocks.

But you could have trouble with the new lambda-expression syntax (especially when setting expectations on subs) so either use the new syntax or be prepared to work around it.

但是你可能会遇到新的lambda表达式语法(特别是在设置对subs的期望时),所以要么使用新语法,要么准备解决它。

#3


0  

Typemock's VB APIs are very simple to use, and it has all kinds of functionality like faking Shared functions.

Typemock的VB API使用起来非常简单,它具有伪装共享功能等各种功能。

#4


0  

FYI, Isolator has VB.NET specific API so you should be able to use it easily: http://www.typemock.com/vbpage.php

仅供参考,Isolator具有VB.NET特定的API,因此您应该可以轻松使用它:http://www.typemock.com/vbpage.php

However, it is a commercial product.

但是,它是一种商业产品。