Hello,
Perhaps you should first ask yourself why you are looking to mock
them ?
Do you need to mock them or do you want to mock them ?
if you need to mock them, then the reason might also be the answer: if
B and C are not available to you yet, you have to mock them. If D
accesses a database, then you could only mock D.
Michael Feathers listed the reasons to mock an object :
# It talks to the database
# It communicates across the network
# It touches the file system
# It can't run at the same time as any of your other unit tests
# You have to do special things to your environment (such as editing
config files) to run it.
http://www.artima.com/weblogs/viewpost.jsp?thread=126923
Otherwise, you can unit test B&C and D thru A, that's fine.
HTH,
Philippe
http://pantras.free.fr