Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to run MSTest Tests with code coverage enabled while using NHibernate

I'm unable to run MSTest Tests with code coverage enabled while using NHibernate. I get the following error message:

Unit Test Adapter threw exception: Type is not resolved for member 'NHibernate.Cfg.HibernateConfigException,NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'..

Edit : Same thing happens when I turn on deployment (open local.testsettings under deployment enable deployment)

like image 998
Hannoun Yassir Avatar asked Nov 15 '22 10:11

Hannoun Yassir


1 Answers

Maybe old thread, but I just found the solution and wanted to share. Looks like the problem is in code coverage. When you enable code coverage, it puts assemblies in different folder than usual (probably). So it copies the assemblies but not xml or any other file type. In order to solve the problem, double click Local.testsettings file in Solution Items, select "Deployment" on the left side, click "Add File" and choose hibernate.cfg.xml or any other file you want to be copied to the output directory. The problem should be gone now.

like image 54
Davita Avatar answered Dec 19 '22 20:12

Davita