Testing my DLL with NUnit.

  • Thread starter Thread starter Frank Rizzo
  • Start date Start date
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
 
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.
 
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.
 
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.
 
Back
Top