【问题标题】:MSTest empty directory after test deleted删除测试后的 MSTest 空目录
【发布时间】: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


【解决方案1】:

MsTest 似乎在执行后会删除 empty 目录。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-05
    • 2011-10-08
    • 1970-01-01
    • 2012-05-31
    • 2016-10-16
    • 2020-09-19
    • 1970-01-01
    相关资源
    最近更新 更多