473,325 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Testing my DLL with NUnit.

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
Nov 16 '05 #1
4 4181


Frank Rizzo wrote:
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. Thanks

Nov 16 '05 #2
Jianwei Sun wrote:


Frank Rizzo wrote:
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.

Remember, NUnit doesn't build your code, so this is useless.

Thanks

Nov 16 '05 #3
"Frank Rizzo" <no**@none.com> wrote in message
news:u$**************@TK2MSFTNGP14.phx.gbl...
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.
Nov 16 '05 #4
Frank,

How do you get a path to the XML file at runtime?
AppDomain.CurrentDomain.BaseDirectory should return you the original path to
your assemblies.

NUnit performs so-called "shadow copying" of your assemblies to prevent
locking them in the original location. ASP.NET uses the same trick for the
same reason: it allows xcopy deployment of ASP.NET applications.

HTH,
Alexander Shirshov

"Frank Rizzo" <no**@none.com> wrote in message
news:u$**************@TK2MSFTNGP14.phx.gbl...
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

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: serge | last post by:
I've started researching on Unit Testing and I must admit I had never heard of Unit Testing until a couple of months ago. Obviously I am interested in Unit Testing Stored Procedures. I read the...
14
by: | last post by:
Hi! I'm looking for unit-testing tools for .NET. Somthing like Java has --> http://www.junit.org regards, gicio
3
by: Ole Hanson | last post by:
Hi I am trying to engineer a way of testing that my logging framework is capable of writing to my eventlog. I want to include this test in my already existing NUnit tests - but I'm a little low...
2
by: Curtis Justus | last post by:
Hi, I've been searching for solutions to two issues that are undoubtedly common to everybody. The first is how do my team and I adequately perform unit testing. The second is how can I measure...
1
by: Amos Soma | last post by:
Can anyone suggest automated regression testing tools they use for the .Net apps? We would like to begin nightly automated testing of our apps. If it matters, we use Infragistics for our...
3
by: JJ | last post by:
Hi, In Nunit testing with asp.net are you guys creating a separate Test assembly for testing or integrating right in class themselves? Is anyone using a third party Unit Test addon for Nunit to...
4
by: Peter Rilling | last post by:
Does VS.NET 2005 Professional support integrated unit testing, or is that only with the team system?
7
by: Diffident | last post by:
Hello All, Can anyone please suggest me a good unit testing tool. I have seen NUnit but not sure on how I can use it to test my methods which involve session variables, viewstate variables,...
5
by: Mike Hofer | last post by:
I need some advice, folks, and I'm hoping you can provide it. First off, a few disclaimers: 1.) I am an ardant advocate of code quality. Especially, my own. 2.) I am maintaining a massive...
2
by: Mark Elliott | last post by:
Hi All, I'm just playing with asp.net mvc and link-to-sql for the first time. I'm using visual web developer 2008. I create the project fine, choose nunit as my test framework in the wizard. ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.