Beginning to Mock with Rhino Mocks and MbUnit - Part 2
page 5 of 5
by Ben Hall
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 50040/ 158


We have discussed how to isolate your business layer tests by mocking out the data access layer so it is reliable and the only test what it is supposed to. We then discussed how to actually test the data access layer, mocking out the database and web service for most of the tests, but then how we actually have to hit the database and web service in order for complete code coverage.

You can download the full code solution using the link at the top which contains all the tests, implementations and web service.  If you have any questions or comments, please feel free to contact me.


View Entire Article

User Comments

Title: saf   
Name: saf
Date: 2012-12-06 12:46:37 AM
Title: SE   
Name: Rakib
Date: 2010-05-12 6:29:21 AM
Its a very good article
Title: CannotConnectToDatabaseException   
Name: Ben Hall
Date: 2008-04-03 10:12:17 AM
CannotConnectToDatabaseException is a custom exception I created in my production code (what is being tested) because I couldn't create a SqlException to raise from that side :)
Title: Listing 5: Expect.Call GetAllBooks but call GetBooksWithPriceBelow   
Name: Bert Vanpeteghem
Date: 2008-01-15 5:13:50 AM
A question on Listing 5:
In the record-section: there is Expect.Call(mockDataAccess.GetAllBooks())...
And in the playback-section:

Shouldn't the call to GetBooksWithPriceBelow also be in the record?
Title: S/W Engineer   
Name: Bill Campbell
Date: 2007-10-15 12:52:47 PM
Here's a link to the first one:
Title: Beginning to Mock Part 2 Needs a Part 1 Link   
Name: Roger Jennings
Date: 2007-10-15 11:01:12 AM
There's no obvious link to Part 1 in the introduction, which recommends it for readers unfamiliar with mock frameworks.


Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2019  |  Page Processed at 2019-05-26 5:21:44 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search