简体   繁体   中英

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 .

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.

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...

Thanks in advice!

EDIT

Moq along with AutoFixture did the job

Moq is my mocking framework of choice, but that's just a personal preference. 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.

You really can't go wrong with either Moq or RhinoMocks.

Rhino and Moq will both give you what you need. If money is not an issue I would also suggest Typemock .

Rhino, Moq and (my favorite) FakeItEasy are nice mocking/faking frameworks.

It shouldn't matter which language you're testing in (VB or C#), but to be safe check the docs for all these frameworks. I know FakeItEasy supports VB.NET. You should also look into Roy Osherove's book about unit testing in .NET, highly recommended.

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.

If you haven't already, get the NuGet plugin for Visual Studio and use that to install all your frameworks. 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.

Regarding the examples being in C#, you can use the Telerik Code Converter to easily translate them into VB.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM