是否可以获得 Visual Studio (2010) 或 ReSharper,使用这些方法上的自定义属性使用不同的颜色呈现方法调用。例如:
[Arrange]
private void ArrangeSomeVariablesAndSetup()
{
...
}
[Act]
private void ActOnThoseVariablesOrDoSomethingInteresting()
{
...
}
[Assert]
private void AssertThatSomethingHappeningThatWasExpecting()
{
...
}
然后在调用这些方法时,Visual Studio 应该根据属性以颜色呈现它们,
[Test]
public void MyTest()
{
ArrangeSomeVariablesAndSetup(); <-- Renders in green
ActOnThoseVariablesOrDoSomethingInteresting(); <-- Renders in blue
AssertThatSomethingHappeningThatWasExpecting(); <-- Renders in yellow
}
(属性名称和颜色仅用作示例,我也不一定将其限制为单元测试)