-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSTEST0004 contradicts MSTEST0002 for nested test classes #2591
Comments
It's not entirely clear to me. What's the reasoning behind having the outer class if that's not a test class? You also don't get any warning if you put the outer class as |
The reason for having the outer class is for grouping purpose. So I can have the outer class named according to the class under tests, and then the inner class for the unit of work or method name. If I put a |
Yes we have some plan to raise on empty test class. I was wondering from what side to tackle the issue and I am wondering if the test class should not be empty rule should be handling this case rather than the rule about public class having to handle this case. Let me bring that discussion with the team and I'll report our preference. |
After a few discussions, we will not change the current rules but we will take this case into account when implementing the rule about empty test class. Our reasoning is that |
Describe the bug
The analyzer rule MSTEST0004 (PublicTypeShouldBeTestClassAnalyzer) contradicts MSTEST0002 (Test classes should have valid layout). for nested classes.
Consider the following code, which warns with MSTEST0004 for the
TopLevelClass
classExpected behavior
The code does not raise an MSTEST0004 analyzer violation
Actual behavior
The code raises an MSTEST0004 analyzer violation.
When changing the
TopLevelClass
to internal, I get anMSTEST0002
andMSTEST0003
warning, which is correct.In my opinion, the
MSTEST0004
should be raised only if the respective class does not contain nested test classes.The text was updated successfully, but these errors were encountered: