mstest - unable to get type error
I'm getting the following error when using "run all tests in solution" or "run checked tests", but if I use "debug checked tests" they run fine.
Unable to get type TestDataLayer.T开发者_运维百科estPatientDAO, TestDataLayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. Error: System.TypeLoadException: Could not load type 'DomainLayer.BaseEntity' from assembly 'DomainLayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
DomainLayer.BaseEntity is an abstract class.
Removing and adding the reference to DomainLayer again didn't help.
Unloading and loading TestDataLayer or DomainLayer didn't help.
edit: removing and adding CodeCoverage solved the problem (wtf)
Adding as an answer to help others discover a possible solution to this problem:
As per myAces, I was getting a TypeLoadException when running MSTest unit tests from within Visual studio 2010. Debugging the tests would work flawlessly, Running the tests via the Resharper tests would pass flawlessly.
Like myAces, the Code Coverage was the problem. To fix I performed the following:
Test Menu -> Edit Test Settings -> Local
Data and Dianostics -> Untick the Code coverage option -> Apply & Close
Then reapplied Code Coverage to required assemblies and everything works fine.
精彩评论