views:

23

answers:

1

I added a HolidaysSchedule.xml file to my Unit Test, and set it's property "Copy to output directory" to "Copy Always".

This file contains the holidays of my client.

When I do a "Debug Tests in Current Context" on a specific test that I wrote to check to see if a date is a holiday, I get this error.

Test method FRB.EC.Utils.MiscUnitTests.ConsoleAdminXMLHoliday.Test_July4_2010 threw exception:  System.IO.FileNotFoundException: Could not find file 'c:\Source\Dev\Utils\TestResults\myuser_mymachine 2010-07-07 14_25_25\Out\HolidaysSchedule.xml'..

How do I get the file to copy to the appropriate testing/runtime directories? I could use an absolute disk/path reference, but I was hoping to make it relative to the /bin directory.

+1  A: 

Two problems:

1) I was lacking the "s" in HolidaysSchedule.xml filename. So of course, always check the exact spelling. But then had exact same issue.

2) Based on this page: http://msdn.microsoft.com/en-us/library/ms182475.aspx

I did the following: In VS2008, clikcked "Test" from menu bar, then "Edit Test Run Configurations", then "Local test run". Then I clicked "Deployment" on the left, then clicked the "Add File" button and added my HolidaysSchedule.xml file, then saved and rerun the test, which then worked fine.

NealWalters