Does anyone have any experience getting MSTest to copy hibernate.cfg.xml properly to the output directory? All my MSTests fail with a cannot find hibernate.cfg.xml error (I have it set to Copy Always), but my MBUnit tests pass.
相关问题
- Resharper 7 on VS2012 ignores assembly redirect in
-
NHibernate Query
with detached criteria… - Fluent NHibernate automap PostGIS geometry type
- Using NHibernate to execute DDL statements
- Setting Linq to NHibernate ADO Command Timeout
相关文章
- Log4Net Multiple Projects
- Fluent NHibernate — Saving Entity with Composite K
- Attribute filter syntax for code coverage in TeamC
- Is this the right way of using ThenFetch() to load
- How to replace Middleware in integration tests pro
- Can Persistence Ignorance Scale?
- How to find if a referenced object can be deleted?
- NHibernate SQL query slow
a workaround rather than an answer: NHibernate supports programmatic configuration. so you can write your own native properties/config file and parse it into hibernate configurations on startup.
Ran into the same thing a few weeks ago -- this is actually a bug with MSTest -- I believe this was corrected with the recent Service Pack Release (even though it still says "Active"). If not, all I had to do was reference my hibernate.cfg.xml directly (sloppy but works for testing -- this is referencing the hibernate.cfg.xml file in my tests project from the "TestResults" folder):
I like to mark my NHibernate config files as Embedded Resources, and use the Configuration.Configure() overload which reads config files from the Assembly Resources.
Edit localtestrun.testrunconfig (in your solution items folder). Select the deployment option and add the hibernate.cfg.xml file to the list of additional files to deploy. The file should then get copied to the output directory where the test gets run.
You can try adding the DeploymentItemAttribute to one of your tests, or edit your .testrunconfig file and add the file to the Deployment list.