Possible duplicate:What is a Mocking object and when do I need it?
You might really start writing tests for B and implement B as soon as you find out that you need it, then go back to A. But when you get back to A, you can use the layout for B so that your test on A really tests A and his interactions with B.
In part, there may be another class C that B uses to do some of its work. If you want to test A with real B, you will also need C, and of course the difficulty can be continued.
mocks, , A B, , , , B.
, Mocks TDD, nat pryce blog http://www.natpryce.com/
, . , (db view i.e.) () .
, .
, A B ( "" - ). A B, , A, , B - B - "" , , "" "" "", . , - , , - A, B. , , , B - , B - -, , - , webservice . "" B, A, B . , B .. - , .
Layout objects present an interesting idea, but they contradict the concept of unit testing. If class A uses class B, it really integrates the logic into classes A and B. In this case, class A is not a candidate for unit testing, but a candidate for integration testing. Unit tests are intended only for some classes, and not for all, as many so-called TDD experts believe.