title: Unit/integration testing EF with Effort - Connectionstring not found
body: <p>I recently started using the in-memory database Effort to unit test my entity framework implementations.</p>
  
  <p>Everything works well, except when I try to load data from a CSV file into the database using the CSV dataloader.</p>
  
  <p>Documentation on exactly how to configure the csvdataloader seems to be scarce / insufficient.</p>
  
  <p>Here is one of the NUnit 3.0 unit tests I have written:</p>
  
  <pre><code>    [Test]
      public void GetBudgetIncomeItems_MultipleValidItems_ReturnList()
      {
          //Prepare and load data
          var dataLoader = new CsvDataLoader(@"&lt;DirectoryOfUnitTestProject&gt;\Data");
          var entityConnection = Effort.EntityConnectionFactory.CreateTransient("name=&lt;NameOfMyCSVFileWithoutCSVExtension/DatabaseName&gt;", dataLoader);
          _serviceContext = new ServiceContext(entityConnection);
  
          //Execute test
          var items = _query.GetBudgetIncomeItems(new Application {Id = 3});
  
          //Check results
          //Some assertions
      }
  </code></pre>
  
  <p>An exception is thrown on the line:</p>
  
  <pre><code>Effort.EntityConnectionFactory.CreateTransient("name=&lt;NameOfMyCSVFileWithoutCSVExtension/DatabaseName&gt;", dataLoader);
  </code></pre>
  
  <p>Exception detail:</p>
  
  <blockquote>
    <p>System.ArgumentException was unhandled by user code<br>
    HResult=-2147024809   Message=Connectionstring was not found Parameter
    name: entityConnectionString   ParamName=entityConnectionString<br>
    Source=Effort   StackTrace:
           at Effort.EntityConnectionFactory.GetFullEntityConnectionString(String
    entityConnectionString)
           at Effort.EntityConnectionFactory.GetEffortCompatibleMetadataWorkspace(String&amp;
    entityConnectionString)
           at Effort.EntityConnectionFactory.CreateTransient(String entityConnectionString, IDataLoader dataLoader)
           at Infrastructure.EF6.UnitTests.PacsQueryTests`1.GetBudgetIncomeItems_MultipleValidItems_ReturnList()
    in
    \PacsQueryTests.cs:line
    36   InnerException:</p>
  </blockquote>
  
  <p>Any help would be appreciated...</p>
  
  <h2>Update</h2>
  
  <p>As per comments from @Evk below, when using Code first, you have to make use of the DbConnection and DbConnectionFactory classes, and not the EntityConnection and EntityConnectionFactory classes.</p>
  
  <p>My updated code, which does not throw any errors, looks as follows:</p>
  
  <pre><code>        [Test]
          public void GetBudgetIncomeItems_MultipleValidItems_ReturnList()
          {
              //Prepare and load data
              Effort.DataLoaders.IDataLoader csvDataLoader = new Effort.DataLoaders.CsvDataLoader(@"&lt;DirectoryOfUnitTestProject&gt;\Data");
              var dataLoader = new Effort.DataLoaders.CachingDataLoader(csvDataLoader,false);
              DbConnection dbConnection = Effort.DbConnectionFactory.CreateTransient(dataLoader);
              _serviceContext = new ServiceContext(dbConnection);
  
              //Execute test
              var items = _query.GetBudgetIncomeItems(new Application {Id = 3});
  
              //Check results
              //Some assertions
          }
  </code></pre>