Testing my DLL with NUnit.

F

Frank Rizzo

I have a DLL that relies on an XML file (that's in the same folder as
the DLL) to read some startup information. When I test my DLL, it seems
like NUnit actually copies the DLL into some temp folder (where my XML
file obviously doesn't exist) and executes it there. Obviously the test
fails because the DLL can't find the XML file.

How can I force NUnit to execute the DLL in place?
Or is there any way to have it also copy my XML file to its temporary
directory?

Thanks
 
J

Jianwei Sun

Frank said:
I have a DLL that relies on an XML file (that's in the same folder as
the DLL) to read some startup information. When I test my DLL, it seems
like NUnit actually copies the DLL into some temp folder (where my XML
file obviously doesn't exist) and executes it there. Obviously the test
fails because the DLL can't find the XML file.

How can I force NUnit to execute the DLL in place?
Or is there any way to have it also copy my XML file to its temporary
directory?

You should be able to set it in Property -> Common Properties -> Build
Events.
 
F

Frank Rizzo

Jianwei said:
You should be able to set it in Property -> Common Properties -> Build
Events.
Remember, NUnit doesn't build your code, so this is useless.
 
J

John Vottero

Frank Rizzo said:
I have a DLL that relies on an XML file (that's in the same folder as the
DLL) to read some startup information. When I test my DLL, it seems like
NUnit actually copies the DLL into some temp folder (where my XML file
obviously doesn't exist) and executes it there. Obviously the test fails
because the DLL can't find the XML file.

How can I force NUnit to execute the DLL in place?
Or is there any way to have it also copy my XML file to its temporary
directory?

It's not NUnit doing this, it's Visual Studio (or whatever you're using to
build the tests).

In the test project, right-click the Reference to your DLL, pick
"Properties" and change "Copy Local" to false.

You could also add a build event to copy the XML file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top