5

我在查找如何使用 XUnit 在 MS Test Runner(在 Resharper 测试运行器中相同)中根据类层次结构显示测试时遇到问题。

我的结构类似于以下示例:

public class ManagerTests
{
    public class Create
    {
        public class When_Something
        {
            [Fact]
            public void Then_this_should_happen()
            {
            }
        }

        public class When_Something_else
        {
            [Fact]
            public void Then_else_should_happen()
            {
            }
        }
    }
}

我希望它显示为(在测试运行器中):

ManagerTests
    Create
        When_something
            Then_this_should_happen
        When_something_else
            Then_else_should_happen

但我似乎最终得到的是:

ManagerTests+Create+When_something
    Then_this_should_happen
ManagerTests+Create+When_something_else
    Then_else_should_happen

我查看了xunit 配置设置,但似乎没有找到任何调整它的方法。我尝试了不同的分组选项,但没有找到任何解决此问题的方法。发现一些较旧的帖子询问有关此的问题(如this),但到目前为止我还没有找到如何做到这一点。

所以问题是:我怎样才能停止嵌套的类名连接(class1+class2+class3)并呈现它们的层次结构?

4

0 回答 0