【发布时间】:2011-08-31 07:50:37
【问题描述】:
我有一个单元测试(在 VS2008 或 VS2010 中使用 MSTest),我在其中创建了一个这样的文件夹:
[TestMethod]
public void TestMethod1()
{
string newdir = Path.Combine(Directory.GetCurrentDirectory(), "WorkingRoot");
Directory.CreateDirectory(newdir);
Assert.IsTrue(true);
}
在测试期间,当我在断言处设置断点时,我看到该文件夹已在 MSTest 的特定运行文件夹中创建。但是当测试完成时,该文件夹已被删除。为什么?
【问题讨论】:
-
Directory.GetCurrentDirectory()返回什么?
标签: c# .net unit-testing mstest