title: Data Driven MSTest: DataRow is always null
body: <p>I am having a problem using Visual Studio data driven testing.  I have tried to deconstruct this to the simplest example.
  I am using Visual Studio 2012.  I create a new unit test project.
  I am referencing system data.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>namespace UnitTestProject1 
  {
      [TestClass]
      public class UnitTest1 
      {
          [DeploymentItem(@"OrderService.csv")]
          [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "OrderService.csv", "OrderService#csv", DataAccessMethod.Sequential)]
          [TestMethod]
          public void TestMethod1() 
          {
              try 
              {
                  Debug.WriteLine(TestContext.DataRow["ID"]);    
              } 
              catch (Exception ex) 
              {
                  Assert.Fail();
              }
          }
  
          public TestContext TestContext { get; set; }
      }
  }
  </code></pre>
  
  <p>I have a very small csv file that I have set the Build Options to to 'Content' and 'Copy Always'. I have added a <code>.testsettings</code> file to the solution, and set enable deployment, and added the csv file.</p>
  
  <p>I have tried this with and without <code>|DataDirectory|</code>, and with/without a full path specified (the same path that I get with Environment.CurrentDirectory).  I've tried variations of "../" and "../../" just in case.  Right now the csv is at the project root level, same as the .cs test code file.</p>
  
  <p>I have tried variations with xml as well as csv.</p>
  
  <p>TestContext is not null, but DataRow always is.</p>
  
  <p>I have not gotten this to work despite a lot of fiddling with it.  I'm not sure what I'm doing wrong.</p>
  
  <p>Does mstest create a log anywhere that would tell me if it is failing to find the csv file, or what specific error might be causing DataRow to fail to populate?</p>
  
  <p>I have tried the following csv files:</p>
  
  <p>ID</p>
  
  <p>1</p>
  
  <p>2</p>
  
  <p>3</p>
  
  <p>4</p>
  
  <p>and</p>
  
  <p>ID, Whatever</p>
  
  <p>1,0</p>
  
  <p>2,1</p>
  
  <p>3,2</p>
  
  <p>4,3</p>
  
  <p>So far, no dice.</p>
  
  <p>I am using ReSharper, could it be interfering in some way?</p>
  
  <p><strong>Updated</strong>
  I have it mostly working now!  I am able to use XML, but when I use CSV my column, which is named ID comes back as ï»¿ID</p>
  
  <p>Not sure why.  I've checked the actual file of course, and no weird characters are present.</p>
  
  <p>For anyone having a similar problem, I turned off Just My Code and enabled Net Framework source stepping, etc. so that I could get more detailed debug information.  This allowed me to determine that ReSharper was causing me problems.  I disabled resharper and modified my attributes like this:</p>
  
  <pre><code>[DeploymentItem("UnitTestProject1\\OrderService.csv")]
  [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\bin\\Debug\\OrderService.csv", "OrderService#csv", DataAccessMethod.Sequential)]
  </code></pre>
  
  <p>And it worked (except as noted).  I am still suspicious of the "bin\debug" in my path, but I'm just happy my DataRow is no longer null.
  Thanks!</p>
  
  <p>Any ideas?</p>