您如何重新排序具有不同属性的测试方法,以便它们在代码中在一起?

How can you reorder test methods with different attributes so they are together in the code?

如何重新排序具有不同属性的测试方法,以便它们在代码中在一起?

我有一个现有的文件布局,它很乐意使用 Fields 之后 Display Name 设置为 Test Methods[TestMethod] 属性按名称对各种测试方法进行排序,并且在 All other members.

之前

但是具有 [DataTestMethod] 属性的方法被排序到文件末尾

除了 Test Methods

之外,我在 Display Name 的 R# 设计器中看不到任何选项

注意:这是最新的 R# ... "now" 这是 Ultimate 2018.1

您可以使用 Or 和 [=14] 收集具有特定属性 (HasAttribute) 的所有方法 (Kind) 的模式创建条目或更新当前条目=] 逻辑容器:

XAML代码

<Entry DisplayName="Test Methods">
  <Entry.Match>
    <And>
      <Kind Is="Method" />
      <Or>
        <HasAttribute Name="TestMethod" />
        <HasAttribute Name="DataTestMethod" />
      </Or>
    </And>
  </Entry.Match>
  <Entry.SortBy>
  </Entry.SortBy>
</Entry>

设计器视图: