title: Test Driven Design and Layered architecture
body: <p>How to apply TDD over enterprise application that has layered architecture?</p>
  
  <p>I want to know how to apply TDD to an application that has following  </p>
  
  <ol>
  <li>WPF application (6-7 screens)     </li>
  <li>3-4 Modules  (Prism modules)</li>
  <li>Some application services (Logging, Exception Handling, Security, Authorization, Core Business services library)  </li>
  <li>Data Access Layer (using Entity Framework)  </li>
  <li>A bunch of WCF services</li>
  </ol>
  
  <p>As I understand, first thing is to get the architecture right. As a result, Components are identified. 
  Next is to develop the components independently, <em>where I stuck</em>.</p>
  
  <p>With TDD, design (of a component) evolves with  time. For a component following is the way (I perceive) to go with TDD  </p>
  
  <ol>
  <li>Identify all use cases  </li>
  <li>Identify all test cases  </li>
  <li>For each test case, write all scenario, and for each scenario, write a failing test case. Make little code, so that test case is passed. Add to list, if new scenario is found  </li>
  <li>Follow Red-Green-Refactor until all the test cases (corresponding to all scenario) are passed  </li>
  <li>In the refactoring, dont forget DRY, YAGNI, Mocking, DI, etc,etc.  </li>
  <li>End result is well designed Component (how much well designed depends on experience and skills of developer).  </li>
  </ol>
  
  <p>Problem i face is, For a component, until i reach to Step 6 of TDD process, i donot know the interfaces. Since there are multiple components, multiple teams, No body is sure what they will come up with.  </p>
  
  <p>Now the summary Questions based on above scenario   </p>
  
  <ol>
  <li>Is there some basics that I am missing? Please point me to appropriate resources if yes.</li>
  <li>How to apply TDD over layered architecture?</li>
  <li>How to do parallel development of multiple components </li>
  <li>Best practices for TDD with WPF UI (PRISM)</li>
  <li>Best practices for TDD with Database (using Entity Framework)</li>
  <li>How to decide WCF service contract, when using TDD?</li>
  </ol>