方法属性 TestMethod 和 TestMethod() 之间有什么区别?

What is the difference between the Method attributes TestMethod and TestMethod()?

我正在使用 Visual Studio 单元测试 fwk 为 C# 项目编写单元测试,发现使用 [TestMethod][TestMethod( )] - 任何属性都可以正常工作。它们有什么区别?

属性可以有参数。如果你不传递任何参数,你可以写 [测试方法] 或 [测试方法()].

属性可以与我们的无括号一起使用,尽管似乎普遍的共识是使用它们。

Can you omit the parenthesis from attributes with no params?

这种共识很可能是由于 "regular"(即非属性)方法必须 with parens.