Hi,
We hit a weird issue this morning where our test was running fine under nCrunch, but would fait with resharper or mstest. It turned out that a required DLL that is referenced in the project was copied over by nCrunch, but not mstest.
This dll is referenced in our project, but is never used directly. It is only used in the app.config to drive unity (yes, we'll leave the xml-based config of unity soon enough). MSTest sees the reference, but sees no use of it (no "using" i assume); therefore it won't copy it over. It's optimization... i guess.
While I agree this is a bad behavior on mstest's part, it would be nice if nCrunch would warn you about it so that our CI runs fine.
Here is an example (we use unity, but let's make it simpler) :
In a test project, add a reference to an other project in you solution (let's call those
A.Tests and
A).
Now, in a test class in
A.Tests, do something like :
Code:
Activator.CreateInstance("A", "A.Namepsace.AClass");
However, never directly call a class in
A, never import it or anything. If you only indirectly use the classes in
A, MSTest will "optimize" things and remove
A from the output folder. Activator will then try to find it and you will get an ugly error of type System.IO.FileNotFoundException. I would have pasted the output here, but it's all in french so I guess this is useless.
Here are some guys (girls too, maybe) who had the same issue :
http://stackoverflow.com...enced-project-libraries
Hope this is clear!
Thanks,
Jni