title: How to write integration test against database
body: <p>Lets say I have a class like below.</p>
  
  <p>I'm not sure how I would write a unit/integration test against it. Does it need refactoring?</p>
  
  <p>Would it simply be to add an Add/Find method (which it would have in reality), call the Add in the test then call the Delete and then the Find?</p>
  
  <pre><code>public class Repository
  {
      public void DeleteProduct(int id)
      {
          var connstring = ""; //Get from web.config
          using(SqlConnection conn = new SqlConnection(connstring))
          {
              conn.Open();
              SqlCommand command = new SqlCommand("DELETE FROM PRODUCTS WHERE ID = @ID")
              command.Paramaters.Add("@ID", id)
              command.ExecuteNonQuery();
          }
      }
  }
  </code></pre>