title: define "finally"-action after tests are cancelled
body: <p>How can i define an action which will be executed when i manually stop/cancel a unit-test-execution in visual studio?</p>
  
  <p>Background:</p>
  
  <p>We have built a c#-backend-library for our solution which writes several objects in our database (ms-sql-server). then we wrote some unit-tests for this library. we want to test the complete persistence-process, so the unit tests are doing following things:</p>
  
  <p>-Create a temporary test-database with unique name (eg "projectName_Test_21c7d8d3") for the test-cases. (Because the unit-tests may obviously not write data in the production-system-database.)</p>
  
  <p>-Add some objects to the database (and change/remove them).</p>
  
  <p>-Delete the temporary database at the end.</p>
  
  <p>This works great. But: The tests last some minutes. Every day it happens that a developer starts the tests, and cancels it manually before the test is finished (eg because he found a "red testcase" and want to fix it instead of seeing the results of the other tests). So the temporary database will not be deleted at the end of the tests and must be deleted manually.</p>
  
  <p>How can this delete-database-process be automated (or general improved)?</p>