p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Test Driven Development with C#: Developing Real World Applications with TDD (http://p2p.wrox.com/forumdisplay.php?f=638)
-   -   Chapter 7: Unit Test Only Tests the Mock? (http://p2p.wrox.com/showthread.php?t=89706)

SleepyCatChris March 26th, 2013 06:05 PM

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

SleepyCatChris March 27th, 2013 10:54 AM

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.


All times are GMT -4. The time now is 11:52 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.