I am writing unit tests for a C# project using Visual Studio Unit test fwk, and found that using [TestMethod] or [TestMethod()] -any of the attributes work fine. What is the difference between them?
A attribute can have parameters. If you don't pass any parameters you can write [TestMethod] or [TestMethod()].
Attributes can be used with our without parens, although it seems like the general consensus is to use them.
Can you omit the parenthesis from attributes with no params?
This consensus is most likely due to the fact that "regular" (i.e. non-attribute) methods must be called with parens.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With