问题
I have a unit test (using MSTest in VS2008 or VS2010) where I create a folder like this:
[TestMethod]
public void TestMethod1()
{
string newdir = Path.Combine(Directory.GetCurrentDirectory(), "WorkingRoot");
Directory.CreateDirectory(newdir);
Assert.IsTrue(true);
}
During the test when I set a breakpoint at the assert, I see that the folder has been created in the specific run folder of MSTest. But when the test has been finished, the folder has been deleted. Why?
回答1:
MsTest seems to delete empty directories after execution.
来源:https://stackoverflow.com/questions/7254030/mstest-empty-directory-after-test-deleted