Wrox Programmer Forums
BOOK: Professional Application Lifecycle Management with Visual Studio 2010
This is the forum to discuss the Wrox book Professional Application Lifecycle Management with Visual Studio 2010 by Mickey Gousset, Brian Keller, Ajoy Krishnamoorthy, Martin Woodward; ISBN: 9780470484265
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Application Lifecycle Management with Visual Studio 2010 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 29th, 2010, 03:26 PM
Registered User
Join Date: Jul 2010
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 7: Unit Testing with the Unit Testing Framework


This was a great chapter with some really good info. However, I didn't see anything on how to deal with outside services or data access. I did a few searches for an MS mock object implementation and didn't find one.

Using this framework is there any way to mock data access api's? If not, are there other solutions for this?

Old July 30th, 2010, 08:04 PM
Wrox Author
Join Date: Mar 2010
Posts: 4
Thanks: 0
Thanked 2 Times in 2 Posts

Visual Studio doesn't come with a mocking framework I'm afraid. Best to stick with one of the popular open source or commercial mocking frameworks available at this time.

Another approach is to use the data driven tests and then either call pointing to this data or replace your data access layer (coded to a common interface) with one that reads test data shipping along with your tests - however I suspect that you tried that approach already.
The Following User Says Thank You to martinwoodward For This Useful Post:
antwarpes (August 3rd, 2010)
Old August 3rd, 2010, 10:43 AM
Registered User
Join Date: Jul 2010
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts


Thanks for the quick reply. I've actually been looking at a new framework being developed by the RiSE group at Microsoft Research. They've developed a stubbing framework called Moles that can be downloaded with the Pex & Moles VS 2010 Powertools.


Moles supports unit testing by providing isolation by way of detours and stubs. The Moles framework is provided with Pex, or can be installed by itself as a Microsoft Visual Studio add-in.
Hopefully this will help anyone looking into a MS framework for stubbing (but not mocking).

Old September 25th, 2011, 08:47 AM
Registered User
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Moles and Mocking frameworks

I have used Moles and it is very powerful but somewhat awkward to use.
So I second Martin's recommendation that you find an open source mocking framework for your ordinary needs. Then use Moles in cases where that does not suffice. I use the MOQ framework and have been reasonably happy. Some of my colleagues like Rhino Mocks. And there are many more.

The reason I call Moles "powerful" is that it enables you to detour any .NET method, including non-virtual/static methods in sealed types. I am not aware of any free, open-source mocking products that can do this. It is a capability normally found only in commercial mocking products like TypeMock.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unit Testing jeffmorris BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 7 May 14th, 2007 06:51 AM
Unit Testing userrob BOOK: ASP.NET Website Programming Problem-Design-Solution 2 November 9th, 2005 10:35 AM
Unit Testing XSLT N.Todd XSLT 2 March 1st, 2005 08:31 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.