我在单元测试中添加了一个HolidaysSchedule.xml文件,并将其属性"Copy to output directory“设置为"Copy Always”。
这个文件包含了我的客户的假期。
当我对我编写的特定测试执行"Debug Tests in Current Context“以检查日期是否为假日时,我收到此错误。
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'..如何将文件复制到适当的测试/运行时目录?我可以使用绝对磁盘/路径引用,但我希望它相对于/bin目录。
发布于 2010-07-13 04:41:46
两个问题:
1)我在HolidaysSchedule.xml文件名中缺少"s“。所以,当然,一定要检查拼写是否准确。但也遇到了完全相同的问题。
2)基于本页面:http://msdn.microsoft.com/en-us/library/ms182475.aspx
我做了以下操作:在VS2008中,点击菜单栏中的“测试”,然后点击“编辑测试运行配置”,然后点击“本地测试运行”。然后单击左侧的"Deployment“,然后单击"Add File”按钮并添加我的HolidaysSchedule.xml文件,然后保存并重新运行测试,然后运行测试。
https://stackoverflow.com/questions/3199064
复制相似问题