DeploymentItem nie wdraża plików

ja używamMS unit testing framework do testowania mojej biblioteki C #. Muszę otworzyć plik, który wdrażamDeploymentItem attribute. Ale nie jest to wdrożenie pliku do katalogu wdrażania testowego.

W moim projekcie testu jednostkowego utworzyłem folderTestFile w tym folderze jest wiele plików, powiedzmy a.txt, b.txt.

Teraz w mojej klasie testów jednostkowych dodałem atrybut DeploymentItem. Ale plik nie jest kopiowany.

Oto mój kod.

[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
    }
}

Co robię źle?

questionAnswers(3)

yourAnswerToTheQuestion