rickgaribay.net

Space shuttles aren't built for rocket scientists, they're built for astronauts. The goal isn't the ship, its the moon.
posts - 258, comments - 163, trackbacks - 28

My Links

News

Where's Rick?



Visual Studio Connections, 3/26

That Conference, 8/13



About Me
I am a developer, architect, writer and speaker, passionate about distributed .NET technologies and Application Lifecycle Management. I am currently the General Manager of the Connected Systems Practice at Neudesic.


    follow me on Twitter



    Archives

    Post Categories

    Published Works

    Making Configuration Files Available to NUnit

    NUnit can be run against any type of portable executable (PE), including DLLs and EXEs.

    Often, you will need the test that is calling a component to behave as if it itself were the actual call site, meaning that any configuration settings that will be in effect at deployment time should take effect during testing as well. For EXE based assemblies, this is a trivial issue- simply add an app.config to the test project in Visual Studio and away you go.

    When unit testing non-executable assemblies (DLLs), however, this isn't as straighforward because DLLs cannot execute without a host process. In this case, take the app.config you created and copy it into the bin directory in which the assembly you are testing is loaded. Rename the app.config to the full name of the assembly that NUnit will load.

    For example, for an assembly called "Ess.ServiceGateways.Epm.Interop.dll", you would rename the app.config to "Ess.ServiceGateways.Epm.Interop.dll.config".

    NUnit will probe for a configuration file with the same name of the assembly hosting the tests and load the configuration accordingly.

    Print | posted on Wednesday, March 21, 2007 2:07 PM | Filed Under [ Misc. Visual Studio ]

    Comments have been closed on this topic.

    Powered by: