2011-06-16 46 views

回答

0

我相信你正在寻找的DeploymentItem属性。你用它装点您的TestMethod的是这样的:

[TestMethod] 
[DeploymentItem("testFile1.txt")] 
public void ConstructorTest() 
{ 
    // Create the file to deploy 
    Car.CarInfo(); 
    string file = "testFile1.txt"; 
    // Check if the created file exists in the deployment directory 
    Assert.IsTrue(File.Exists(file), "deployment failed: " + file + 
    " did not get deployed"); 
} 

你也想在你的编莫名其妙的文件(testFile1.txt),以便二进制旁边下降到您的测试二进制文件。我通常只是将文件包含在解决方案中,然后在属性中将“复制到输出目录”标记为“复制如果更新”。

相关问题