efl*_*les 1 c# wpf unit-testing visual-studio-2010
我创建了一个测试我的WPF项目的测试项目.我的一个方法需要从一个文件中读取,该文件被复制到bin文件夹中
C:\..\ProjectName\Bin\Debug\
Run Code Online (Sandbox Code Playgroud)
编译时 该方法工作正常,但在运行unitTest时,它会搜索该文件
C:\..\ProjectName\TestResult\UserName_computerName-Date\Out\
Run Code Online (Sandbox Code Playgroud)
如何在运行单元测试时将文件复制到该位置?
小智 5
你在使用MSTest吗?如果是这样,请尝试使用测试文件路径的DeploymentItem属性:
[DeploymentItem(@"C:\vsprojects\MyProject\Tests\testdata\XmlContentFileOne.xml")]
[TestMethod]
public void MyTest()
{
//test
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2654 次 |
| 最近记录: |