Is there a way to specify in an .editorconfig file that I want to use a different naming style for my Unit tests?
Currently we're using something like this: GetAll_GivenNoCustomers_ReturnsEmptyList but I get the suggestion to remove the underscores from the name: GetAllGivenNoCustomersReturnsEmptyList and the dotnet format command actually changes this.
For all our other methods this behavior is desired, just not for our tests.
Is there a way to treat our unit tests differently?
Like a way to sense the presence of the [Test] attributes before the method definition?
Or (less preferred) exclude our test projects from this naming rule?
I would like to keep all rules in one single .editorconfig file, which we would like to distribute across different applications and users in our environment.
My undestanding is that you can place a different
.editorConfigin the UnitTest project folder, and it will take those instead.From http://docs.editorconfig.org/en/master/editorconfig-format.html:
You need to watch for
root = trueAlso check this answer: https://stackoverflow.com/a/40348831/486564 regarding adding rules for certain folders from the
.editorConfigfile.