Note that there are some explanatory texts on larger screens.

plurals
  1. POSQLite assembly not copied to output folder for unit testing
    primarykey
    data
    text
    <p><strong>Problem:</strong> SQLite assembly referenced in my DAL assembly does not get copied to the output folder when doing unit tests (Copy local is set to <code>true</code>).</p> <p>I am working on a .Net 3.5 app in VS2008, with NHibernate &amp; SQLite in my DAL. Data access is exposed through the IRepository interface (repository factory) to other layers, so there is no need to reference <code>NHibernate</code> or the <code>System.Data.SQLite</code> assemblies in other layers.</p> <p>For unit testing, there is a public factory method (also in my DAL) which creates an in-memory SQLite session and creates a new IRepository implementation. This is also done to avoid have a shared SQLite in-memory config for all assemblies which need it, and to avoid referencing those DAL internal assemblies.</p> <p>The problem is when I run unit tests which reside a separate project - if I don't add <code>System.Data.SQLite</code> as a reference to the unit test project, it doesn't get copied to the TestResults...\Out folder (although this project references my DAL project, which references <code>System.Data.SQLite</code>, which has its Copy local property set to <code>true</code>), so the tests fail while NHibernate is being configured. If I add the reference to my testing project, then it does get copied and unit tests work.</p> <p>What am I doing wrong?</p> <p><strong>[Update]</strong></p> <p>It seems I've found the answer here: <a href="https://stackoverflow.com/questions/851960/tfs-unittesting-not-deploying-local-copy-assembly-to-test-dir-when-on-build-serve">TFS UnitTesting not deploying local copy assembly to test dir when on build server</a>. If I add a reference to that type in some static method in my DAL, it will get copied automatically when I reference the DAL assembly in my tests. This does seem like a hack but IMHO is a cleaner solution than having a separate script since it creates a "real" dependency.</p> <p>It seems that it also gets copied if I add the SQLite assembly as an additional deployment item to my test run configuration (LocalTestRun.testrunconfig file).</p> <p>Thanks for your quick answers!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload