title: Writing Integration Test For Entity Framework
body: <p>We have a huge application that contains</p>
  
  <ul>
  <li>Web Layer - MVC</li>
  <li>Service Layer - Web API</li>
  <li>Domain Layer </li>
  <li>DB Layer - EF 5 Code First</li>
  </ul>
  
  <p>we wrote hundereds of unit test to avoid further problems. Now we want to write Integration Tests against database.</p>
  
  <p>Until now we have been using xUnit for unit tests. 
  But i couldn't be sure how can we go forward and i have some questions.</p>
  
  <ol>
  <li>Do you suggest to write one approach to "Top to Bottom" integration test. So writing a test method that uses MVC action that go through all layers and affect database or splitting to parts like Web - API, API - DB?</li>
  <li>I searched for xUnit about Fixtures but i couldn't find a sample of using IUseFixture against Entity Framework.</li>
  <li>We are using Code First migrations, so i think initializing database will be easy, because all migration files are at our hands. But how can i use them to create test database?</li>
  <li>Our team consists more than one developer so isolating each of them is important. I can use developement db server or local db for this but againly i couldn't find a way to change connection string according to user.</li>
  </ol>
  
  <p>Not now but in near future we are going to run these tests with TFS 2012 builds.</p>