Problem: The SQLite assembly referenced by my DAL assembly is not copied to the output folder when performing unit tests (the Copy Local option is set to true ).
I am working on a .NET application in VS2008, with NHibernate and SQLite in my DAL. Data access is open through the IRepository interface (factory repository) for other layers, so there is no need to reference NHibernate or System.Data.SQLite assemblies in other layers.
For unit testing, there is a public factory method (also in my DAL) that creates an in-memory SQLite session and creates a new implementation of IRepository. This is also done in order to avoid using the shared SQLite configuration in memory for all assemblies that need it, and to avoid referencing these internal DAL assemblies.
The problem is when I run unit tests that are in a separate project - if I do not add System.Data.SQLite as a reference to the unit test project, it is not copied to TestResults ... \ Out (although this project refers to my DAL project, which refers to System.Data.SQLite , which has the local Copy property set to true ), so the tests fail when setting up NHibernate. If I add a link to my test project, then it will be copied, and unit tests will work.
What am I doing wrong?
[Update]
I seem to have found the answer here: TFS UnitTesting does not deploy a local assembly to test dir on the assembly server . If I add a reference to this type with some static method in my DAL, it will be automatically copied when I reference the DAL assembly in my tests. This sounds like a hack, but IMHO is a cleaner solution than a stand-alone script, as it creates a βrealβ dependency.
It also seems to be copied if I add the SQLite assembly as an additional deployment item to my test run configuration (LocalTestRun.testrunconfig file).
Thanks for your quick answers!
Groo
source share