Feature Suggestions

Original test assembly location before shadow-copy

Started by Michael on 10,124 views

Hello!

We have a huge solution folder (with lots of XML documents to be tested) located somewhere relative to the assembly with tests. During normal run via NUnit we call Assembly.GetExecutingAssembly() and construct full path to that folder to read and validate these documents. However using NCrunch it is not possible due to the shadow-copy process.

If I'm not mistaken .NET can manage shadow-copy in a way that preserves original location of assembly in it's CodeBase property (URI form). At the same time current location of the assembly is stored in Location property.

Is it possible to provide original test assembly location the same way in NCrunch?
Hi Michael,

Thanks for posting! NCrunch's shadow copy works at a different level to the standard .NET shadow copy (which is only performed at runtime). As such, this kind of behaviour currently can't be implemented with the way NCrunch is designed.

There are many ways you can work around this problem, however. NCrunch has some runtime features that allow you to access the original location of the test project being executed. If you are using C#, you can also implement NCrunch-specific logic using '#if NCRUNCH' compiler conditions.


Cheers,

Remco
Excellent!

Thank you very much for a great tool!

Post a reply

Log in to reply.