简体   繁体   English

使用Visual Studio 2010 Ultimate进行模拟

[英]Mocks with Visual Studio 2010 Ultimate

Should I keep using Mocks with Visual Studio 2010 Ultimate?, I mean, all the information I'm gathering about mocks is kinda old, from like 2 or 3 years ago, more specific, I'm gathering info about the next frameworks Rhino Mocks and Moq . 我应该继续使用Mocks和Visual Studio 2010 Ultimate吗?我的意思是,我收集的关于模拟的所有信息都有点陈旧,就像2或3年前一样,更具体,我正在收集有关下一个框架Rhino Mocks的信息Moq

But then, I don't know if I'm looking for something old or deprecated or that it's not used nowdays... I'm making a new project and I want to used the last frameworks to implement the TDD in the best way possible, and since we recently acquired the Ultimate version of VS2010, which has a lot info and utilities about testing, I wanna do the things the way they should be done. 但是,我不知道我是在寻找旧的还是已经弃用的东西,或者现在没有使用它......我正在制作一个新项目,我想用最后的框架以最好的方式实现TDD可能,因为我们最近购买了VS2010的终极版本,它有很多关于测试的信息和实用程序,我想按照他们应该做的方式做事情。

Oh, I almost forgot, I have to use VB, and most of the info about these frameworks are in C#, I don't know if that could be relevant... 哦,我差点忘了,我必须使用VB,关于这些框架的大部分信息都在C#中,我不知道这是否相关......

Thanks in advice! 谢谢你的建议!

EDIT 编辑

Moq along with AutoFixture did the job Moq和AutoFixture完成了这项工作

Moq is my mocking framework of choice, but that's just a personal preference. Moq是我嘲弄的选择框架,但这只是个人偏好。 And it doesn't really matter that the samples are typically written in C#, provided you can read C#, since you can use all the same methods, but with a slightly different syntax. 如果您可以阅读C#,那么样本通常用C#编写并不重要,因为您可以使用所有相同的方法,但语法略有不同。

You really can't go wrong with either Moq or RhinoMocks. Moq或RhinoMocks你真的不会出错。

Rhino and Moq will both give you what you need. Rhino和Moq都会为您提供所需的产品。 If money is not an issue I would also suggest Typemock . 如果钱不是问题,我也建议使用Typemock

Rhino, Moq and (my favorite) FakeItEasy are nice mocking/faking frameworks. Rhino,Moq和(我最喜欢的)FakeItEasy是很好的模拟/伪造框架。

It shouldn't matter which language you're testing in (VB or C#), but to be safe check the docs for all these frameworks. 您正在测试哪种语言(VB或C#)无关紧要,但要安全检查所有这些框架的文档。 I know FakeItEasy supports VB.NET. 我知道FakeItEasy支持VB.NET。 You should also look into Roy Osherove's book about unit testing in .NET, highly recommended. 您还应该深入了解Roy Osherove关于.NET中单元测试的书。

I tend to look at the activity on the web site where the source is hosted and try to work out whether a project is being actively maintained. 我倾向于查看托管源的网站上的活动,并尝试确定是否正在积极维护项目。 If there is good developer velocity then that's usually a sign of a well-supported project. 如果有良好的开发人员速度,那通常是一个良好支持的项目的标志。 All of the mocking frameworks mentioned here are fairly good bets, my personal favourite is Moq and I like to use it with MSpec (Machine.Specifications), but of course each developer or team needs to make those choices for themselves. 这里提到的所有模拟框架都是相当不错的投注,我个人最喜欢的是Moq,我喜欢将它与MSpec(Machine.Specifications)一起使用,但当然每个开发人员或团队都需要为自己做出这些选择。

If you haven't already, get the NuGet plugin for Visual Studio and use that to install all your frameworks. 如果您还没有,请获取Visual Studio的NuGet插件并使用它来安装所有框架。 If you are using a CI build and don't want to check these items into your version control, there is a ' no-commit workflow ' for NuGet that uses the NuGetPowerTools package. 如果您正在使用CI构建并且不想将这些项目检查到您的版本控制中,那么使用NuGetPowerTools包的NuGet有一个“ 无提交工作流程 ”。

Regarding the examples being in C#, you can use the Telerik Code Converter to easily translate them into VB. 关于C#中的示例,您可以使用Telerik Code Converter轻松将它们转换为VB。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 功能分析困境 - Visual Studio 2010 Ultimate - Function profiling woes - Visual Studio 2010 Ultimate Visual Studio 2010 Ultimate分析器引发异常 - Visual Studio 2010 Ultimate profiler throwing exception 如何在Visual Studio 2010(最终版)中部署C#.net项目? - How to Deploy a C#.net project in Visual studio 2010 (ultimate)? 在Visual Studio 2010 Ultimate中自动化测试(使用TFS) - Automate tests in Visual Studio 2010 Ultimate (using TFS) 在Visual Studio Ultimate 2010中添加MySQL.Data作为参考 - Adding MySQL.Data as a Reference in Visual Studio Ultimate 2010 在Visual Studio 2010 Ultimate的上下文菜单中找不到“resolve” - Can't find “resolve” in context menu of Visual Studio 2010 Ultimate 在Visual Studio 2010 Ultimate中没有出现“创建单元测试项目” - “create a unit test project” doesnt appear in visual studio 2010 ultimate 如何在Visual Studio 2010最终建模项目中创建属性? - How can I create properties in Visual studio 2010 ultimate modeling project? 从Visual Studio 2010 Ultimate中运行NUnit 2.5.5测试,并使用.NET 4.0代码? - Run NUnit 2.5.5 tests from within Visual Studio 2010 Ultimate and using .NET 4.0 code? C#Visual Studio 2010 Ultimate在ClickOnce部署中包含html文件 - C# Visual Studio 2010 ultimate include html files in ClickOnce Deployment
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM