Reputation: 3702
I have a MVC project where I have a Class Library setup as my Test project. However, when using NUnit to run my tests, it is complaining about not finding the Nhibernate.config (which is in my Web project bin.
The exact error:
<solutionName>.UnitTests.CatelogEditing.Can_View_All_Products_On_Admin_Product_List:
System.TypeInitializationException : The type initializer for '<solutionName>.Domain.Infrastructure.BootStrapper' threw an exception.
----> NHibernate.Cfg.HibernateConfigException : An exception occurred during configuration of persistence layer.
----> System.IO.FileNotFoundException : Could not find file '<myrootpath>.UnitTests\bin\Debug\nhibernate.config'.
Any help is greatly appreciated.
Upvotes: 1
Views: 1339
Reputation: 13200
Have you set the following properties of the config file:
Build Action: Content
Copy to Output Directory: Copy Always
To ensure that it is copied to the bin directory?
Upvotes: 4
Reputation: 494
You need to add config file into your tests project because it doesn't know about your web project and doesn't see NH config file.
Upvotes: 2