title: Data driven testing in MSTest - problem with TestContext.DataRow
body: <p>I'm having essentially the same problem as the question linked below, but I cannot seem to get it to work. I'm getting "cannot apply indexing [] to an expression of type System.Data.DataRow". As far as I can tell, I have implemented the solution correctly.</p>
  
  <p><a href="https://stackoverflow.com/questions/2993298/problems-with-data-driven-testing-in-mstest/2993346#2993346">Problems with data driven testing in MSTest</a></p>
  
  <pre><code>[TestClass]
  public class UnitTest1
  {
      private TestContext testContextInstance;
  
      public TestContext TestContext
      {
          get
          {
              return testContextInstance;
          }
          set
          {
              testContextInstance = value;
          }
      }        
  
      private ServiceReference1.ProductCatalogClient client = new ServiceReference1.ProductCatalogClient("BasicHttpBinding_IProductCatalog");
  
      [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\CountList.csv", "CountList#csv", DataAccessMethod.Sequential), DeploymentItem("..\\ServiceTest\\CountList.csv"), TestMethod]
      public void AreCountsCorrect()
      {
          int id = TestContext.DataRow["Id"] as int;
          int count = client.GetProductCount(id);
          Assert.IsTrue(count == TestContext.DataRow["Count"] as int);
      }
  }
  </code></pre>