title: How to organize unit tests and do not make refactoring a nightmare?
body: <p>My current way of organizing unit tests boils down to the following:</p>
  
  <ul>
  <li>Each project has its own dedicated project with unit tests. For a project <code>BusinessLayer</code>, there is a <code>BusinessLayer.UnitTests</code> test project.</li>
  <li>For each class I want to test, there is a separate test class in the test project placed within exactly the same folder structure and in exactly the same namespace as the class under test. For a class <code>CustomerRepository</code> from a namespace <code>BusinessLayer.Repositories</code>, there is a test class <code>CustomerRepositoryTests</code> in a namespace <code>BusinessLayerUnitTests.Repositories</code>.</li>
  </ul>
  
  <p>Methods within each test class follow simple naming convention <code>MethodName_Condition_ExpectedOutcome</code>. So the class <code>CustomerRepositoryTests</code> that contains tests for a class <code>CustomerRepository</code> with a <code>Get</code> method defined looks like the following:</p>
  
  <pre><code>[TestFixture]
  public class CustomerRepositoryTests
  {
      [Test]
      public void Get_WhenX_ThenRecordIsReturned()
      {
          // ...
      }
  
      [Test]
      public void Get_WhenY_ThenExceptionIsThrown()
      {
          // ...
      }
  }
  </code></pre>
  
  <p>This approach has served me quite well, because it makes locating tests for some piece of code really simple. On the opposite site, it makes code refactoring really more difficult then it should be:</p>
  
  <ul>
  <li>When I decide to split one project into multiple smaller ones, I also need to split my test project. </li>
  <li>When I want to change namespace of a class, I have to remember to change a namespace (and folder structure) of a test class as well.</li>
  <li>When I change name of a method, I have to go through all tests and change the name there, as well. Sure, I can use Search &amp; Replace, but that is not very reliable. In the end, I still need to check the changes manually.</li>
  </ul>
  
  <p>Is there some clever way of organizing unit tests that would still allow me to locate tests for a specific code quickly <em>and</em> at the same time lend itself more towards refactoring?</p>
  
  <p>Alternatively, is there some, uh, perhaps Visual Studio extension, that would allow me to somehow say that "hey, <em>these</em> tests are for <em>that</em> method, so when name of the method changes, please be so kind and change the tests as well"? To be honest, I am seriously considering to write something like that myself :) </p>