Wrox Programmer Forums
|
BOOK: Professional Test Driven Development with C#: Developing Real World Applications with TDD
This is the forum to discuss the Wrox book Professional Test Driven Development with C#: Developing Real World Applications with TDD by James Bender, Jeff McWherter; ISBN: 978-0-470-64320-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Test Driven Development with C#: Developing Real World Applications with TDD 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 March 26th, 2013, 06:05 PM
Registered User
 
Join Date: Mar 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Chapter 7: Unit Test Only Tests the Mock?

I really appreciated chapter 7 overall, it was a nice walk-through of a simple TDD approach.

However, I'm concerned about the part that tests that an ArgumentNullException is thrown. The way it is written, this unit test is testing the mock, not the actual entity!

Maybe the example wasn't completed accidentally, but code should have been added to the ItemTypeRepository to actually throw an ArgumentNullException when called with "null".
 
Old March 27th, 2013, 10:54 AM
Registered User
 
Join Date: Mar 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Looking at it further this morning, I think I see where my confusion was.

I was mistakenly thinking the code was doing a setup on the ItemTypeRepository.Save method, when in fact it's on the NHibernate session.Save method.

I'm assuming this method in fact does throw an ArgumentNullException in actuality.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 7 Unit Testing with the Unit Test Framework - examples blaurence46 BOOK: Professional Application Lifecycle Management with Visual Studio 2010 1 September 24th, 2011 10:07 AM
Unit tests for agathas storefront ksouthworth BOOK: Professional ASP.NET Design Patterns 1 December 18th, 2010 01:09 PM
about unit test samvan BOOK: Professional ASP.NET Design Patterns 1 November 13th, 2010 06:32 AM
Where are all the unit tests? Extrakun BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 1 July 17th, 2007 05:39 PM





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