title: how to unittest a sqldatareader?
body: <p>I am wondering how to unittest a SqlDataReader?</p>
  
  <p>class MyClass has GetRows method:</p>
  
  <pre><code>   public static SqlDataReader GetRows()
      {
             SqlDataReader reader = null;
             DataSet dst = new DataSet();
             SqlCommand cmd = null;
  
             //more code here
      }
  </code></pre>
  
  <p>My unittest:</p>
  
  <pre><code>[Test]
  public void Generator_GetFeedRowsFromDB()
  {
              SqlDataReader dr = MyClass.GetRows();
              var test= dr;
  
              //turns out the reader dr is closed at this point : (
  }
  </code></pre>
  
  <p>How can I create a unit test for the datareader ? Should I use a different class to retrieve my rows?</p>