MS unit testing framework
을 사용하여 C# 라이브러리를 테스트하고 있습니다. DeploymentItem attribute
을 사용하여 배포 할 파일을 열어야합니다. 하지만 Test 배포 디렉토리에 파일을 배포하는 것은 아닙니다.DeploymentItem에서 파일을 배포하지 않습니다.
내 단위 테스트 프로젝트에서이 폴더에 TestFile
폴더를 만들었습니다. 여러 개의 파일이 있는데, a.txt, b.txt라고 말하면됩니다.
이제 Unit Test 클래스에서 DeploymentItem 특성을 추가했습니다. 그러나 파일이 복사되지 않습니다.
여기 내 코드입니다.
[TestClass]
[DeploymentItem("TestFile")]
public class CustomLibraryTest
{
public TestContext TestContext { get; set; }
[TestMethod]
[DeploymentItem(@"TestFiles\a.txt")] // THis should deploy a.txt to test deployment directory
{
var path = TestContext.TestDeploymentDir + "a.txt";
// Now when I debug this unit-test, and open path in explorer,
// a.txt is not present in "TestResults\Deploy_fhafeez 2013-05-28 13_02_37\Out" folder
}
}
내가 뭘 잘못하고 있니?
도움 주셔서 감사합니다. 나는 항상 "Copy"를 설정했다. 테스트 설정을 사용하여 배포를 완료했습니다. 이번에 DeplyomentAttribute를 사용하려고 생각했습니다. –