测试后删除MSTest的空目录

测试后删除MSTest的空目录

本文介绍了测试后删除MSTest的空目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个单元测试(在VS2008或VS2010使用MSTest的),我创建一个文件夹是这样的:

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);
}

在测试过程中,当我设置一个断点断言,我看到该文件夹​​已MSTest的具体运行文件夹中创建。但是,当测试已经完成时,该文件夹已被删除。为什么呢?

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?

推荐答案

MSTEST似乎删除执行后,目录

MsTest seems to delete empty directories after execution.

这篇关于测试后删除MSTest的空目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 02:10